Solved

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

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Access Web appliction 7 48
Red error squiggly on vb.net 7 27
C# application error "Parameter Is Not Valid". 3 79
Automated testing suggestions? 2 28
The Fluent Interface Design Pattern You can use the Fluent Interface (http://en.wikipedia.org/wiki/Fluent_interface) design pattern to make your PHP code easier to read and maintain.  "Fluent Interface" is an object-oriented design pattern that r…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

867 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

22 Experts available now in Live!

Get 1:1 Help Now