When making a Class....
Everything in there should be related to one thing.
Try make sure that you use interfaces if you can, they save a whole lot of pain.
When making a Method
Make it private, failing that, make it default. Only use public methods if you have to.
Pass in only the arguments you need, and don't pass in complex objects only to extract one or two pieces of data.
One method, one function, one job, one thing!! I can't stress this enough, don't be doing lots of different things in the same method.
Class Variables
You had better have a good reason for using these! If it can be local, make it local.
And be sure you make them private, if not you had better have a good reason.
State
Can you make your classes Stateless? i.e. Are they dependant on Class variables for the results from methods?






0 Comments