Skip to main content

Beware of OOP

  • Chapter
  • First Online:
Good Habits for Great Coding
  • 4074 Accesses

Abstract

A study by Potok, et al. has shown no significant difference in productivity between OOP and procedural approaches.—Wikipedia, s.v. Object-oriented programming.

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.

    See Wikipedia/Object-oriented programming/criticism.

  2. 2.

    An abstraction in programming is considered to have two parts: interface and implementation. A class interface is the collection of methods—e.g., getters, setters, finders, modifiers, reporters, etc.—that are used to manipulate the data. The implementation consists of the private methods, and the primitive statements in the body of all of the class’s methods. The benefit is that details are abstracted away from (hidden from) the interface. This makes coding easier. For all classes, the minimum number of method types you need is six: constructor, getter, setter, mutator (to change parts of an object), comparison of objects (=, !=, and maybe >), and a printer. In Python you don’t actually need getters and setters—e.g., Oop.x = 5, an Oop.setX(5) is not necessary.

  3. 3.

    No cross product diagram with units can be drawn to scale. If vectors A and B have scalars in terms of meters, the perpendicular cross product vector C = AxB will have scalars in terms of square meters. Also note that scalars in a vector must all have no units or must all have identical units. Otherwise the magnitude will not exist. I was told this by a physics teacher, and curiously never found this fact in a math book. Later I found this mistake in David R. Causton’s otherwise excellent book, A Biologist’s Mathematics (London: Edward Arnold, 1977), page 37. The author tried to find the “distance” between two plant species by measuring both stalk lengths and the number of flowers.

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2018 Michael Stueben

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

Cite this chapter

Stueben, M. (2018). Beware of OOP. In: Good Habits for Great Coding. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-3459-4_16

Download citation

Publish with us

Policies and ethics