Solved

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

Posted on 2008-06-22
3
214 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Finding the IIS version 5 37
SSRS Deployment problem 5 91
What is newest platform to convert a massive Windows Forms program to? 7 49
Survey branching tutorial 11 38
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 …
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

713 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