   Thoughts and advice
  Hello everyone.I'd just like to share some things I realised recent, so beginners might learn things quicker than I did and maybe so experts can form these thoughts into something more coherent, or direct folks [myself included] to resources that better help.I've seen many begineers, myself included, start with OOP and begin to go class happy. Classes for this, classes for that, classes for everything! The common mantra of 'no globals' certainly doesn't help any. Well, one of the main ideas behind object oriented programming is code re-use. I think that many beginners, myself included, take this the wrong way. We tend to make things overly generic, which simply confuses and hinders actual progress. The classes-for-everything practice doesn't much allow for code re-use, since many times having so many classes leads to specialized code to convert, or move, or choose all these classes for everything.I've found that focusing on per-app code re-use is far more important to making good code. What's the old quote? "If your code has 3 or more identical lines it is designed wrong." It's far better to design so that you're not placing delete's all over the place, or entering in tons of conditionals [if ... else ...] whenever you encounter a piece of data. Ensuring that such things are tucked away makes life so much easier when moving from school-sized applications to anything of complexity.   
  IMHO this is something that is down to personal choice as people will prefer different levels of reuse.I think that reuse is great for things like a math class etc. that can be used alot without the need for changing.I think that you are right that focusing on per-app code reuse is a code thing but I don't think it is more important than writing good code (good code and reusable for me atleast are two seperate things).In terms of game development things change quite a bit across projects so code reuse is more difficult. I think that easily modifiable code is more useful so that the code can be taken across to the new project and easily modified to be used with it.   ;  I agree with you mostly.  I still do occasionaly go "class happy" and end up not making much progress.  However, I think if one wants to make a very OO project, you have to be consistant with the scope of each class.  Make sure it has one purpose, and fills it with as little dependancy as possible, making its reuse alot easier in a different project.  I've found from my personal experiance that things like text drawing, bitmap load/draw, basic transformations, and such, really don't change from project to project, and those would be the prime targets for OO code.Just my $.02   ;  The efforts of beginners should be expected to be somewhat clumsy, and sometimes oscillate between extremes gradually converging on some ideal. That goes for any field.But yes, within-app reuse is probably a good focus; it's easy to explain the principles involved there, while designing classes for reuse between apps is difficult even for experienced programmers.   ;Quote:Original post by DragoncarI think that reuse is great for things like a math class...What is a "math class"? What does an instance of a "math class" represent - a math object? What is that?You want a math library. Reuse doesn't mean OO, and it doesn't mean classes. One of the tragedies of most learning resources is that they don't teach newbies the importance of refactoring code to increase quality or introduce desirable traits such as reusability. I'd like to see a learning resource that does ths.   ;  I think code reuse is just one aspect that is a benifit of OOP.  It is not a constraint.  The real benifit of OOP for a novices point of view is abstraction of the problem domain.  Which allows a programmer to define the problem in terms of the problems context and not the language syntax context.  This allows the programmer greater insight into solving the problem, rather than having to focus on the details of syntax.Of course once implementation occures strong knowledge the syntax of the language you are using speeds things up.  But with OOP the solution is still within the context of the problem domain and not the details of syntax.;Quote:What is a "math class"? What does an instance of a "math class" represent - a math object? What is that?You want a math library.No I mean math class, eg. the Java math class, or one you have written yourself.   