This week's book giveaway is in the Agile and Other Processes forum. We're giving away four copies of Darcy DeClute's Scrum Master Certification Guide: The Definitive Resource for Passing the CSM and PSM Exams and have Darcy DeClute on-line! See this thread for details.
I have completed my project and documentation, but before I send it in, I would like to pose the following questions to the forum... 1. My project has 45 classes in it. Some of them are not absolutely necessary but using them satisfies the 'requirement' that the project be implemented in a way that can be easily enhanced. Has anyone received point deductions for using a lot of classes? 2. I have only developed / tested using a Windows environment. As a result, I did not include directions on how to run this application on any other operating system. Has anyone gotten feedback from Sun that indicates that it should be included? 3. Do the results of the grading indicate why points are lost? Thanks.
1. No number of classes shouldn't have an effect, unless they badly designed. I doubt that in your case. 2. I believe others have not tested on other OS's and it was fine, and I also think they only included directions on how to start it in their OS. However it is "relatively" the same no matter what OS you use.
45 source files (or is it 45 classes?) sounds excessive to me. Somebody conducted a "poll" over here sometime ago, and the average was somewhere around 25-30 source files and 3,000-5,000 lines of code. I would recommend you test under Linux, as the grader will in all likelyhood run your program under Unix. I recently took an EJB course with Sun's instructor, and he told us that they don't have Windows machines in the company. Just my opinion, Eugene Kononov.
There are 45 source files that get compiled. Since there are some anonymous inner classes, the actual number of .class files is a little higher. I could definitely trim 12 classes (Action classes) and move that code into other places, but it would (in my opinion) make enhancing the code in the future more difficult. I put those classes (and a couple of others) in the design to satisfy the requirement that the design allow for easy expansion / enhancement. I probably fall into the average number of lines though.
I wouldn't worry about the number of classes in general. If your system is that many classes then maybe for your design you need that. Now, I heard that you said Action classes. Now I would wonder about the need for classes like this. If as in Action you mean Button clicks, etc. then they shouldn't be seperate classes for this assignment. Using listneners is the way to go, inside the Controller. Mark
I created a subclass of AbstractAction and used that as a base class for all the actions that appeared on toolbars and menus (buttons were handled in-line). The base class holds all the convenience methods for setting / getting the various attributes. Each concrete class set the various instance specific data such as name, icon, description, etc. So far, that's pretty simple, but... I also added the ability to add multiple listeners to each concrete action class. In my mind, this allows for Action reuse and it separates the behavior from the appearance. Actions can be defined with a set appearance and then reused in many different places in an application AND in other completely different applications. Yes, this is a little beyond the simple scope of the project, however, I work full time as an application architect and in my mind, reuse is one of the least-realized benefits of OO development and one of the items that I really stress to developers that I work with. I added an action factory that retrieves the proper action based on a simple naming convention. It caches the Actions that it creates so that when the application asks the factory for a specific action, it always gets the same one.
I also use Actions for the main functionalities. They are what I call my controllers. My listeners are inside my GUI classes. And I have over 70 java classes plus several inner classes. And I am still working on the GUI (80% done)! Hope you won't lose points for having so few classes ...
Yes that is a nice way of using Actions, and yes it might be more than is needed. But there is no problem that I would see in using them. I sure wouldn't think they would dock any points for using them correctly, as you are. Yes code reuse, decoupling, and making thing simple, because adding too much complexity usually makes you loose the first two. Good Job, and thanks for posting the explaination of how you are using Actions. Mark p.s Eduard, 70 classes? Are you writing a book? LOL