Untitled.Bat |
Developer, dad & dangerously dopey.....Also awesome at alliteration and assonance . Visit my main website @ http://www.xerxesb.com if you're tech-inclined |
G10: Vertical Separation - Variables and private functions should be defined close to where they are used. Local variables should be declared just above where they are used and private functions should be defined just below where they are used. We would like to limit the vertical distance between invocations and definitions.
G11: Inconsistency - If you do something a certain way, do all similar things in the same way. This refers to The Principle Of Least Surprise. Simple consistency, when readily applied, can make code much easier to read and modify
G12: Clutter - Keep source files clear of clutter. This includes empty default constructors, fields and functions that are never used, comments that add no value.
G13: Artificial Coupling - Artificial coupling is coupling between two modules that serves no direct purpose, It is a result of putting a variable, constant or function in a temporarily convenient, though inappropriate location. This is lazy and careless. Take time to define where these members should be defined and find the most appropriate place for them
G14: Feature Envy - When a method uses accessors and mutators of some other object to manipulate data within that object, then it envies the scope of the class of the other object. The methods of a class should only be interested in the variables and functions on that class itself, and not the internals of another. We want to eliminate Feature Envy because it exposes the internals of one class to another.
G15: Selector Arguments - Selector Arguments are just a lazy way of avoiding splitting a function into several smaller ones. A parameter to the function (either bool, or other type) is used to select the behaviour of the method (eg: CalculateWage(bool includeOvertime) ). It is better to have many functions than to pass some code into a function to select some behaviour.
G16: Obscured Intent - Code should be as expressive as possible. Run-on expressions, hungarian notation and magic numbers all obscure the author’s intent.
G17: Misplaced Responsibility - The most important decision a developer can make is where to put code. Based on The Principle Of Least Surprise, the code should be placed where a reader would naturally expect it to be.
G18: Inappropriate Static - In general you should prefer non-static methods to static methods. If in doubt, make it non-static. Only make a method static if you don’t want it to behave polymorphically, it doesn’t rely on any state, and it gets all its information from the arguments passed into the method.
Clean Code: Chapter 17