Any ideas on rules for good OOP style?

@movicont (495)
United States
July 24, 2008 3:33pm CST
So, anyone have specific rules they follow for good object-oriented programming? Here're some thoughts I've had: (1) Don't make something a variable if a function can be written to calculate its value based on something else. This way your program will be more versatile if new things get added. (2) Duplicated code snippets is not a good idea. Better to create a new function for that. (3) Split functions into many smaller objects. Though I have heard others say it's better to keep it in as few objects as possible. (4) Classes with verb-like functionality should just be included in the class with a noun-like name. I.e., the functionality in EyeController or EyeManager should be kept in the Eye class, not the redundant EyeController class. Any other ideas?
2 people like this
1 response
@perfwill (12)
• Vietnam
24 Aug 11
Just read a book about Design patterns, mate. Some recommendations: Head first Design patterns, The Gang of Four's book about design patterns. Design patterns will teach you what "good OOP" looks like ^^. Enjoy, Hai