Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

It’s also possible that I have failed to understand some key points in the chapter.

not really,

this book is only teaching the simplest way to write "OOP" stuff in perl in 2003

Its not trying to teach you OOP/OOAD/what should be an object, what should be a method, should I provide accessors...

See http://perldoc.perl.org/perlootut.html#When-to-Use-OO

See •Re: OO Getters/Setters

See Perl Book OOPS / kind of effort required for learning OO perl ?!


Is OOP considered a universal subject that it could be discussed without any reference to a particular programming language? Are there books that you could recommend on the subject? Thank you. :)

yes its universal, when you search for "perl oo" or "language OO" you end up with very little discussion of WHY-oo only of "how oo", as in "bless {}" ... mechanics

The book you want is https://en.wikipedia.org/wiki/Object-oriented_Software_Construction

See Re: kind of effort required for learning OO perl ?!

See I dislike object-oriented programming in general

Damian Conway's ten rules for when to use OO


See your real problem is you're thinking of objects as bags of attributes.

you should be designing about responsibility, and the actions(methods) needed for such responsibility

why should a Fruit be an object ? Why should a Fruit have a color and name attribute? Why should color/name have getters/setters?

A Fruit should be an object that does stuff, like describe itself, it should have a describe method that returns a description like "red apple"

See How do I go from procedural to object oriented programming?

See High level OOP query


In reply to Re: OOP's setter/getter method - is there a way to avoid them? ( what should be an object and what should it do) by Anonymous Monk
in thread OOP's setter/getter method - is there a way to avoid them? by tiny_monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2024-03-29 15:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found