Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

comment on

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

G'day stevieb,

That's an extraordinarily similar list to what I might have written. :-)

My coding style generally falls into two camps: what I write for myself, and what I write for $work. Over the years (close to 30 now for Perl) my style has changed: not in leaps and bounds, but just a slow progression of what I hope is general, incremental improvements.

Given the similarity, I'll just go through your list and indicate what I do differently. Basically, if it's not mentioned, I do the same as you.

  • I don't add that extra white space when deferencing. Something of a moot point for personally coding: I'm more likely to write "keys $href->{thing}->%*" (not a lot of oppotunity for whitespace there).
  • I disagree that '->' is needed in '$hash{one}->{two}'. Of course, I can't see the underlying code but '$hash{one}{two}' would surely suffice.
  • I do have some standard tests which I get through module-starter (some are just ones I added to the template directory and install manually from there). I'm not a huge fan of TDD. I do write tests during development; usually after I've added a handful of related methods, but never before.
  • I don't use IDEs. I use vim for pretty much everything: possibly giving away my age when I think back to when vim was vi and my "monitor" was a roll of paper on the back of a teletypewriter console.
  • I don't use the debugger either. I prefer Data::Dump over Data::Dumper in most cases.
  • I don't use PPI; although, I am aware of it.
  • GitLab CI/CD for $work only.
  • Reading params with shift was something I did a lot, but not anymore. Too many instances of needing a extra param and changing "my $x = shift;" to "my ($x, $y) = shift;" — and that can be a surprisingly difficult bug to track down. Anyway, I've used "@_" pretty much exclusively since the early 2000s.
  • I would have written hundreds of modules using "pure perl OOP"; mostly for $work but also for personal code. I was very pleased when modules started to appear to shoulder some of the work. I used quite a few but mainly use Moose, and occasionally Moo, these days. I'm keeping my eye on Cor.

++ for a good post. It'll be interesting to see what others come up with.

— Ken


In reply to Re: How has your coding style changed over the years? by kcott
in thread How has your coding style changed over the years? by stevieb

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 avoiding work at the Monastery: (2)
As of 2024-04-25 20:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found