On Thursday 22 Apr 2010 12:38:39 HACKER Nora wrote: > Hi, > > I wonder if some of you are in the same situation like me: I am the only > Perl programmer in the company, at least trying hard to get along :-), > but I have nobody to ask for help. So I spend hours and hours with my > book and the internet when I'm stuck. Luckily, so far I almost always > accomplished what I wanted to do, but I don't know whether it is "good" > programming - the scripts work, but if I compare them to some code that > comes from the experienced guys here on the list they just look ... uhm, > different ... How do you improve your scripts and in general your coding > style without having someone to alert/advise you what could be improved? >
First of all, you may wish to read what chromatic wrote about "Baby Perl": http://www.modernperlbooks.com/mt/2009/03/turning-baby-perl-into-grownup- perl.html (Short link (and non-broken - bad Qt!) - http://xrl.us/bgfks2 ). Otherwise, if something looks different to you in the code that the more experienced programmers produce, feel free to reply to the list asking for the motivation for doing it this way. I don't know what is your workplaces's policy about sharing your scripts with other people (using private E-mail) or posting them on public forums, but you may wish to investigate and pursue this direction. I'm sure some people here (including me) will agree to review some of the code you've written for work and keep it as confidential as possible. Otherwise, there are some books that attempt to teach you good programming practices: * http://www.shlomifish.org/philosophy/books-recommends/#perl_best_practices * http://www.shlomifish.org/philosophy/books-recommends/#pragmatic_programmer * http://perl.org.il/books/0201485672.html There are also many blogs and other sites about good software engineering and software management (see this essay of mine for a partial list: http://www.shlomifish.org/philosophy/computers/software-management/perfect- workplace/ - http://xrl.us/be92te ). As I imply here - http://community.livejournal.com/shlomif_tech/33461.html - code that is functional but sub-optimal as far as elegance or best practices are concerned is still probably better than not having it written in the first place. Another good way to learn how to code better is to read other people's open- source code. Naturally, this code may be very inelegant and even buggy, but you can often learn a lot from such bad code as well. One of my friends said he's an avid read of http://thedailywtf.com/ because he learns a lot from the extremely bad code that is featured there (even though it is obviously bad). That put aside, you naturally should read some good code. I also recall this old Hackers-IL thread: http://tech.groups.yahoo.com/group/hackers-il/message/2405 Quoting from http://tech.groups.yahoo.com/group/hackers-il/message/2407 : [quote] The one consistency I found is that any piece of code *I* write, will look like junk to me in a month. Its natural, I learn a lot in a month... The only exception is a report generation system, which I wrote half a year ago. I've been maintaining this system for 6 month now, and I'm still suprised that I wrote something that grows so well. After 3 years of writing report generators, I've managed to strike that delicate balace between generality and simplicity. I found that I'm a very bad judge of other people's code. I can't tell anything at all at a quick glance. Time after time my first impressions are changed after a week of maintainance. What looks like a mess at first glance, turns out to be an elegant solution to a difficult problem. What looks elegant and impressive, turns out to be unmaintainable spagetti of objects and templates. [/quote] Hope it helped. Regards, Shlomi Fish > Regards, > Nora -- ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ Original Riddles - http://www.shlomifish.org/puzzles/ Deletionists delete Wikipedia articles that they consider lame. Chuck Norris deletes deletionists whom he considers lame. Please reply to list if it's a mailing list post - http://shlom.in/reply . -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/