Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
This implementation goes back to the old Diku-style MUDs. I coded on a Diku-variant some years back and it was built in an OO perspective, even if it was in C. (OO isn't a language thing ... languages may support OO, but that doesn't mean that you can't write OO Cobol or Fortran ... it's just a little trickier.)

There are basically two options. The first is that you have a class for every single room/gridpoint. That's a real bear, especially as 99% of all rooms/gridpoints will be nearly identical, save for some textual differences. (Name, description, etc).

The better option would be to have a start-up file for each grid (or zone or area or whatever). This would be a text-file that could either just be text or be a file that you would do and then assign the resultant values to the right places. That way, you can have your standard room/gridpoint which has a field for Name, Description, Exits (with a gridpoint/roomname), etc. Plus, there could be a field for either a room-specific function or a substitute Room object. That's the power of inheritance - so long as there is a RPG::Room::* (or RPG::Point::*) object there, no-one cares what's going on. The object knows what it's about, which is all that matters. You don't care, because the object will take care of everything it needs to take care of.

One of the biggest stumbling blocks a top-down programmer has when switching to an OO mode is the question of "How is it going to work?!?" Well, the answer is "You don't care." It's going to frustrate you to no end, and it still frustrates me to this day, well over 2 years after I started coding OO. But, it's the real answer. You simply do not care how stuff happens. All you want to know is that it does happen.

I guess the best analogy is that you're the manager for a group of engineers/programmers. You are responsible for making sure that Project X gets out the door by the deadline. Are you going to go to each of your programmers and demand hourly status reports? Are you going to go to them and tell them how to do their jobs? Of course not! That's micro-managing and none of us would like that done to us. That's the difference between top-down and OO. Top-down is micro-managing. OO is trusting your subordinates to "do their thing" and it's only if they fail that you go in and fix stuff (i.e., debug the module).

In reply to Re{14}: Modules: Building blocks for the Daft Adventure by dragonchild
in thread Modules: Building blocks for the Daft Adventure by Tiefling

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 or How to display code and escape characters are good places to start.
Log In?

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2022-05-21 18:17 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (77 votes). Check out past polls.