Posts Tagged "formatting"

Duplication in your code. Also, duplication. And duplication.

»Posted by on Sep 24, 2009 in Blog, Coding, Technology thoughts | 0 comments

Duplication in your code.  Also, duplication.  And duplication.

From the department of redundancy department, IT coder division: Duplication is probably the single, most important thing to banish from your code. Duplication can take several forms:   textual This is the simplest and often the easiest to find. This is when you have sections of code that are identical or nearly so. This is often a result of copy & paste programming. Several techniques can be used to eliminate it, including: extracting methods and reusing them, making a method into a template method, pulling it up into a superclass, and providing the variations in subclasses, and other basic refactorings. See Fowler’s “Refactoring” for more detail. functional This is a special case of textual duplication and is present when you have multiple...

read more

Code formatting

»Posted by on Aug 18, 2009 in Blog, Coding, Technology thoughts | 0 comments

Code formatting

Code should be easy to read. Code should be convenient to read, not convenient to write. There are several things involved here. Choosing good names that are self-explanatory is a good place to start. Strive for simple solutions, even if they are more verbose or inefficient. Whether inefficiency is a problem won’t be known until profiling is done later in the project, in a real production situation. Choose style and formatting conventions early in the project, and conform to them. Require that everyone conform to them. This will be easier to do if everyone has a hand in deciding on the conventions and buys into them. This will make the code uniform and thus easier to read. And get rid of any and all duplication. Do you format your code?  Your queries?  Using...

read more