- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
In UML the meta-meta model (Class, Association, etc) references itself, so that it can instantiate itself to create the meta-model (The classes you define). Next you instantiate your model to get the objects. See OMG MOF specification for more details about metamodelling.
Admin
I enjoyed that one, that's pretty funny ... I will have to remember that next time some forgets to use an alias and needs help.
Admin
I'm not sure what your point is. So the meta-meta model is a collection of meta-objects that can instantiate itself and also instantiate objects? And this ends the debate how?
Admin
Not sure what you mean Richard Nixon. One of us is misunderstanding the other, I think, since it sounds like you're confused between Otto and The Simplifier. I was kind of replying to both Otto and The Simplifier, which I suppose wasn't obvious from my post. I would have quoted, but I've kind of given up on quotes on this site. Sorry about that.
Admin
Does this mean that we were all wrong? It's not just objects. It's not just classes and objects. It's just meta-meta models?
Admin
I hate this convoluted, symantical arguing. The point is that an object is an instantiation of a class, but a class is itself an object, sure. But the class IS NOT THE SAME AS THE OBJECT! You even said it above. ('class' bytestring).
If you don't think so, check out this:
or maybe even this for smalltalk:
Notice how it is defined as a 'special' object. That is why there is a distinction made when people are taught about OO. If you just went and said "classes and objects are the same", no one would ever get it. It needs to be made clear that classes and objects are different (or a class is a special object, not the instantion of itself, but the defintion of the instantiated object).
I am starting to think that you know just enough to be dangerous. Which object is the class object? if you were to inspect it, what would it be? That is why it is special and different. Get it?
Admin
Seriously?! Now that is the real WFT!
Admin
According to Turing Completeness, no (http://en.wikipedia.org/wiki/Turing-complete). However, there are lots of problems that are more easily solved in other languages. That's why people write new languages, after all.
Admin
I think you could do it with Javascript.
Admin
No, he simply mispelled "depraved".
Admin
Just do everything in BrainF***. It's Turing complete and you only have to learn eight characters.
Or (to keep theme with the code) try INTERCAL. It's Turing complete as well as very polite, and if you read INTERCAL code out loud it could pass for poetry at some of the more esoteric coffee shop readings.
Someday...I will need to code something that is best done in INTERCAL.
Admin
Why not enjoy a text adventure? http://jonripley.com/brainfuck/games/
Sincerely,
Gene Wirchenko
Admin
This reply is not a real reply it's a metareply-- a metareply describing the previous real reply, a reply that is a pattern of a reply, a reply factory if you want.
Admin
That's the funniest thing I've seen all day. I hope I get to do that to someone one day...
Admin
I refuse to program anything major in BrainF*** until they have a .NET version with a form designer...
Anybody working on Visual BrainF***?
Admin
You're not satisfied with a simple BrainF*** .NET compiler?
http://bluesorcerer.net/esoteric/bf.html
Admin
An IDE can be found here:
http://www.4mhz.de/bfdev.html
Unfortunately, it's not .net, but with those 2 tools, it should be easy to create great .net programs!
Admin
Indeed. I've written some pretty cool "OO" stuff in JavaScript, which is prototype-based. Methods of the prototype are the equivalent of static in C#.
[waits to get flamed for using (gasp!) JavaScript...]
Admin
Well, there's using JavaScript and there's ABusing JavaScript. For the former, see Doug Crockford's place ( http://www.crockford.com/javascript ). For the latter, well, there's a whole webfull of crap out there, ain't there?
Admin
A class is a definition, a classification of things, eg: Dog. They are not the objects themselves, the concrete representation of the classification Dog, eg: Rover. You can also have abstract classes, eg Unicorn, that has no concrete representation, it is an abstract class. Object !eqv Class.
Admin
Sorry, but "Unicorn" is a bad example for an abstract class. From an abstract class, you should be able to inherit a non-abstract class. But every instance of a class that inherits from "Unicorn" would also be a "unicorn"...
"Mammal" might be an abstract class; no animal is a direct instance of "mammal"; but rather an instance of e.g. "dog" instead.
Anyway, when it comes to analogies with animals, prototype-base OO languages are better suited to closely model the reality.
Admin
Or they say "Hey, there's a really strange problem here, which my deadline doesn't give me time to fix properly. This kludge can get the product out there in time so that the company doesn't go under." For why fixing everything the right way isn't necessarily good, see the Mars project (http://www.computer-dictionary-online.org/Mars.htm?q=Mars) or Worse is Better (http://www.dreamsongs.com/WorseIsBetter.html).
-Lars
Admin
Not precisely the same argument. A better one would be:
An apple is a fruit.
There is no difference between apples and fruits.
Admin
OO and UML have made the word "IS" even more ambiguous and confusing. I'd like to see UML and OO people handle the following:
<FONT face=Verdana size=2>Consider the following phrases (from Martin Fowler on classification and Generalization):
1. Shep is a Border Collie.
2. A Border Collie is a Dog.
3. Dogs are animals.
4. A Border Collie is a Breed.
5. Dog is a species.</FONT>
<FONT face=Verdana size=2>1+2 = shep is a dog. Ok
1+2+3 = Shep is an animal. Ok
2+3 = A Border Collie is an animal. Ok
1+4 = Shep is a Breed. Huh?
2+5 = A Border Collie is a species. Huh?
1+2+5 = Shep is a Species. Huh?</FONT>
<FONT face=Verdana size=2>I remember some person proposed eliminating the verb "to be" from the english language because of all the trouble. Sometimes for fun I do that when I make posts. I find that the exercise makes me think more, write less, and write more politely / humbly.
</FONT>Admin
Citing is unnecessary to those who have mastered the Tao.
Admin
I can see the potential here... BFdev is for the Win32 personality of BrainF*** and the as yet undeveloped Visual Studio plugin would be for fully managed BrainF***
Admin
The real wtf is that 127 people responded and no one took the time to try it out.
Perhaps that is because VB programmers don't read thedailywtf. The wtf as stated is barely a wtf itself.
What really happens, is that VB.NET won't let you define a structure unless at least one of the members is non-shared (non-static).
However, if one or more members are non-shared, it actually works as it says (as the coder found out from the VB error message). The shared (static) members are indeed shared amongst all objects created and the non-shared members become instance variables for the created object.
If the original programmer wanted to have the whole structure as shared, (s)he should have declared all the structure members as non-shared and then when using the structure (which is only a definition anyway - like a class) declare it as: "Shared UserInfo As UserInformation". It appears that the 'sharedness' is inherited from the structure definition.
But the REAL wtf is that C# doesn't have the same restriction as VB.NET and allows a struct to be defined with all static members. Same company, same framework, different results.
Admin
A "class" doesn't become an "object" until it is instantiated. Until you call a constructor a "class" is simply a blueprint for an "object".
But maybe I am splitting hairs?
Admin
Don't tell that to a singelton. Or to a class with a private constructor and static members.
Admin
In Python (and in SmallTalk too, I think), you're wrong...
If we take this simple class: "class SomeClass(object): pass"
then isinstance(SomeClass, object) == True
So, SomeClass is an object.
Admin
Nah, you're just wrong. A class is an object in the first place, an object that generate objects (the instances of the class) via the constructor call. But there is no reason for a class not to be an object itself, it can be an instance of the "class" or "type" metaclass for example, which is the class of a class. And this "class" or "type" metaclass is itself of type "class" or "type" (it's it's own type/class), and it inherits from the "object" type/class at the root of the language's object hierarchy.
Now most languages don't expose the metaclass level, and the ones that do don't always make it easy to work with it (metaclass hacking is kind of a black magic. Ruby makes it quite easy to do though, it's much harder in python for example), and as a result some languages don't even give access to classes and functions/methods as first-class objects (or in a convoluted way, see Java). But they still are.
In Python, Smalltalk and Ruby at least, I think Common Lisp's CLOS also has classes-objects and metaclasses (which seems reasonable since everything in lisp is data, and code is data, and data is code, and the parentheses will burn your eyes and screw your brain).
And to go even further than your example:
Same thing in Ruby
As you can see, the basic Ruby object model is a bit more complex than python's, but there is a common characteristic: it's recursive and every type or meta-type is an instance of a unique base metaclass ("Class" in Ruby)
I barely know smalltalk and don't know the CLOS at all so I can't give you any example for them.
A class is an object that can somehow create other objects (an object factory), that's all there is to it. That's especially clear in Ruby where instantiation doesn't use any syntactic sugar, merely the call of a public method of the class (that would translate into a public static method of a Java class)
Admin
You're confusing me; what is the really real wtf?
That is seriously a huge wtf: that the staticness of members can be modulated by instantiation prefixes. So, two more bizarre things about VB's class handling to my list: (1) you cannot instantiate "structures" with only static members but "class"es are OK (there's no programmatical reason to forbit this (admittably unnecessary) practice, and the distinction between structures and classes seems arbitrary); and (2) if "structures" are like classes then being allowed to change the staticness of members by instantiation prefixes would violate the original composition architecture.
Admin
As for this whole <var>intUserID</var> vs. <var>strUserID</var> debate, did no one else notice that he's already got two string variables there for the user name/ID?
I'd agree with whoever guess that the two UserID variables are just for convenience.
Admin
Hey, where'd my bold text go? My whole point is ruined by formatting!
I'd meant to highlight "Shared strUserID As String" and "Shared Username As String".
Wow, I should post more. This comment system really is worthy on the incessant complaining. I'm just kind of sad that it didn't mangle the quote in my previous post so I could give the obligatory "Hey, what happened?"...
Admin
On my browser, I can see the bold text. In thise case, the real wtf&tm; is not the forum software, but your browser.
Admin
Well, no. My second post wasn't self-referential. The (lack of) bold text I was referring to was actually in my initial post where I quoted Alex. I meant to embolden those two variable declarations but that didn't seem to show up in what actually got posted.
Though I'm not inclined to blame Firefox for the forum's woes, this all seems to stem from my not being able to switch between the "Design" and "HTML" tabs on the comment form after a while. The tabs and the actual content of the textbox got out of sync, and it looks like all the changes I made after that point were lost (such as changing the word "guess" to "guessed"). So, I really don't know if that's Firefox's fault or not, but...well, which seems more plausible: the forum being buggy or the browser being buggy? If I were using IE maybe I'd see your point...
Admin
Please remember that OO is all smoke and mirrors. Objects and classes are just things that are designed to make it easier for us to write maintainable programs. Is there a real difference between the concept of a class truely being a meta-object and the concept of the language simply simulating that meta-object for the benefit of the person at the keyboard? If you think about it, then the difference comes down to "how was the complier built". If it was built in C, then it's all pretend. If it was written in SmallTalk, then it was intended that way. Since for nearly all modern languages the compiler is built in the actual language, it is what it is.
Example: I write some code in MicroChip PIC assembler. It has about 35 instructions, no floating point operations - single byte integer math only. While writing in assembler, I work under a lot of restrictions and my mindset is to keep things very simple. I write in assembler to keep code small and to deliver a solution that works fast on a very cheap part. While writing for the same system in C, suddenly I can call functions, do floating point math, use string variables. Nothing has really changed, the language and compiler simply make a lot of magic happen for me. It doesn't matter which of these environments I consider "true", truth is in the language spec.
More food for thought: In most languages, a virtual function is implemented as a simple jump function that jumps to the current implementation. If that is overloaded in a child class, the jump function is replaced with a jump to the child implementation and any calls to the base class functionality call the old jump address. That is highly non-object oriented, but that is how things have to get done. Processors don't support objects or inheritance and if they did, it would be at a high level and would need a concrete implementation that was procedural.</Foo:0x354fb28>
Admin
Admin
Admin
Even though it's lacking in many areas, and the prototype-based object model is extremely cumbersome and annoying to work with, ECMAScript is an extremely OO language indeed (and the prototype-based OO makes the classes fully open in a Ruby fashion, allowing the user/programmer to modify the various built-in types such as Array or String by extending them through new methods).
On the other hand, I'm not sure you could point at a language and say "this is the most OO" (what arguments would you use in the first place, besides "everything is an object with no exception period" which many languages feature atm), and even if you could it would probably be Smalltalk.
Admin
You are absolutley right, should say "blessed" instead of "VB-deprived".
Admin
Hmm. A guy in the third-year of our CompSci degree course wrote some Pascal code which went a bit like this:
/* Read input file to count the letters and words. Stop when . is read. */
program Assignment(input,output)
int lettercount, wordcount;
char ch;
boolean done;
begin
lettercount = 0;
wordcount=0;
done=false;
repeat
read(ch);
if (ch== ' ') then
wordcount = wordcount +1;
lettercount = lettercount + 1;
until done;
end.
He came to ask for help because it wasn't stopping when he typed .
Admin
Third-year? Are you sure it wasn't a three-year-old instead? ;-)