Hi,
I have been programing for a project (~ 6 classes and ~1,600 lines) for the last 2 weeks, but I suspect the code design not that strong/
Where can I find some guidelines \ material about correct design + packaging + programming in a robust\good way?
Thanks.
2 replies to this topic
#1
Posted 14 February 2012 - 02:44 PM
|
|
|
#2
Posted 14 February 2012 - 11:12 PM
#3
Posted 16 February 2012 - 01:36 PM
Look up cohesion and coupling.
Your classes need to fit 1 role (cohesion) and class a/ class b should work well together without knowing anything about how the other works. Implementation details should be hidden behind the interface (public methods and variables). This means that if the underlining behaviour of class B changes, then class A will still happily work without any changes to its own implentation. For example, say if you get your information from a database, or a text file, or a properties file, it will not matter. It just gets the information it needs from the class.
Really good design is MVC, especially in web development, where your business logic is seperated from how data is presented (your view/interface) as well as being seperated from page flow and access control (controller). Either way, that's a good start in terms of things to read up. Technically your business logic should be seperated from the persistance code (code that saves the data (database or file)).
Might be worth looking at object oriented principles too, encapsulation and inheritance, plus polymorphism too if you're really interested.
Your classes need to fit 1 role (cohesion) and class a/ class b should work well together without knowing anything about how the other works. Implementation details should be hidden behind the interface (public methods and variables). This means that if the underlining behaviour of class B changes, then class A will still happily work without any changes to its own implentation. For example, say if you get your information from a database, or a text file, or a properties file, it will not matter. It just gets the information it needs from the class.
Really good design is MVC, especially in web development, where your business logic is seperated from how data is presented (your view/interface) as well as being seperated from page flow and access control (controller). Either way, that's a good start in terms of things to read up. Technically your business logic should be seperated from the persistance code (code that saves the data (database or file)).
Might be worth looking at object oriented principles too, encapsulation and inheritance, plus polymorphism too if you're really interested.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









