Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • OO is about data.

    I think OO is about the behavior of models. Why do you think it's about data?

    • by TheNomad (7014) on 2006.12.10 15:11 (#52191) Journal
      I think OO is about the behavior of models. Why do you think it's about data?

      Well, I was really thinking of Steve Yegge's rant on nouns vs. verbs [blogspot.com].

      In OO every class is really a 'data type'. Even in perl where there are no types :). The essence of OO is to have an object, say $obj, that is data of some type and to have methods that act upon that data: $other_obj = $obj->transform.

      Sure you can have objects that don't 'contain' any data and only methods. But you end up with an ugly looking model, IMHO.

      BTW, I knew that post was going to get me into trouble. I shouldn't have turned on comments :)

      If your problem doesn't reduce to data very well, then your model is going to look odd. Of course, you can alway make your problem reduce to objects if you try hard enough. But if you have to try too hard you need a new model.

      OTOH, maybe I'm just p*ss*d off at having lots of stupid little classes, that don't do anything much, littering my HD

      • In OO every class is really a 'data type'.

        Not the way I write code. If I can create classes without data, I do. (Of course, I've also argued If we can solve problems without computers, perhaps we should. [oreillynet.com])

        • Not the way I write code. If I can create classes without data, I do.
          But then isn't the class just a namespace with a bundle of functions?
          • It is, only in the same way that a function is just a jmp/ret pair. From the external point of view, a class is just a collection of behavior, not data. That's the important point.

            • You may well be right and it may be the best way to think about object-oriented design, but I think most people think of it differently, for example the McGraw Hill dictionary of technology [answers.com]:

              A computer programming methodology that focuses on data rather than processes

              On the other hand TechWeb says:

              Writing software that supports a model wherein the data and their associated processing (called "methods") are defined as self-contained entities called "objects."

              But the whole thing seems confused, the wik

              • Your way of thinking about it may be the best way to simplify design.

                Thanks! I have had roles banging around in my head for a bit over three years now.