Skip to main content

Classes and Objects

  • Chapter
  • First Online:
Bad Programming Practices 101
  • 1607 Accesses

Abstract

Some bad reasons to create classes

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 34.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 44.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    A record is a simple data structure that groups together a collection of fields.

  2. 2.

    Known as the Open/Closed principle, meaning the class should be open for extension but closed for modification.

  3. 3.

    See the earlier section, “Have Questionable Motives for Creating Classes.”

  4. 4.

    This is called the Single Responsibility Principle (Martin, 2009).

  5. 5.

    A concrete class is a class with no missing implementation details, unlike, say, an abstract class or interface .

  6. 6.

    Because both ArrayList and LinkedList implement the List interface .

  7. 7.

    Ways also exist to do this without the use of inheritance ; for example, by using certain design patterns. However, since this section focuses on inheritance, I’ll stick with that.

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2018 Karl Beecher

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

Cite this chapter

Beecher, K. (2018). Classes and Objects. In: Bad Programming Practices 101. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-3411-2_9

Download citation

Publish with us

Policies and ethics