programmer | can write comments before writing the code | |
checks for valid generalizations by checking that: - superclasses and subclasses have unambiguous names
- each subclasses retains its distinctiveness throughout its life
- all the inherited features must make sense in each subclass
| |
is responsible for anticipating things that can go wrong and writing exception handling code in preparation | |
is a subtopic of Programming | |
is a kind of kbTop | |
should adhere to object oriented principles | |
should apply the 'isa' rule religiously | |
should avoid duplication of code | |
should avoid over-use of class variables or class methods | |
should choose alternative that makes code simpler over more complicated one | |
should comment any changes to the code so that it is easy to see what has changed from one version to the next | |
should comment whatever is non-obvious but should not comment obvious things as this adds clutter | |
should consider languages other than Java for number-crunching applications | |
should create several small classes, rather than one big, complex class | |
should ensure that anything that is true in a superclass is also true in its subclasses | |
should follow consistent guidelines that make programs easy to read when writing programs | |
should follow the specific conventions for commenting classes and methods that allow for documentation to be automatically generated using a program called 'javadoc' | |
should group classes into logical sections with a clear comment separating each section if a class has many methods | |
should keep related methods together inside a class | |
should keep the number of instance variables small. If this number exceeds 10, then consider splitting the class into separate classes - e.g. a superclass and a subclass | |
should learn about about the different programming strategies that make a Java program run faster | |
should not use tab characters in code - use two spaces for indentation instead because when code is printed on certain printers, or displayed in certain editors, the width of the indentation resulting from the tab can vary and make the code hard to read | |
should pay attention to to the documentation describing which features of Java are deprecated | |
should reject 'clever' or 'cool' coding techniques unless they make the code simpler to understand | |
should remember that shorter code is not necessarily better code but unnecessarily long code is also bad | |
should restructure code to make it simpler if necessary | |
should take advantage of polymorphism, inheritance, abstract classes, and methods | |
should use consistent code layout style | |
should write comments at the same time as writing code , and perhaps even before writing the code | |