Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

NEWBIE: Is this a proper class design? 5

Status
Not open for further replies.

DeanConsulting

Programmer
Jan 11, 2002
131
0
0
US
Hello,

I am new to OOP programming and struggling a little. So, please be easy on me.

I want to design a small software application that keeps track of a user's software keys. The program will be able to add, edit, and delete keys from a file. The data for a key will be: title, version, purchase date, key1, key2, author, and contact.

I want to do this in Java. I am not so much interested in the code to do it rather I am interested in how to create classes and objects.

Here is what I have come up with: (Comments/Suggestions please)

Class:
softtitle

Properties: name,version,purchaseDate,key1,key2,author,contact

Methods:
saveTitle(),loadTitle(),deleteTitle(),displayTitle()

Is this even close to being right or am I not grasping the concepts of OOP yet?

Thanks in advance,
Noble





---------------------------------------
Noble D. Bell
 
Business Rule can fit in 7 places in the UML 'Spec'
1) In the middle, you have the rules that say that people (actors) want to do some specific thing -A Use Case.
2) Any rules that are more global than that go into the 'Non-functional Spec'.
3) Any rules that are 'smaller' than the use case rules go into one of 5 places on the class diagram:
3.1) Attribute constraints 'x > 5'
3.2) Class Constraints 'if x==fred then y>5'
3,3) Pre-conditions on methods: 'this method can be run if y>5'
3.4) Post-conditions on the method: 'The output will match the Rete Algotithm'.
3.5) Constraints on Associations ' 1..*' and OCL constraints.

Now, except for the 'non-functional' bit, all the business rules have formal places in the UML; either in the use cases or in the classes.

Now all UML tools provide user configurable reports. Rose and RSM have Soda Reports, Select and Visual Thesaurus have built in configurable reports. These are what I call UML Reports. Without them, UML is almost crippled. Only the trained UML people can recover information. With them, UML becomes the repository of all we know. What you do is structure a report that reports these 6 UML things in a logical pattern and you have a Glossary or whatever you want.

To change the Glossary or what ever, you just change the class diagram or use case spec, and there it is, a revised version of the Glossary etc. One source of data cannot be inconsistant. True, the Glossary can be out of date and so appear to be inconsistant, but if everything is up to date it is entirely consistant. And the data is only entered once not twice or three times.

Now if every Use Case is reported using a UML report, all the business rules in all the classes associated with it can be included (if the users really want that). What is more, they are not in the usual jumble, but will all come out grouped by class and within calss by the types 3.1 top 3.5.

Another advantage of this approach is that when describing use cases, it is often the practice to add a list of associated business rules in the document. So if one class is used in the sequences resulting from say 5 different use cases, the 3 or 4 business rules from that class are repeatedly re-written in 5 different documents. Now change a business rule, and you have a lot of updating. Some people try to overcome this by putting the business rules in Requisite Pro. This cuts the 5 or 6 copies back to 2 copies, because at the end of the day, the programmer is going to have to enter the rules into his classes, whether as a copy of Req-pro to his class diagram or directly to his java.

Why not write it once in one place; the class diagram. Then keep the code reverse engineered in with the class, and it is always properly distributed. OK Round trip engineering is not very good these days, but it is getting better. Even if this is not used, you KNOW that all the rules in the java come from one place: the class diagram.

Even Use Case specifications such as Alisear Cockburns specs, can be added into the UML. With UML Tags, all the sections can be included rather nicely. Unfortunately Rose and not even RSM support Tags, so we will continue to mix Word and UML and try to keep them in synch. Ugh! 'I hate Rose!', Select had Tag equivalents over ten years ago for exactly this reason. This is what I assume they were introduced into v1.4 to allow.

Gil
 
Thanks Gil, that's very informative. I generally have done UML diagrams using a drawing tool (Visio...ugh), and documenting them on the side. Maybe if Microsoft can buy a UML drawing tool and leverage it into their opsys in such a way as to put the other tools out of business, they will have more support for UML. Until then (may it never happen), most places that will shell out several grand for a proper UML development tool will be java shops.

Bob
 
Although not free, (but an order of magnitude cheaper than most others), Sparx Systems' Enterprise Architect is a very good tool, and their support is excellent. It also supports all the UML2 diagrams, proper database repository, versioning to source control, reporting (to hyperlinked RTF or HTML), etc.

You can download a month's trial from their website.

Steve

[small]"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object::perlDesignPatterns)[/small]
 
I have since tried Sun Studio 8 - Seems to be very good. This is free.

I have since bought Visual Paradigm. I like it. Not too expensive. Some promising Analysis tools that could be brilliant if they worked on them a bit.

Gil
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top