Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Object Oriented Programming

Name: Anonymous 2010-09-21 13:22

As a novice programmer and as someone who started learning programming with C, OOP just seems annoying to me. Seems as though it's easier to accomplish the same tasks without it. Is it actually necessary to learn it?

Name: Anonymous 2010-09-23 14:05

>>35
I thought you were advocating for fewer animal examples.

>>36
If a little more complexity is what it takes to show a good use of OOP instead of a real world structure that you would never, under any circumstances, want to encode, I think that's fine. If we really want to use animals, for example, we could use an example somewhat like this:
(defclass aminal ()
  (number-of-legs
   brain
   has-claws
   ...))

(defclass brain ()
  (vision-center
   hearing-center
   ...))

(defclass human-brain (brain)
  (language-center
   ...))

It's not necessarily perfect, but (in addition to showing composition as a bonus) it does illustrate a somewhat viable use of inheritance, since brains differ in ways potentially relevant to the operation of the program, and share a certain number of slots (justifying the superclass).

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List