|We don't bite newbies here... much|
Re: How has your coding style changed over the years?by haj (Priest)
|on Aug 07, 2022 at 16:16 UTC ( #11145997=note: print w/replies, xml )||Need Help??|
People are different, aren't they?
Whenever I read old code I've written I find that my coding style seems to change continuously. Somewhat like the movement of an amoeba: I learn something (which isn't necessarily a new feature, but something I had not known), I like it and include it into my coding habits. Other habits die out, mostly because I don't need them for some time.
At one point in time I broke with several habits at once, that was after working through Perl Best Practices. I am using this book's layout conventions until today, and configured my editor to help me doing so. I am not (and never was) religious about it: I can not claim a single *NEVER* nor *ALWAYS* rule for anything I've written.
I guess this has to do with my personal history. I started working for mainframes, making small changes to huge amounts of code written by someone else. Being the beginner in the team, it seemed a good idea to keep the overall style. With Perl, my first job was to fix a broken CGI, again code written by someone else, I decided to keep its style. When I took part in the CPAN Pull Request Challenge, I found very different styles, and I found that all of them work.
I used to start my OO methods with my $self = shift; because I saw others do this. I can not claim I'm doing it *ALWAYS*: I have adopted the habit to use subroutine signatures, and recently I use Object::Pad which predeclares $self. Over the years I have used plain bless-style OO, Moose (which I consider a game changer), and MooseX::Declare (until it became frowned at because of too much magic). Panta rhei.
Habits I haven't changed in the last decades: I use Emacs, and I like the Perl debugger. Occasionally I work to improve these tools.
In Section Meditations