Solved

What method would you suggest to use for creating custom classes in .NET?

Posted on 2008-06-22
3
208 Views
Last Modified: 2013-12-16
Hello All.

Ive been reading a book("The object oriented thought process") on oop and all related concpets. In this book they mention a method for coming up with custom classes. They mention a method which uses "collaboration responsibility cards".  To me, this seems like a rather manual process. Is there another solution that exist to accomplish the same goal(coming up with custom classes) which may be faster to implement?

How do you guys come up with your custom classes?
0
Comment
Question by:appbuilder
3 Comments
 
LVL 12

Accepted Solution

by:
marklorenz earned 250 total points
ID: 21842131
CRC cards are an older technique and they work for some people. I am with you, I have not had great results with them - I think a lot has to do with how your particular team likes to use them.

There are a number of ways to discover and create your classes. One way is to look for nouns in requirements documents, such as use cases, or during discussions with domain experts.  Another way is to use a UML tool - a free one is ArgoUML; a commercial one is MagicDraw. These help to draw UML class, state, and sequence diagrams, after which you can generate code to your favorite IDE.

The important thing is to find the correct concepts (classes) and allocate them the correct behaviors (methods) for your business domain.
0
 
LVL 7

Assisted Solution

by:joesthebighmoe
joesthebighmoe earned 250 total points
ID: 21845840
There are many methods and they all have their place. As marklorenz said, sometimes something as basic as noting the nouns can start you off.

However, after the most basic high-level classes have been noted, I believe the best next step is to start walking through user scenarios and figuring out what classes will <b>do</b> what.  This is generally the CRC method, regardless of whether or not you physically produce the cards.  So if actually producing the index cards feels like overkill or too time consuming for a return on investment, then you are probably correct for your current project.  However, this concept of figuring out classes based on needed behavior is still very valid and produces an object design which is more about business (behavior) and less about babysitting a database (data).

I think it also becomes evident that not very user scenario/case/story requires a documented design. Hopefully we can pick out our riskiest or most tricky business logic and start dividing its responsibilities up amongst business objects.

My last recommendation is to think along the lines of behavior that does not change the state of the system. The fact that eventually some data will get stored in a database is usually irrelevant to the business logic that figures out answers. This concept gets referenced in many ways, but often it is referred to as side-affect free programming.  Besides creating code that is easier to test, the approach helps us find our true business objects based on behavior.

Cheers,
Joe
0
 

Author Closing Comment

by:appbuilder
ID: 31469545
Great Job guys. I wish i could have given more point for this question.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Dependencies in Software Design In software development, the idea of dependencies (http://en.wikipedia.org/wiki/Coupling_%28computer_programming%29) is an issue of some importance. This article seeks to explain what dependencies are and where they …
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now