Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
As in a's comment, I also tend to write top down using wishful programming. (Where wishful programming is using names of functions I haven't written yet.) This has the benefit of not having to think about everything at once, and if you create stub functions it will actually run and you can slowly build it up. Ah ha, starting to use some XP techniques! (Except I learnt to do this before XP was around...)

When it comes to breaking functions up, if I have a function which is trying to do several different things, it is usually time to break it up. Likewise, a function which is more than a couple of screens long is about due for a break up. Although the screens one is very relative... Especially when I'm writing CGI scripts which are generating forms, they can get rather lengthy.

Over the last couple of weeks I've been writing a interface for managing Spong - using Perl OO. In an object, if I realise that I need to use some code again (for example: sucking details out of the database about a host), it get's broken out to a new function in the object.

So, there's some of my approaches. Of course, if I sat down and did some decent design before hand I'd only need to use the first one - wishful programming - as the functions would already be broken up logically.


Updated: Right, that link to Spong now works as it should. My bad. (Thanks a for pointing it out!)

In reply to Re: Re (tilly) 1: When do you function? by puck
in thread When do you function? by zdog

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

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    [shmem]: there are so many ways thinkable to fix that situation, some feasible and some not, that I'm unable to give good advice.
    [Spenser]: I installed 5.22 with opkg. I can use it with cpan. I'm actually trying to install perl-DBD-mysql, but couldn't with it. So I went back to the factory version, 5.10.
    [Spenser]: So, nevermind about CPAN. I give up on the downgraded angle. I'm back to fighting to install DBD.
    [shmem]: please open a SoPW. At what point is the perl-DBD-mysql installation failing?
    [shmem]: do you have the mysqlclient libs on that device, for instance?
    [shmem]: and btw, your original questian is an XY Problem classic ;-)

    How do I use this? | Other CB clients
    Other Users?
    Others studying the Monastery: (13)
    As of 2018-03-17 12:46 GMT
    Find Nodes?
      Voting Booth?
      When I think of a mole I think of:

      Results (224 votes). Check out past polls.