Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

comment on

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

ZXappz::Database anyway because it can contains for example store_new_user and store_action_for_user and so on...

:) That is good thinking, separate the stuff, groupt the database stuff together

but the name should be different from "database" because that is kind of stuff that goes in your "model",

so you might have a ZXappz::UserGroup (or ZXappz::Model::UserGroup) with a add_user and ...

yes it goes in a database, maybe one created from ZXappz::Schema::UserGroup ...

but you call it something important to your app, symbolic not generic

Its like when you first learn programming, no subroutines, just long stretches of code, you have to start somewhere

then the next evolution, you start using subroutines, but its still one file, and they're very long and do too much, and the names are focused on the implementation details

then you start making packages, which is great, but you're organizing principle is not the intent of the code but implementation detail;

Is this terrible? No. Its common, its workable, its maintainable, esp for short programs, but could be improved; and should be improved , esp if you want to reuse the code, and for others to use your code , and enjoy it (collaboration )

There is no reason to take the long way around, jump straight to intent :) organize stuff with big picture in mind, like a house, you have to frame it, but you don't design around the frame, around stud, you design around rooms with purpose, by walking around the house in your head, wake up in the morning, get ready for work, host a party...

start with a story board, how should the user use the application, what should it do

then start with use cases, how should the code be used by the programmer, write that code, and your api will emerge


In reply to Re^4: Proper way to create packages and re-usable code? by Anonymous Monk
in thread Proper way to create packages and re-usable code? by bt101

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 exploiting the Monastery: (10)
As of 2024-04-16 08:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found