This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Can a user created class extend a non user-created one (i.e. extends JApplet). Likewise, can a user created class implement anything? Is actionPerformed a user-created class (you put the contents in, but essentially its from the ActionListener interface, non user-created.
Sorry if I'm sounding redundant or just plain weird, Parth
Joined: Nov 13, 2003
Can anyone perhaps give a definition? Thanks again, Parth
"User created XXX" is not a formal (or informal) concept in Java, so I think it would be hard to give you a definition. It's just a couple of English words, which presumably mean "a class (or method) written by the user."
Maybe if you gave us some context -- i.e., where you came across this term and why you need it to be clarified -- we could help more. But as it is, it's tautological at best.
Well, its all about what we've been learning in school. Generally, there hasn't been that much of an explicit definition. Obviously, a class that does not implement or extend anything, whether or not it uses methods not created by the same programmer is user-created, and obviously the instantiation of say, JFrame is totally non user-created. However, there are some things that seem to be borderline. The main example I was thinking of was actionPerformed. My dilemma is that the basis for this method was not fully written by me, but the actual meaningful content was. I'm leaning toward the direction of actionPerformed is a user-created mthod, as is something extending JPanel, as long as it is different from the original, but the instantiation of JFrame in the form of JFrame j=new JFrame(); is not. Just needed a more professional opinion on the topic. Thanks, Parth
EVERY class extends Object (either directly or indirectly) whether you create it, the person next to you, or someone at Sun. Even classes James Gossling create extend Object.
That should answer your second question.
If classes you create couldn't implement interfaces or extend other classes they'd be pretty useless right? And so would those interfaces which after all are there to be implemented by someone. That should answer your third question.
As to "user created", everyone is a user. Even the people writing the core APIs are users. That should answer your first question.
"User Defined Types" rings a bell. Is that an official term in C or C++ or something? The ability to define your own types - classes and interfaces and the like - is a key bit of coolness in the whole OO world. It's so fundamental that we don't even think about it. Pretty much everything we write must be in a user defined class of some kind.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
author and iconoclast
Originally posted by Stan James: "User Defined Types" rings a bell. Is that an official term in C or C++ or something?
It rings a pretty old and creaky bell, now that you mention it. C++ people used to use this term, back in the dark ages before there was a standard library. The more modern term for the same concept is "abstract data type", or ADT; again, for the same reason as Jeroen described: because there's no useful distinction between classes written by a "user" and the standard library classes.
Joined: Oct 12, 2000
UDT stems from C where you have built-in types and compound types you define yourself (records). It's also used in other languages.
In Java and other OO languages where types defined by end users plug into the same object hierarchy as those defined by the language creators there is no such distinction. Java might be a special case if you consider everything except the primitives to be UDTs, part of which happen to be shipped by the same people that bring the built-in types.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com