© Karl Beecher 2018
Karl BeecherBad Programming Practices 101https://doi.org/10.1007/978-1-4842-3411-2_9

9. Classes and Objects

Karl Beecher1 
Berlin, Germany


In this chapter, you’ll learn:
  • Some bad reasons to create classes

  • How to make classes rigid and inflexible

  • Lesser alternatives to polymorphism

  • How to abuse inheritance in order to compromise your software design


Before reading this chapter, make sure you’re familiar with:
  • The basic ideas behind object-oriented programming, particularly:
    • Instantiation and the difference between a class and an object

    • Composition (i.e., one class containing a reference to another class)

    • Inheritance

  • Static methods

  • Interfaces in Java, and the interface keyword


Like modular programming, ...

Get Bad Programming Practices 101: Become a Better Coder by Learning How (Not) to Program now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.