Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: How has your coding style changed over the years?

by kcott (Archbishop)
on Aug 07, 2022 at 05:54 UTC ( [id://11145990]=note: print w/replies, xml ) Need Help??


in reply to How has your coding style changed over the years?

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11145990]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (5)
As of 2024-04-24 07:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found