hello.consider the following:abstract public class Test {void doSomething()void doSomething(double x, Object o)}with doSomething is "equal" except it for SOME Tests/derivates need args, for others not...there is also some intercompatibilty eg, its okay to call doSemoething(DEFAULT_X, null) if ...
Hi There,I have a class B which extends class A.I'd like to call method in class B and I use it by calling super objectB.method, now objectB.method exists in class A and it needs to call another method in class A not B because it exists the same in B.Is there a ...
I was recently asked the following trivia concerning the Singleton Pattern:The following class implements the Singleton pattern. The basic idea is to ensure that there will only exist ONE instance of the Dog class.public class Dog {public static final Dog INSTANCE = new Dog();private Dog() ...
Hi,I want to write a simple java compiler and I wondered what would be a good design for that project.I need a tokenizer and a parser, that much is obvious.I thought about having a Token class and then create one instance for each token. Of course that would result in a lot of objects but ...
I'm making a chat client that I plan to be reusable for many different chat servers and protocols. It has a complex GUI. I find myself making lots of Singletons, such as one for setting server aspects, one for updating graphical components (I'm separating my GUI from the rest of my program), ...
What alternatives are there to parse java source files and produce class diagrams?Commercial or freeware?Eclipse plugins?Thanks in advance
396 byte By
chungkpa at 2007-10-2 4:04:00
Hi AllI am implementing a tree hierachy with a classes call 'Tree" and "Node". Inside the Node class, I have a function call "setName" for setting the name of the node. This function will only ever be used by Tree for setting the name of the nodes inside the tree. Is there anyway I can make ...
Hi all,I have to create a business objects that handles similar functionality but on different types of objects. This functionality are like update, delete, insert methods for different tables that the object are to hit. So i wanted to know what would be the better way to do it? Should I have ...
Hi.I am developing an application which has to shoot several cannonballs whose path obeys to the gravity law. 2D view. To the right of the view of this model (just a JPanel which shows these balls floating in the air) I have to add three buttons "Play" "Step" "Stop" which control the flow of ...
312 byte By
Jamesa at 2007-10-2 4:23:08
Hi,I'm looking for a good book (or URL) regarding J2EE application design using UML... That is, I know a bit about Java and a little about OO principles but I don't know where to start in terms of putting what I know into practice.Would be grateful for some advice - and thanks in ...
221 byte By
c.ayaa at 2007-10-2 4:26:00
Does anyone know why public enum MyRestrictedSetOfObjects extends SomeOtherClass {...}is forbiden?I would like to have a compiler checked "factory", setup with predefined objects.
i have 2 swt components both including a browser component.they both are instatiated passing a reference to an observable document:public class ObservableW3CDocument extends java.util.Observable { private Document document; private String content; /*** Modifications to the document should be ...
I have come up with a possible solution to a problem I am having and I wanted to get opinions on whether my solution breaks with principles of good encapsulation.I am working with an inner class. I made the class an inner class because it is a helper class for the outer class and it needs ...
292 byte By
ShadowZa at 2007-10-2 4:39:33
I don't if i post it in the correct forum.I am trying to find a way to break up a sources code so that it can be interpreted in the form of methods,fields,constructors so that i can exact out the information, like how Netbeans extract the information. Any one can help ?
What is the Difference b/w implementing a singleton pattern and making a class Static?
188 byte By
myminia at 2007-10-2 4:41:10
Hello All,How can i get a plugin for JSP in Eclipse3.0?What is the procedure for installing the plugin?Please help me out.Thanks in advance.Minal.
We have a large standalone C++ application which we are planning to port into java. Right now we are planning to port only the GUI (front end) part and retain the backend in C++ (Though, in the long long run we might even port the backend part to java but not right now). There are around 200 ...
Can the following code be considered a singleton?public class myClass{private final int SOME_CONSTANT = 0;private myClass() { ... }public static boolean doSomething(String a, String b) { ... }public static boolean doSomethingElse(String c, String d) { ... ...
hello all,please help me by answering these questions?singleton patterns calls for creation of a single class that can be shared between classes. since one class has been created Can singletons be used in a multithreaded environment? is singleton thread safe? Are threading problems a ...
I recently ran into a very old thread in which it was pointed out (correctly, when I think about it) that extending JFrame or JPanel to make a GUI component is technically an abuse of inheritance.I am writing a GUI as part of a project. I want to write it in the most correct fashion possible, ...
Hi,I am into a B2C project. The proposed application should serve the agents working for the firm too. A NFR states that the turn-around time for the agents should be 5 secs max. But for Customers it could be 10 sec max.Proceeding with the design there was a discussion with my colleague. He ...
306 byte By
nazua at 2007-10-2 5:05:57
Can anyone get ma some doc on Chain Of Responsibility Design Pattern. Also some Detailed Real-time implementation as to why is this design pattern needed or what is the adv. of this pattern over others. Any explanation or detail related to this pattern will be ...
Hi.I'm writing an app that reads an xml doc and creates an object model from it.The basic model is this:At the top level, you have a Project. The Project contains Modules. The Modules can depend on (contain) other Modules, but can also depend on Libraries. In turn, each Library can depend on ...
HiI have a Question about a Design issue.For example, I have a class that stores a Hashtable. This Hashtable should never be null, so it is initialized. I have these two alternatives:class Test{Hashtable table= new Hashtable();}class Test{Hashtable table;public Test(){this.table= new ...
1544 byte By
zpyounga at 2007-10-2 5:25:55
I have been working for the past couple of days on a project. I have been researching and studying different methods for developing my project. This project is a very simple order entry system. From my research I have discovered many new terms and concepts that have really got me confused. ...
Okay, I'll start by saying I'm fairly new to server-side development. As a means of teaching myself a bit, I've figured to write a simple forum system using MVC, based on servlet/jsps. I've come up with a pretty accurate class diagram for the classes involved. As a simplified example: ...
778 byte By
bw_ta at 2007-10-2 5:32:10
In a J2EE system...I know that "Business Objects" (BOs) are basically value objects (VOs) ...lots of getters and setters and some business logic. These are basically to model nouns in the system. Eg Student BO.I know that "Data Transfer Objects" (DTOs) are value objects (VOs)....with getters ...
Here I want to post some solutions to immutable and mutable objects. First I'll brifely discribe the case when only one type (immutable or mutable) is need accross the application. Then, I'll describe case when both types is using. And finally, the case when only some object can modify this ...
There is some confusion with using these terms. Usually word delegation is used when forwarding has to be used. Lets consider the examle from http://forum.java.sun.com/thread.jspa?threadID=677566&tstart=40> TrashMaster delegates the task of taking out the> trash to an Employee> ...
1107 byte By
de_toma at 2007-10-2 5:34:43
Hi,I just ran into a problem that kind of baffled me:private class A implements AAA{....private class B implements BBB{private B(){}public B(int mode){ ...}}}A is an inner class of some class and B in turn is an inner class of A. Why is it possible to call B b = new B() from class A, although ...
I am in the process of designing a arcade gallery, of which one of the features manages and loads other games into the gallery, CLASS files. Here is the scenario: 1. User wants to import a Tic Tac Toe Java game (CLASS file) he has downloaded and wants to add it to the gallery (assuming the game ...
3283 byte By
bontimea at 2007-10-2 5:39:33
Hi,I wanted to add an extra metod to java.io.File class. So a created my own File class within my package that should override java.io.File class. Looks like this:public class File extends java.io.File {/** Constructor */public File(String pathname) {super(pathname);}public File(String parent, ...
Like the title of this thread the brevity and value of experienced design advice often helps to navigate the volume of material available.I have found this particularly true with Java when reading all the methods of a new object may not be the best use of precious developer time if there are ...
I'm trying to use the adaptor pattern in a pretty standard way: I have a number of different data models and I implement various adaptors for each model in order to be able to view/edit them. Eg I implement TreeQuestionAdaptor and then I can view my Question objects in my TreeView.First ...
2526 byte By
katriyaa at 2007-10-2 5:50:45
I have an application in which different kinds of messages are sent to the User..i.e.I have a base abstract MESSAGE class , with certain attributes and abstract methods.Now I have sub classes : MESSAGE1 , MESSAGE2 ...so on, with each class having differnt attributesNow I have a MessageBean ...
I've been charged with re-developing a pretty large retail site however, I'm having a little difficulty.We have products - let's say CD, DVD, Game -, now most of these products are supplied by the company - let's say myshop -, but we have one case where they're supplied by a third party - ...
If class implements private interface that extends public interface, it is possibe to cast such a class to a private (sub)interface. Why? Example,public class C { public interface A{public void foo(); }}class CC { interface B extends C.A {public void goo(); }}public class Class1 implements CC.B ...
542 byte By
mbm63a at 2007-10-2 5:57:49
I need to define a common "pattern" for the methods in a class.As example I want all the methods to:1) Retrieve data from a common scope object;2) Test this data;3) Execute the specific functionalites using this data;4.1) If everything work fine -> output the results;4.2) If an error occurs ...
193 byte By
przemeka at 2007-10-2 6:03:55
Hi,Tomorow I have a small java exam. The main subject of the exam are collections an java.io. Does anyone know a good article aboute using Collections (java 5)?Thanx
Hi all,I got the above error when i tried following.I have a class, which initialize two big arrays. Type of them are double and size is approximately 1000*1000.when i click a button, I need to create a object from this class. The object is used only within the button click action event method. ...
1936 byte By
katriyaa at 2007-10-2 6:05:22
Premise:Primary actor is the StoreUser. Every StoreUser will be associated with Messages,Reports, Status.Now my problem lies in trying to figure out which one of the two options is a better one:a) Messages,Reports, Status AGGREGATED in a StoreUser with StoreUser exposing behaviour public class ...
250 byte By
jimmy6a at 2007-10-2 6:07:41
http://bdn.borland.com/article/0,1410,31863,00.htmlPlease have a look at the class diagram. The relationship of Order and OrderDetail is aggregation but how come the OrderDetail and Item is not? They also contains collection there. why?
i am in confusion ?super.B(x) calls a method of super of the class in which this call isbut this.B(x) calls a method of the class of which the calling object is..and also how does the value of a changes is not clear...help plz..ashokclass SuperClass {int a ;int b ;SuperClass(){a=10;b=10;}void ...
37 byte By
jimmy6a at 2007-10-2 6:09:32
Is callback and listener same?
Is it a good idea to make a "common model" object that has an interface for returning the different model objects that comprise the important data in the program? The idea is to allow controllers to easily access the model and its data, without having to pass it around tediously through ...
Hi,I'm a newbie and was wondering if you could help.I'd like to know the best /proper way to do the following, I think I could hack it to do something like what I want it to do, but I'd rather know the best /proper way to do it.I have a two forms the first contains a selectable list of ...
Hi ,I have been trying to get into ent. java apps development coming from a Non-Java world. One of the most confusing thing about the ent. java world is the number of frameworks. When venturing into a project , How does one choose a framework.There are so many of them these days...Struts , JSF( ...
462 byte By
Dubaia at 2007-10-2 6:20:45
Hi!I use a MVC architecture with an observer. At the moment i have only one View, Controller and Model Class.If i want to open a new JFrame for the user to do a small setting or maybe just a JPopup as a context menu, do i have to see this as a new View? With a own Controller?The initial gui ...
Hello,I have a need to cache Oracle blob data locally on disk on the client machine. I am running a plain vanilla java app which connects to Oracle using Type 4 JDBC connectivity.My problem , what should i use to cache data ? FileSystem or RDBMS? currently i see about 3 blob columns from the ...
I was recently reminded that..."The Main Thing is to Keep the Main Thing the Main Thing"I thought about it a bit, as you may do, and realised how vital this is for the 23 patterns.It is a simple requirement of this forum to allow us to communicate.I 'think' I know what the main thing is about ...