Home  /  Questions  /  Question

50   50
Sep 10, 2012

Learning about OOP and Design Patterns


I am C# developer.
I want to improve my OOP programming and design pattern skills. What is the best way to go about this?

Any advice appreciated.

59   95.0
Sep 10, 2012
Learn, code, test, and experiment.

-> I must always at the top and first man at field.
Inheritance -> How many ways to achieve this, without it how to extend a class functionality.
Polymorphism -> How many ways you can do it.
Encapsulation -> What it really means.

You can only improve if you take up a problem and try to solve it in different ways.

Example :

1 Take a complex text file.
2 Write Parsing mechanism for it without OOP
3 Identify reusable sections

Separate these into functions -- this will approach you towards encapsulation (Separate what changes).

Now, think of how your code can be reused by many other programs not written by you. If someone asks you the parser engine how will you expose its functionality and also allowing them to extend (if files need some extra logic for parsing). 
You must consider what should be visible to user you must think Encapsulation (This time it is: Information hiding) also think Polymorphism & Inheritance.

Core: Reusability - to achieve this we have Inheritance, Polymorphism, Encapsulation and Abstraction.