Click here to Skip to main content
15,888,579 members
Please Sign up or sign in to vote.
3.89/5 (2 votes)
See more:
Dear All,

As many folks know that anyone can write a working application after a few months trainning, but not everyone can write a nice and robust application in such short time of period, and in fact many programmers who had a few years experience still can't perform a best practice class design, and unfornaturely, i am one of those poor people.

I read through this link: http://msdn.microsoft.com/en-us/library/ms229042.aspx, but it is just theory and no practical examples there, what I really need is a example that can demonstrate those guidelines or principles.

I had googled the internet, but most of the post there are just theory. Can someone in here supply an example that addresses the good object oriented class design or point me to the right place that has such examples (preferable in c#).

Many thanks.
Posted
Updated 27-Jul-11 21:31pm
v2
Comments
Amund Gjersøe 28-Jul-11 6:01am    
Depending on the size of your project, you should decide on a type of architecture. Simple applications can be implemented using a monolithic architecture, while bigger systems use layered architecture. Some applications can be implemented as a transcript (where a main function call all functions like GetData, ProcessData and SaveData), and some as fully object-oriented designs.

The classes you implement depends on your decided architecture and on your evolving design. So with your "few years experience" you should be able to do some architecture decisions and some sketching on the design of your application, before you start implementing your classes. And when you start implementing, most of the thinking is already done.
AndieDu 29-Jul-11 2:24am    
good suggestion, just as startup, are you able to suggest some links that involves good design of reading in a text file, manipulating the data in a specified manner and then outputting the result. Nothing more complicated than core language elements (classes, iterations, arrays, etc) and basic text file IO (reading/writing)

As I can understand from your question, you can go through some desing patterns :
1. http://www.dofactory.com/Patterns/Patterns.aspx[^]
2. http://sourcemaking.com/design_patterns[^]

These links also have some good working examples.

You can also have a look at a good book that describes the best guidelines when you are developing a framework using .net :
http://www.google.co.in/#hl=en&q=framework+design+guidelines+pdf&oq=framework+design+&aq=1&aqi=g10&aql=&gs_sm=e&gs_upl=9792l12385l4l13504l17l15l0l2l2l0l296l2621l0.2.9l11l0&bav=on.2,or.r_gc.r_pw.&fp=38944046eb5a1414&biw=1440&bih=781[^]

Hope this helps.
All the best.
 
Share this answer
 
Comments
Amund Gjersøe 28-Jul-11 5:48am    
Some good links there.
Pravin Patil, Mumbai 28-Jul-11 7:25am    
Thanks.....
Well, AFAIK, there's no such thing as perfect example that can demonstrate all guidelines and principles. What you can probably do is search for examples per topic. Do it chunk by chunk. It gets registered easier this way, than when you are looking at a large application, which is usually overwhelming. There are plenty of articles here in CP that has code examples that you can play with. Try searching for the article of a topic you want to be familiar with.
 
Share this answer
 
Comments
AndieDu 29-Jul-11 2:25am    
good suggestion, just as startup, are you able to suggest some links that involves good design of reading in a text file, manipulating the data in a specified manner and then outputting the result. Nothing more complicated than core language elements (classes, iterations, arrays, etc) and basic text file IO (reading/writing)
I know this is an older question, but I ran into it as one of the top returns on Google while searching for Object Oriented Design (OOD) links for someone else. I thought it would be useful to add some more info for anyone else who may find this via Google, although it is rather late for the OP.
In order to properly apply OOD to code you really need to understand the theory behind good design principles. Once I read such principles I like to see a good concrete example to improve my understanding so most of the links below will have good examples. An acronym that covers several good OOD principles is SOLID. There is a basic primer on OOD and SOLID here[^]. In short SOLID stands for the following 5 principles:
1. Single Responsibility Principal[^] - A class should have one, and only one, reason to change.
2. Open/closed principle[^] - You should be able to extend a classes behavior, without modifying it.
3. Liskov substitution principle[^] - Derived classes must be substitutable for their base classes.
4. Interface segregation principle[^] - Make fine grained interfaces that are client specific.
5. Dependency inversion principle[^] - Depend on abstractions, not on concretions.

I also recommend reading the Head First Design Patterns[^] book.

For further reading there is a good series on OOP here[^] on CodeProject.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900