Interview Questions

Common types of computer bugs (4)

Why are there Bugs in Software?

(Continued from previous question...)

Common types of computer bugs (4)

Anti-patterns, also referred to as pitfalls, are classes of commonly-reinvented bad solutions to problems. They are studied, as a category, in order that they may be avoided in the future, and that instances of them may be recognized when investigating non-working systems.
The term originates in computer science, from the Gang of Four's Design Patterns book, which laid out examples of good programming practice. The authors termed these good methods "design patterns", and opposed them to "anti-patterns". Part of good programming practice is the avoidance of anti-patterns.
The concept is readily applied to engineering in general, and also applies outside engineering, in any human endeavour. Although the term is not commonly used outside engineering, the concept is quite universal.
Some recognised computer programming anti-patterns

* Abstraction inversion: Creating simple constructs on top of complex (Controversial)
* Accidental complexity: Introducing unnecessary complexity into a solution

* Action at a distance: Unexpected interaction between widely separated parts of a system * Accumulate and fire: Setting parameters for subroutines in a collection of global variables
* Ambiguous viewpoint: Presenting a model (usually OOAD) without specifying its viewpoint
* BaseBean: Inheriting functionality from a utility class rather than delegating to it
* Big ball of mud: A system with no recognisable structure
* Blind faith: Lack of checking of (a) the correctness of a bug fix or (b) the result of a subroutine
* Blob: see God object
* Boat anchor: Retaining a part of a system that has no longer any use
* Busy spin: Consuming CPU while waiting for something to happen, usually by repeated checking instead of proper messaging
* Caching failure: Forgetting to reset an error flag when an error has been corrected
* Checking type instead of interface: Checking that an object has a specific type when only a certain contract is required
* Code momentum: Over-constraining part of a system by repeatedly assuming things about it in other parts
* Coding by exception: Adding new code to handle each special case as it is recognised
* Copy and paste programming: Copying (and modifying) existing code without creating generic solutions
* De-Factoring: The process of removing functionality and replacing it with documentation
* DLL hell: Problems with versions, availability and multiplication of DLLs
* Double-checked locking: Checking, before locking, if this is necessary in a way which may fail with e.g. modern hardware or compilers.
* Empty subclass failure: Creating a (Perl) class that fails the "Empty Subclass Test" by behaving differently from a class derived from it without modifications
* Gas factory: An unnecessarily complex design
* God object: Concentrating too many functions in a single part of the design (class)
* Golden hammer: Assuming that a favorite solution is universally applicable
* Improbability factor: Assuming that it is improbable that a known error becomes effective
* Input kludge: Failing to specify and implement handling of possibly invalid input
* Interface bloat: Making an interface so powerful that it is too hard to implement
* Hard code: Embedding assumptions about the environment of a system at many points in its implementation
* Lava flow: Retaining undesirable (redundant or low-quality) code because removing it is too expensive or has unpredictable consequences
* Magic numbers: Including unexplained numbers in algorithms
* Magic pushbutton: Implementing the results of user actions in terms of an inappropriate (insufficiently abstract) interface
* Object cesspool: Reusing objects whose state does not conform to the (possibly implicit) contract for re-use
* Premature optimization: Optimization on the basis of insufficient information
* Poltergeists: Objects whose sole purpose is to pass information to another object
* Procedural code (when another paradigm is more appropriate)
* Race hazard: Failing to see the consequence of different orders of events
* Re-Coupling: The process of introducing unnecessary object dependency
* Reinventing the wheel: Failing to adopt an existing solution
* Reinventing the square wheel: Creating a poor solution when a good one exists
* Smoke and mirrors: Demonstrating how unimplemented functions will appear
* Software bloat: Allowing successive versions of a system to demand ever more resources
* Spaghetti code: Systems whose structure is barely comprehensible, especially because of misuse of code structures
* Stovepipe system: A barely maintainable assemblage of ill-related components
* Yo-yo problem: A structure (e.g. of inheritance) that is hard to understand due to excessive fragmentation

Some Organisational Anti-patterns

* Analysis paralysis: Devoting disproportionate effort to the analysis phase of a project
* Continuous obsolescence: Devoting disproportionate effort to porting a system to new environments
* Creeping featurism: Adding new features to the detriment of the quality of a system
* Design by committee: The result of having many contributors to a design, but no unifying vision
* Escalation of commitment: Failing to revoke a decision when it proves wrong
* I told you so: When the ignored warning of an expert proves justified
* Management by numbers: Paying excessive attention to quantitative management criteria, when these are inessential or cost too much to acquire
* Mushroom management: Keeping employees uninformed and abused
* Scope creep: Allowing the scope of a project to grow without proper control
* Vendor lock-in: Making a system excessively dependent on an externally supplied component
* Warm body: A person whose contribution to a project is in doubt, especially if taken on in panic

Some social anti-patterns

The status of some of these is likely to be controversial.

* Censorship: Suppressing discussion prevents political, social, and scientific progress
* Concentrated power: Individuals abuse power, even if initially well-meaning
* Dictatorship: No individual has all the skills necessary to govern; also power corrupts
* Discrimination: Discrimination on irrelevant features yields economic inefficiency and social resentment
* Dogmatic religion: Dogma suppresses individual thought and prevents progress
* Intolerance: Insisting on changing undesirable-but-harmless features of other people causes resentment and is an endless task
* Monopoly: Without competition most of the effects of a free market don't occur, and a private company has no incentive to do business fairly
* Plurality voting system: Politics under plurality voting degenerates into two highly-polarised parties, with all other political views suppressed
* Popularity contest: Popularity becomes a self-reinforcing quality, and is unrelated to any useful measure of merit
* Segregation: Separate but equal is rarely, if ever, equal; causes resentment
* Single-party system: Without electoral competition the party has no incentive to govern fairly
* Totalitarianism: Suppressing individuality causes resentment, and the approved way of life is never even remotely suitable for everyone
* Victimless crime: Suppressing harmless behaviour creates a subculture of otherwise-law-abiding people for whom the legal system is an enemy
* Witch hunt: Scapegoats are easy to find, but if the problem is never actually solved then more scapegoats will always be required
* Year Zero: Social change is an inherently slow process; rushing it yields disaster

(Continued on next question...)

Other Interview Questions