I started development when I was almost 14, and the first language was Pascal :) . It was a very interesting language and with it I had a very nice way to start thinking at problems in steps and try to fix them element by element. Fixing the problems was also the reason why I continued with software development, because the challenge was always to fix the problems in a easy way, without complicating my self and without putting others in the difficulty of not understanding what I did.
After that came C, and C++, C#, Objective C and others. I learn those languages in collage, in university or by my self. Every language with its style, properties, frameworks and applicability. And in all this years the things which remained the same are the principals; it doesn’t matter if I build applications for iOS, for Windows Phone, Web or WPF applications, the OOP principals are the same.
Today I decided to display them here. They are so simple, and so easy to be used, but sometimes we forget about them and then… our code has some extensibility issues, or complexity or one piece of code does more then it should be doing.
So here they are:
- Encapsulate what varies
- Favor composition over inheritance
- Program to interface not implementation
- Strive for loosely coupled designs between objects that interact
- Classes should be open to extension but closed for modification
- Depend on abstractions, Do not depend on concrete classes
- Only talk to your friends
- Don’t call us, we’ll call you
- A class should have only one reason to change
The list is from Head First Design Patterns book. If the lines are not self explanatory just have a weekend reading session, and the Head First book will really help.