<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/rss2full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">
<channel>
<title>Revolution Systems Blog</title>
<link>http://blog.revsys.com/</link>
<description />
<language>en-US</language>
<lastBuildDate />
<generator>http://www.typepad.com/</generator>
<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/revsys/JkwX" type="application/rss+xml" /><item>
<title>Making the software written in any language more readable</title>
<link>http://feeds.feedburner.com/~r/revsys/JkwX/~3/218448884/making-the-soft.html</link>
<guid isPermaLink="false">http://blog.revsys.com/2008/01/making-the-soft.html</guid>
<description>There are two very simple ways to improve the readability and maintenance of the software you write. They are so simple they are often ignored in favor of more complicated tools and the various programming methodologies people blather on about....</description>
<content:encoded><![CDATA[<p>There are two <em><strong>very</strong></em> simple ways to improve the readability and maintenance of the software you write. They are so simple they are often ignored in favor of more complicated tools and the various programming methodologies people blather on about.&nbsp; This comes from our human nature to think our <em>own</em> problems are more special and complicated than they really are and from not following the <a href="http://en.wikipedia.org/wiki/KISS_principle">KISS principle</a>.</p>

<p><strong>So how do you improve your software? </strong></p>

<p>By using better names and being consistent. It really is that simple, which is probably why it is overlooked.&nbsp; A development manager might score some points with his boss by switching to Agile programming, having some scrums, doubling the amount of developer documentation or maybe even switching to a whole new platform like Ruby on Rails.&nbsp; But who scores any points by saying, &quot;We're going to do better about naming things appropriately?&quot;</p>

<p><strong>Appropriate Naming</strong></p>

<p>Obviously having a variable named <em>temp_user</em> isn't all that descriptive, but it is an improvement over just <em>temp </em>or simply <em>t. </em>Most, if not all, programmers realize this.&nbsp; However, you will often see variables named <em>clt </em>when they should really be named <em>client, </em>as if those three extra characters were single handedly going to cause carpal tunnel.&nbsp; Your variable names should be as descriptive as possible without being absurd about it.&nbsp; A variable named <em>the_current_user_object_we_are_working_with</em> is obviously overkill. But perhaps <em>current_user_object</em> or even <em>current_user</em> is appropriate. </p>

<p>Naming your functions and methods should also be given the same amount of care. Naming a function <em>fix_client</em> doesn't tell us anything useful, we can only speculate something is wrong with the client or the data and this function does something about it.&nbsp; <em>normalize_client_name</em> is a much better name when you read that all the function does is properly set the case of the letters in the client's name. </p>

<p>The names you choose for your libraries are also very important.&nbsp; This is one of the reasons programmers find Perl's <a href="http://www.cpan.org">CPAN</a> much more useful than other programming languages' library collections. Things are named and categorized (for the most part) sanely.&nbsp; Need something related to E-mail, check the libraries in the <em>Mail</em> category.&nbsp; Can you guess what <em>Net::SSH</em>, <em>IO::File::CompressOnClose</em>, and <em>WWW::Google::News</em> do? Yeah I thought you could.</p>

<p>If I stumble upon your use of a library called <em>Util</em>, it doesn't tell me anything I still have to go look at the library to see how it fits in with this code.&nbsp; If it had been named something like&nbsp; <em>DB::Util </em>or <em>Client::Utils </em>I would at least know the library is probably related to the database or client. </p>

<p><strong>Consistency</strong></p>

<p>Consistency is another area where you can improve your code base without much effort.&nbsp; If all of your classes contain an initialization method, they should all be named the same.&nbsp; Not <em>initialize</em> in some classes and <em>init</em> in others.&nbsp; Things that should be consistent throughout your code base, not only consistent within a single application. If possible, the source in your department should be consistent with other departments and business units. </p>

<p>Consistency through conventions is one of the main reasons people like web frameworks like Ruby on Rails. I'm not advocating Ruby on Rails necessarily, you can accomplish these same things in any language.</p>

<p>Things that should be consistent: </p>

<ul><li>variable, function, and method naming conventions ( underscores or CamelCase, but not both )</li>

<li>frequency and layout of comments </li>

<li>documentation</li>

<li>configuration file syntax </li>

<li>on disk layout of source code, binaries, configuration files, etc. </li>

<li>installation, upgrades and package management </li>

<li>language(s) used for development</li></ul>

<p>The point being the <em><strong>more</strong></em> consistent you are in <em><strong>how</strong></em> you build an application the easier it is to get down to the task at hand.&nbsp; Be it new development or bug fixing.&nbsp; Got a configuration file format you like and have already written libraries to parse it? Then use it <strong>EVERYWHERE</strong>, in every single darn application you build. No one has to learn the new format to start developing, no time is spent discussing which format is better, and another developer in your organization can jump in to fix bugs or add a new feature. </p>

<p>The last development shop I ran we focused on being consistent. 95% of the time we were building web applications that were either used internally by fellow employees or externally by our customers.&nbsp; If you saw the source to one of our applications, then all of our other applications would seem very familiar. One might be a ticket tracking system and the other an accounting package, but the layout, coding style, and use of common libraries let the developers dive right in and not have to worry so much about how this particular app is written differently than the others.</p>

<p>Consistency in your applications also makes refactoring easier.&nbsp; If all of your applications use a particular technique, library, etc. in the same way replacing it with a new tool you have fallen in love with is much easier.&nbsp; If everyone is doing everything even slightly differently, you have to start worrying more and more how the change might impact your code. </p>

<p>I'm definitely a &quot;right tool for the right job&quot; sort of fellow, but mixing and matching tools and techniques for every single application you build is a recipe for disaster. One shop I know (name withheld to protect the guilty) has two developers.&nbsp; One who works entirely in Perl, the other entirely in Ruby.&nbsp; Another application I saw was written mostly in Java, but with a smattering of C# and Python around the edges for kicks. None of these three were chosen from a &quot;right tool for the job&quot; perspective, but simply because those were the favorite languages of the specific developers tasked with those sub-systems. These are obviously worst case examples. </p>

<p>These ideas aren't new, I'm positive I am not the first to use them or even write about them.&nbsp; But I see these two simple rules violated so often by programmers of all experience levels that I felt the need to reiterate them. </p><br />


<img src="http://feeds.feedburner.com/~r/revsys/JkwX/~4/218448884" height="1" width="1"/>]]></content:encoded>


<category>Managing Programmers</category>
<category>perl</category>
<category>programming</category>

<dc:creator>Frank Wiles</dc:creator>
<pubDate>Thu, 17 Jan 2008 14:47:50 -0600</pubDate>

<feedburner:origLink>http://blog.revsys.com/2008/01/making-the-soft.html</feedburner:origLink></item>
<item>
<title>Under-used CPAN Modules</title>
<link>http://feeds.feedburner.com/~r/revsys/JkwX/~3/155572696/under-used-cpan.html</link>
<guid isPermaLink="false">http://blog.revsys.com/2007/09/under-used-cpan.html</guid>
<description>Perl often suffers from its history. While it is great that there are so many online tutorials and code samples out there for new Perl developers to learn from, they sometimes miss out on all of the useful new code...</description>
<content:encoded><![CDATA[<p>Perl often suffers from its history.&nbsp; While it is great that there are so many online tutorials and code samples out there for new Perl developers to learn from, they sometimes miss out on all of the useful new code that has been created since the article was written.&nbsp; Here are a few CPAN modules that are, in my opinion, under-used by new developers.</p>

<p>These modules are great for several reasons.&nbsp; The most compelling ones are there is lesss code for you to write/debug than not using these modules, the resuling code is often clearer to your fellow developers, and in many cases the module will out perform your hand hacked code. <br /> </p>

<p><strong>List manipulations</strong></p>

<p>There are two list related modules you should familiarize yourself with.&nbsp; They are <a href="http://search.cpan.org/~gbarr/Scalar-List-Utils-1.19/lib/List/Util.pm">List::Util</a> and it's cousin <a href="http://search.cpan.org/~vparseval/List-MoreUtils-0.22/lib/List/MoreUtils.pm">List::MoreUtils</a>. </p>

<p>Need to shuffle the values in an array? Don't reinvent the wheel, use List::Util's shuffle function.</p>
<pre>use strict; <br />use warnings; <br /><br />use List::Util qw( shuffle ); <br /><br />my @array = qw( 1 2 3 4 5 6 7 8 9 ); <br />my @shuffled = shuffle( @array ); </pre> 

<p>Need to make a list only contain unique values? You can use the method found in the <a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&amp;location=http%3A%2F%2Fwww.amazon.com%2FPerl-Cookbook-Second-Tom-Christiansen%2Fdp%2F0596003137%3Fie%3DUTF8%26s%3Dbooks%26qid%3D1189525849%26sr%3D8-1&amp;tag=revosystblog-20&amp;linkCode=ur2&amp;camp=1789&amp;creative=9325">Perl Cookbook</a><img width="1" height="1" border="0" src="http://www.assoc-amazon.com/e/ir?t=revosystblog-20&amp;l=ur2&amp;o=1" style="border: medium none  ! important; margin: 0px ! important;" />, or you can use the simpler <em>uniq()</em> function from List::MoreUtils like so:</p>

<pre>use strict; <br />use warnings; <br /><br />use List::MoreUtils qw( uniq ); <br /><br />my @array = qw( 1 1 2 2 3 3 4 4 5 5 ); <br />my @unique_values = uniq( @array ); </pre> 
<p>
Not to mention List::MoreUtils' implementation is done in C, so it is much faster than a Pure Perl implementation.&nbsp; I once saw this improve the performance of a large web application by 5% because the developers were uniquing several lists for each page view.</p>

<p>Be sure to also check out the other functions in these two modules such as any(), all(), first(), max(), etc. While you will have to install List::MoreUtils from CPAN, List::Util is part of Perl core. <br /> </p>

<p><strong>Merging Hashes</strong>
</p>

<p>While you can use the simple: <br /> 
</p> 

<pre>my %merged_hash = ( %hash_one, %hash_two ); </pre>

<p> 

Someitmes you need a bit more power, enter <a href="http://search.cpan.org/~dmuey/Hash-Merge-0.10/Merge.pm">Hash::Merge</a>.&nbsp; It gives you several options on how to handle conflicting keys, based on a left/right order, or by storage method. Or you can even control whether or not your data is cloned on not.&nbsp; I find this very useful for merging in command line arguments against a configuration file.</p>

<p><strong>Speaking of configuration options and files....</strong></p>

<p>Repeat after me.&nbsp; <em>I will not write my own configuration parsing code.&nbsp; I will not invent my own configuration file format. I will not parse my own command line options without a damn good reason.<br /></em></p>

<p>Why waste your time on the most boring part of your code? Use one of the already existing modules and configuration file formats.&nbsp; This saves you time, debugging headaches, and makes the configuration file syntax familiar to your users.&nbsp; </p>

<p>I strongly suggest looking into <a href="http://search.cpan.org/~jv/Getopt-Long-2.36/lib/Getopt/Long.pm">Getopt::Long</a> for handling command line arguments. It might take you a bit of time to get used to this module, but once you're over the initial learning curve you'll wonder why you ever bothered doing this by hand in the first place. </p>

<p>If you like Apache style configuration files (who doesn't?), start using <a href="http://search.cpan.org/~tlinden/Config-General-2.33/General.pm">Config::General</a> and cut your configuration processing code into a use statement and a couple of lines of code. Or if you happen to prefer .INI style configuration files take a look at <a href="http://search.cpan.org/~adamk/Config-Tiny-2.10/lib/Config/Tiny.pm">Config::Tiny</a>. <br /> </p> 

<img src="http://feeds.feedburner.com/~r/revsys/JkwX/~4/155572696" height="1" width="1"/>]]></content:encoded>


<category>perl</category>

<dc:creator>Frank Wiles</dc:creator>
<pubDate>Tue, 11 Sep 2007 11:20:40 -0500</pubDate>

<feedburner:origLink>http://blog.revsys.com/2007/09/under-used-cpan.html</feedburner:origLink></item>
<item>
<title>I'm in the top 10.... </title>
<link>http://feeds.feedburner.com/~r/revsys/JkwX/~3/155572697/im-in-the-top-1.html</link>
<guid isPermaLink="false">http://blog.revsys.com/2007/08/im-in-the-top-1.html</guid>
<description>Based on this this article at PerlBuzz.com , my humble little blog is in the Top 10 of all Perl related blogs. While the author admits to having used a very simple/naive ranking system, it is still an honor to...</description>
<content:encoded><![CDATA[<p>Based on this <a href="http://perlbuzz.com/2007/08/top-10-perl-blogs.html">this article at PerlBuzz.com</a> , my humble little blog is in the Top 10 of all Perl related blogs.&nbsp; While the author admits to having used a very simple/naive ranking system, it is still an honor to be listed. </p>

<p>For anyone who wants to subscribe to only my Perl related posts you'll want to use <a href="http://feeds.feedburner.com/revsys/JkwX">this RSS link</a>. You can use the RSS feed link on the right to receive all of my posts.&nbsp; </p>

<p>I guess I better start writing more about Perl!<br /></p><img src="http://feeds.feedburner.com/~r/revsys/JkwX/~4/155572697" height="1" width="1"/>]]></content:encoded>


<category>perl</category>

<dc:creator>Frank Wiles</dc:creator>
<pubDate>Sun, 26 Aug 2007 16:03:20 -0500</pubDate>

<feedburner:origLink>http://blog.revsys.com/2007/08/im-in-the-top-1.html</feedburner:origLink></item>
<item>
<title>Followup to "A Guide to Hiring Programmers"</title>
<link>http://feeds.feedburner.com/~r/revsys/JkwX/~3/155572698/followup-to-a-g.html</link>
<guid isPermaLink="false">http://blog.revsys.com/2007/08/followup-to-a-g.html</guid>
<description>Please excuse my laziness, but I simply don't have time to respond to each and every person who has E-mailed or left comments on digg, reddit, or the original post itself. I would like to respond to a few of...</description>
<content:encoded><![CDATA[<p>
Please excuse my laziness, but I simply don't have time to respond to
each and every person who has E-mailed or left comments on digg, reddit,
or the <a href="http://blog.revsys.com/2007/08/a-guide-to-hiri.html">original post itself</a>.&nbsp; I would like to respond to a few of the larger themes
I've seen in the questions/responses:
</p>

<h4><strong>This applies to more than just programming</strong></h4>

<p>
I definitely agree that this can be applied to nearly any type of job,
not just programming.&nbsp; A great designer is worth much more than an
average one.&nbsp; And I honestly wasn't trying to single out sales and customer
service people.&nbsp; I do agree that a great sales person or customer service
rep is worth more than the average, and should be paid accordingly. And yes
every employee is important to the company.
</p>

<p>
Using customer service as an example, I've worked with the worst where
they would literally scream at the customer on the phone to the best. The
problem with customer service is that the metrics are against them in that
even the best customer service person can only take a few more calls/tickets
than the worst.&nbsp; Just because of the nature of the interactions. It is also
very difficult to measure if this person has pleased/retained more customers
than another. With programming it is often easier to see how an individuals
contributions impact the whole project.
</p>

<p>
Sales is a different monster, but hopefully this has cleared up what I was
trying to express.
</p>
<div style="margin: 7px; display: block; float: left;">
<script type="text/javascript"><!--
google_ad_client = "pub-8077225256910634";
google_ad_width = 300;
google_ad_height = 250;
google_ad_format = "300x250_as";
google_ad_type = "text_image";
//2007-08-05: Blog Post
google_ad_channel = "7516845473";
google_ui_features = "rc:6";
//-->
</script>
<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript">&nbsp;</script>
</div>
<h4><strong>Only experts?</strong></h4>

<p>
Do I think it's reasonable to hire only experts?&nbsp; Yes, in many situations
a company can and should staff themselves with the vast majority being experts.
Is it possible for larger companies with larger products? Probably not.&nbsp; If
the problem simply demands 50 developers, it would be difficult to staff
that entirely with experts. However, I do believe they would see a boost if
they were able to have at least 10-15 of those developers be experts. Instead
most companies have 1-3 experts that lead the team of the masses.
</p>
<p>
If you can't find experts, you should attempt to hire staff that could become
experts over time as they gain experience.
</p>

<h4><strong>How do you become an expert?</strong></h4>

<p>
Everyone is correct in saying that experts started out as novices, I
was certainly a novice.&nbsp; In many ways I still am.&nbsp; Being personally interested
in martial arts I remember a story of someone, after years of training,
finally receiving their black belt in Aikido and being told, <em>&quot;Now you are
ready to learn.&quot;</em>&nbsp; I believe this is true of programming, technology, and
most professions.&nbsp; The learning doesn't and shouldn't stop.
</p>

<p>
So how can you become an expert? I think the best advice I can give is to
read up as much as possible on your field.&nbsp; You don't become an expert
simply repeating what you did yesterday for many years until, poof, you're
an expert. You need to be learning new idioms, patterns, and tips from
your peers.
</p>
<p>
Too many developers sit in their cubes and pound out code and never look
up. You need to be reading up on your profession as much as possible, exploring
new languages/tools to determine if you could be doing something easier or
better.
</p>
<p>
An example of what I see far too often happened again recently at OSCON.
A professional Python developer did not know <a href="http://www.djangoproject.com">Django</a> was the predominant
web framework for that language. I'm not a Python user, but even I know
this. Maybe it's because I'm friends with the core Django team, but even
if that had not been the case I would at least be aware of it and in
general what it was from my day to day&nbsp; tech reading.
</p>
<p>
The other advice I would give is to read and become involved in an Open
Source project.&nbsp; This improves your code quality and allows you to see
how other, presumably senior, developers work. Even if you aren't able
to contribute to the project directly, get on the mailing lists and
examine how those developers work.
</p>
<h4><strong>How do you find and hire experts?</strong></h4>

<p>
I think the biggest mistake managers make is leaving this up to HR.&nbsp; I've
always made sure I received every resume that came in for a position I
was hiring for.&nbsp; HR will often reject a candidate because their resume
states they have &quot;Years of J2EE experience&quot;, but since it's a Java programming
position it goes in the trash.&nbsp; Perhaps it is time we start hiring &quot;HR
Engineers&quot; like we have &quot;Sales Engineers.&quot;
</p>
<p>
The first place I look when hiring programmers is the Open Source community.
If they are involved in an Open Source project you can easily see how they
work with others on the mailing lists, see examples of their code, etc.
</p>
<p>
They also tend to be of higher quality because Open Source is a meritocracy.
Not to mention the simple act of being involved in a project, for no monetary
gain, shows a strong love of their craft.
</p>
<p>
I think multiple choice tests are a very poor indicator of programming
prowess. Too often they have a couple of esoteric or even trick questions
that really compare the test writers ability to confuse with the test takers'
ability to decipher.&nbsp; It is much more important for your new hire to know
how to find the answer than it is for him to actually have it tucked away
in a brain cell. Ability to effectively use Google to search for the answer
is much more important than many realize.
</p>
<p>
If you happen to be one of the people who are looking for an expert Perl
programmer I suggest you get in touch with my new friend <a href="http://www.sysarch.com">Uri Guttman</a>, The
Perl Hunter, at <a href="mailto:uri@perloncall.com">uri@perloncall.com</a>.&nbsp; He specializes in finding execellent
Perl programmers for companies. Being an accomplished developer himself he
easily separates the wheat from the chaff and can find someone who will be
a good overall fit for your organization.
</p>
<h4><strong>Many problems are marketing and management's
fault...</strong></h4>

<p>
This is also very true. Bad management will bring down any team or project, no
matter how many experts they have on staff. This isn't even restricted to
technology management.
</p>
<p>
Marketing often over promises what can be delivered and demands it in an
unreasonable time frame.&nbsp; Unfortunately most of the time we blame the
developers, because long after the sale all that we see is the code and not
the brochure.
</p>
<p>
My advice to marketing and management is that you bring a problem to your
developers and then base your plans on when they believe they can deliver
the solution.&nbsp; Far too often management has already determined time lines and
set things in motion before the development team has even been told about
the project.&nbsp; This is backwards.&nbsp; You don't schedule your building contractors
before you have the proper permits or before even speaking with the architect
about the project.
</p>
<p>
Even Microsoft gets this right. They realized it was much better to delay Vista
until it is ready than to ship it too early just because they originally said
a certain date.
</p>
<p>
Obviously you can't always just wait around for something to be perfect.
There are always restrictions and requirements that are outside of your
control.&nbsp; No one could move January 1st, 2000 out a few more weeks just
because their Y2K cleanup wasn't done. But often I see companies attempt to
move mountains to hit some arbitrary date when one of the largest consequences
of delaying would be everyone had to update their Outlook calendars.
</p>
<h4><strong>My language bias</strong></h4>

<p>
I received a bunch of comments on my use of &quot;Perl vs Java&quot; in the
example, that simply was what we were talking about at dinner that night.
I probably should have used &quot;agile language X vs cumbersome language Y&quot; to
keep the flames down to a minimum.
</p>
<p>
You <em><strong>can</strong></em> write efficient, readable, and maintainable Perl.&nbsp; I've even had some
notable Python programmers say that about code I was in charge of and honestly
the code in question wasn't what I would consider the best of the best. I
think Python is a great language, but for me personally I haven't been shown
any compelling reason to switch.
</p>
<p>
You can write crappy unreadable code in any language. You can make most any language/framework/toolset scale and perform to your needs.&nbsp; For every
&quot;large app/website/etc&quot; that uses language X I'm sure I can find you a
comparable app/website using language Y.&nbsp; Any performance differences between
language X and Y can usually be solved with $100 worth of extra CPU.&nbsp; What
really matters is programmer efficiency.&nbsp; That is where you save money and
reap benefits. I simply don't see how having to write, read, troubleshoot,
and maintain 10x the number of lines of code is an efficient use of the
programmer's time.
</p>
<p>
However, I do agree that you should use the right tool for the right job.
Java/C++/C# are definitely the right tools in many situations.&nbsp; I just feel
that because everyone has seen a horribly written Perl CGI ( or written one
themselves ) they think this is somehow ingrained in the language and because
of this Perl simply isn't an option for anything &quot;real.&quot;
</p>
<p>
Perl is a language where the developer must use some self-control rather than
having it imposed on him by his tool. Which is why Perl (or many of the more
agile languages such as PHP/Python/etc) written by novice programmers is so
awful. The knowledge and self-control comes with experience.
</p>
<p>
The largest problem with any language is the use of poor variable, function,
class, and method names.&nbsp; Using adequately long and descriptive names is
probably the single best way to improve code quality and no language out there
enforces this. Some enforce a certain style, others force certain
methodologies, but this is really only picking at less important aspects of the problem.
</p>
<h4><strong>Company bias</strong></h4>

<p>
By comparing Apple vs Microsoft I wasn't really singling out their
development staffs.&nbsp; I'm sure their management, design, and marketing
departments are as much to blame for any successes or failures these
companies have.
</p>
<p>
What I was trying to get across was the &quot;It simply works.&quot;&nbsp; I would say
the second most common comment I hear from Mac users, after how pretty/well
designed they are, is that it &quot;just works.&quot;&nbsp; I don't hear that very often
from Microsoft users.
</p>
<img src="http://feeds.feedburner.com/~r/revsys/JkwX/~4/155572698" height="1" width="1"/>]]></content:encoded>


<category>business</category>
<category>perl</category>
<category>programming</category>

<dc:creator>Frank Wiles</dc:creator>
<pubDate>Wed, 08 Aug 2007 14:11:30 -0500</pubDate>

<feedburner:origLink>http://blog.revsys.com/2007/08/followup-to-a-g.html</feedburner:origLink></item>
<item>
<title>A Guide to Hiring Programmers: The High Cost of Low Quality</title>
<link>http://feeds.feedburner.com/~r/revsys/JkwX/~3/155572699/a-guide-to-hiri.html</link>
<guid isPermaLink="false">http://blog.revsys.com/2007/08/a-guide-to-hiri.html</guid>
<description>I was invited to a wonderful dinner party (I swear it wasn't too spicy Sarah!) with some St. Louis Perl peoples this week while I'm here on business. At one point we were talking about hiring programmers, specifically Perl programmers....</description>
<content:encoded><![CDATA[<p>
I was invited to a wonderful dinner party (<em>I swear it wasn't too spicy Sarah!</em>)
with some St. Louis Perl peoples this week while I'm here on business.&nbsp; At one
point we were talking about hiring programmers, specifically Perl programmers.
</p>

<p>We agreed on the following:</p>
<ul>
 <li>Finding good programmers is hard in any language.&nbsp; And that a good
 programmer can be as effective as 5-10 average programmers.</li>
<li>Average pay rates between equivalent programmers are out of sync and
are based more on the language used than the skill of the programmer.</li>
<li> You don't need to hire an expert in language X, you can and should look for
 expert programmers that are willing to learn language X. An expert can
easily cross over from being a novice in any language in a matter of a
 few weeks.</li>
<li>You should seriously consider allowing your expert developers to
 telecommute full-time. Restricting your search to programmers who live
 in your area or are willing to move limits the talent you can acquire. Arguments regarding &quot;face time&quot;, productivity, etc. can easily
 be nullified when you look at how some of the largest and most successful
 Open Source projects such as Linux, Apache, and Firefox are developed
 by individuals rarely living in the same time zone or even country.</li>
<li> We love Perl and think it's a great language that you graduate to after
 you have been forced to use less agile languages such as Java, C/C++/C#,
 etc. Not necessarily a first language you get your feet wet with and
 then move onto a *cough* &quot;real&quot; language.</li>
</ul>

<p>
Many people in the Perl community have been writing on this topic
lately and wanted to share my opinions on the subject, as it is one I have put many hours of thought into. Doing my best to keep this language
agnostic as I believe these tips can be applied to any programming language.
I will however, use Perl in some examples as it is my preferred language.
</p>

<h4><strong>Why is it so hard to find good programmers?</strong></h4>

<p>
The simplest reason is when a company finds a good developer they do more to
make sure that person is happy which leads to longer tenures. Better salary,
more flexible working conditions, good tools, interesting projects, and
better perks can often keep a programmer working for you longer.
</p>
<p>
Another obvious reason is that experts in any field are small in number, so your possible talent pool is limited. This leads managers and HR departments to
settle for average or even below average developers.&nbsp; I believe this is the
single biggest mistake a technology oriented company can make, regarding
developers, just short of not using a good <a href="http://subversion.tigris.org">version control system</a>.
</p>
<p>
We're not talking about customer service representatives or sales people here.
Just having a body to fill the seat is not, I repeat not, always a win for
the company. Sub-standard programmers drag down the efficiency of your other
developers with beginner questions, poor comments/documentation, and bad
code that someone else will later be forced to spend time fixing.
</p>
<p>
Companies need to stop thinking about their developers as cogs in the machine.
They are more akin to artists, authors, designers, architects, scientists,
or CEOs.&nbsp; Would your HR department rush to find the first person who would
be willing to take on the role of Chief Scientist, Art Director, or CEO in
your company? Of course not, they would spend the time to do a thorough talent
search for just the right candidate, court them, and then compensate them
appropriately. They realize that having the wrong person in that seat is much
worse than having the seat empty. It is absolutely the same with programming.
</p>
<p>
Anyone who has been a developer or managed developers can tell you that an
expert can accomplish as much as 10 average developers.&nbsp; However, companies
typically pay only a 10-20% premium for an expert over the average programmer.
Whether or not their title is Lead, Architect, Development Manager, Guru or
whatever nomenclature the company uses. I am not saying that if your average
developer is paid $50k/year that you should pony up $500k/year for an expert.
The employer/employee relationship never works like that, but what employers
don't seem to realize is that in the end paying more saves them more.
</p>
<p>
Let's look at an example.&nbsp; One common argument from HR departments is that
they &quot;can't find any Perl programmers, but they can't swing a cat without
hitting a Java developer&quot;.&nbsp; While this is fairly accurate, they are approaching
the problem from the wrong direction.&nbsp; If you fill your shop with 15 average
Java developers, paying an average of $60k per developer you have an
approximate labor cost of $900k/year for your development staff.&nbsp; Not
considering any non-salary benefits.
</p>
<p>
Suppose you instead took the time to find 5 experts, or at least above
average, Perl developers at $120k each per year. Here is a partial list of
the pros and cons of such a scenario:
</p>

<p>
<strong>Cons:</strong>
</p>
<ul>
<li>You must spend extra time finding, evaluating, and courting these
more sought after developers.</li>

 <li>Your company and what the developer may be asked to build may
simply not be attractive to this class of developer.&nbsp; Very few
people want to work for a spammer or a small web design firm
that caters solely to freelance accountants for example. Smart people
find boring things even more boring than the masses.</li>

<li>When one of them leaves the company, there is the feeling that
your company's business objectives are more at risk due to having
only 4/5ths of your normal resources. Or that a larger chunk of your
corporate knowledge just walked out the door. This is more of a perceived
problem than an actual one as good developers are better at writing
readable/maintainable code, commenting their work, and writing
effective documentation.</li>
</ul>

<p><strong>Pros:</strong></p>
<ul>
<li>Each developer will be more content with their job, due in part to
the higher than average salary, but also because his or her co-workers
are of a much higher quality which improves anyone's job satisfaction.</li>

 <li>Development would require less overall communication as there
are less people to communicate with.&nbsp; This obviously improves
efficiency as anyone who has been on a 20+ person conference
call can attest to. Or read the <a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&amp;location=http%3A%2F%2Fwww.amazon.com%2FMythical-Man-Month-Software-Engineering-Anniversary%2Fdp%2F0201835959%3Fie%3DUTF8%26s%3Dbooks%26qid%3D1186355118%26sr%3D8-1&amp;tag=revosystblog-20&amp;linkCode=ur2&amp;camp=1789&amp;creative=9325">Mythical Man Month</a><img width="1" height="1" border="0" src="http://www.assoc-amazon.com/e/ir?t=revosystblog-20&amp;l=ur2&amp;o=1" style="border: medium none  ! important; margin: 0px ! important;" /> if you want
a more in-depth analysis of this phenomenon.</li>

 <li>Experts travel in the same social circles.&nbsp; Having one expert
on staff makes it much easier to find other experts in the
same field, no matter what field that may be.</li>

 <li>You would save 2/3rds on infrastructure costs.&nbsp; Things like
cubicles, computers, cell phones, free lunches, training costs,
travel, office space, air conditioning, electricity, etc, etc.
The list is essentially endless.</li>

 <li>Your HR department would have 1/3rd the number of developers
that it would need to take care of. Less paper work, less
questions, less everything, and less turn over because of
the lower number of employees.</li>

 <li>Oh and you'd save $300k/year on your labor costs.&nbsp; Not to
mention non-salary benefits such as stock options, retirement
matches, health insurance premiums, perks, etc. You could spend
as much as $100k/year on your talent searches and still be $200k/year
ahead.&nbsp; Hell, you could dedicate an entire HR person just to this task.</li>
</ul>

<div style="margin: 7px; display: block; float: left;">
<script type="text/javascript"><!--
google_ad_client = "pub-8077225256910634";
google_ad_width = 300;
google_ad_height = 250;
google_ad_format = "300x250_as";
google_ad_type = "text_image";
//2007-08-05: Blog Post
google_ad_channel = "7516845473";
google_ui_features = "rc:6";
//-->
</script>
<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript">&nbsp;</script>
</div>

<h4><strong>What is an expert programmer?</strong></h4>

<p>
Experience is key, but not necessarily in ways you might imagine.&nbsp; Time in
the saddle, with a particular language is not as important as diversity of
experience.&nbsp; Someone who has worked in several disparate industries, a
generalist, is often a much better developer than one who has spent years
in the same industry.&nbsp; There are exceptions to this, but in general I have
found this to be the case.&nbsp; Bonus points if your developer was a systems
administrator in a former life.
</p>
<p>
Some of the best developers I know were originally trained as journalists, mathmaticians, linguists, and
other professions not normally associated with software development.
</p>
<p>
Experts use better tools and care deeply about their craft.&nbsp; They aren't
assembling bits on an assembly line, they are crafting a unique product
to solve a unique problem.&nbsp; Experts are lazy, they work smarter rather
than harder.&nbsp; Experts prefer the easiest solution that gets the job done.
Experts aren't interested in creating complex solutions simply to have
the complexity, that misguided egoism is the territory of more junior
developers. They often get it right the first try and almost always on the second one. <br />
</p>
<p>
Simply put, experts write readable code.&nbsp; They comment and document it
appropriately based on the complexity and criticality of that particular
piece of code.
</p>
<p>
All of this pays <em>huge dividends</em> when the next developer has to pick up
where they left off. Especially if the next person isn't an expert.
</p>

<h4><strong>More reasons you want an expert programmer</strong></h4> 

<p>
Is your business technology oriented?&nbsp; Perhaps the software you
create is even your main product. If nothing else I'm sure we can agree
that if the software your developers create is to some degree critical to
your business.
</p>

<p>
I've worked in many different environments, with people of every skill level,
and it's very easy to tell whether or not a company has expert developers.
Do you often find that the software is down? That it has as many bugs or even
just idiosyncrasies that make no sense to the user as it does features?&nbsp; Do the users find it
difficult to use?&nbsp; Is the problem at hand relatively simple compared to the
training or documentation necessary to begin using the software?
</p>
<p>
If you answered yes to any of those questions you more than likely have
average or below average developers. 
</p>
<p>
When you work in an environment with experts things simply work.&nbsp; They are
easier to use and require less initial training. The software is easier to
modify.&nbsp; Requested changes happen more frequently and easily.&nbsp; Things just
flow.&nbsp; It is the difference between Apple and Microsoft.&nbsp; It's the
difference between the <a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&amp;location=http%3A%2F%2Fwww.amazon.com%2FApple-Video-Player-Black-Generation%2Fdp%2FB000EPHR0C%3Fie%3DUTF8%26s%3Delectronics%26qid%3D1186355223%26sr%3D8-2&amp;tag=revosystblog-20&amp;linkCode=ur2&amp;camp=1789&amp;creative=9325">iPod</a><img width="1" height="1" border="0" src="http://www.assoc-amazon.com/e/ir?t=revosystblog-20&amp;l=ur2&amp;o=1" style="border: medium none  ! important; margin: 0px ! important;" /> and a <a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&amp;location=http%3A%2F%2Fwww.amazon.com%2FSony-CDPCX455-Disc-MegaStorage-Changer%2Fdp%2FB000069JWX%3Fie%3DUTF8%26s%3Delectronics%26qid%3D1186355301%26sr%3D1-2&amp;tag=revosystblog-20&amp;linkCode=ur2&amp;camp=1789&amp;creative=9325">400 disc CD changer</a><img width="1" height="1" border="0" src="http://www.assoc-amazon.com/e/ir?t=revosystblog-20&amp;l=ur2&amp;o=1" style="border: medium none  ! important; margin: 0px ! important;" /> with 50+
buttons. 
</p>
<p>
As with many things in life, sometimes you get what you pay for. I'd love to hear your comments and opinions on the subject.</p>

<p><strong>UPDATE: </strong>I've written a response to some of the questions and comments I've received on this article in a follow up post <a href="http://blog.revsys.com/2007/08/followup-to-a-g.html">A follow up to &quot;A Guide for Hiring Programmers&quot;</a> <br />
</p>
<img src="http://feeds.feedburner.com/~r/revsys/JkwX/~4/155572699" height="1" width="1"/>]]></content:encoded>


<category>business</category>
<category>Featured Posts</category>
<category>perl</category>
<category>programming</category>

<dc:creator>Frank Wiles</dc:creator>
<pubDate>Sun, 05 Aug 2007 18:11:57 -0500</pubDate>

<feedburner:origLink>http://blog.revsys.com/2007/08/a-guide-to-hiri.html</feedburner:origLink></item>
<item>
<title>SCALE Talk Slides and Audio</title>
<link>http://feeds.feedburner.com/~r/revsys/JkwX/~3/155572700/scale-talk-slid.html</link>
<guid isPermaLink="false">http://blog.revsys.com/2007/07/scale-talk-slid.html</guid>
<description>I just noticed that the Southern California Linux Expo (SCALE) has my slides and a MP3 of the audio of the talk up on their site. The audio isn't actually too bad, especially considering I forgot I was being taped...</description>
<content:encoded><![CDATA[<p>I just noticed that the <a href="http://www.socallinuxexpo.org/scale5x/conference+info/speakers/Frank+Wiles/">Southern California Linux Expo</a> (SCALE) has my slides and a MP3 of the audio of the talk up on their site.&nbsp; The audio isn't actually too bad, especially considering I forgot I was being taped and moved away from the microphone during the Q&amp;A section.&nbsp; </p>

<p>You can also find <a href="http://www.revsys.com/talks/scale5x/mod_perl/">OpenOffice and PDF</a> versions of the slides on the Revolution Systems site. Enjoy!<br /></p><img src="http://feeds.feedburner.com/~r/revsys/JkwX/~4/155572700" height="1" width="1"/>]]></content:encoded>


<category>perl</category>

<dc:creator>Frank Wiles</dc:creator>
<pubDate>Mon, 09 Jul 2007 16:10:00 -0500</pubDate>

<feedburner:origLink>http://blog.revsys.com/2007/07/scale-talk-slid.html</feedburner:origLink></item>
<item>
<title>Gantry Article</title>
<link>http://feeds.feedburner.com/~r/revsys/JkwX/~3/155572701/gantry-article.html</link>
<guid isPermaLink="false">http://blog.revsys.com/2007/06/gantry-article.html</guid>
<description>Phil Crow, one of the Gantry core developers and the creator of Bigtop has a great article on how easy it is to build and modify Gantry applications using Bigtop. I highly recommend checking it out, it shows off some...</description>
<content:encoded><![CDATA[<p>Phil Crow, one of the <a href="http://www.usegantry.org">Gantry</a>&nbsp; core developers and the creator of <a href="http://www.usegantry.org/pod/bigtop">Bigtop</a> has a great <a href="http://www.onlamp.com/pub/a/onlamp/2007/06/14/a-holiday-gantry-web-application.html">article on how easy it is to build and modify Gantry applications using Bigtop</a>. </p>

<p>I highly recommend checking it out, it shows off some of Gantry and Bigtop's best features. </p><img src="http://feeds.feedburner.com/~r/revsys/JkwX/~4/155572701" height="1" width="1"/>]]></content:encoded>


<category>perl</category>

<dc:creator>Frank Wiles</dc:creator>
<pubDate>Fri, 22 Jun 2007 09:01:00 -0500</pubDate>

<feedburner:origLink>http://blog.revsys.com/2007/06/gantry-article.html</feedburner:origLink></item>
<item>
<title>Email, Templates, and Perl</title>
<link>http://feeds.feedburner.com/~r/revsys/JkwX/~3/155572702/email_templates.html</link>
<guid isPermaLink="false">http://blog.revsys.com/2007/05/email_templates.html</guid>
<description>I have been meaning to talk about one of my new favorite Perl modules, MIME::Lite::TT::HTML , for quite a while now. As I mentioned in a previous post, there are a bazillion different ways to send an Email message from...</description>
<content:encoded><![CDATA[<p>I have been meaning to talk about one of my new favorite Perl modules, <a href="http://search.cpan.org/~chunzi/MIME-Lite-TT-HTML-0.03/lib/MIME/Lite/TT/HTML.pm">MIME::Lite::TT::HTML</a> , for quite a while now.&nbsp; As I mentioned in a <a href="http://blog.revsys.com/2006/01/sending_email_f.html">previous post</a>, there are a bazillion different ways to send an Email message from Perl.&nbsp; This one is just my new favorite. </p>

<p>Here is a short list as to why: </p>

<ul><li>Can be used for complex multi-part messages and handles attachments easily </li>

<li>Built upon the equally great MIME::Lite module </li>

<li>Allows you to easily template your messages using the familiar Template Toolkit package</li></ul>

<p>The templating part is, in my opinion, the important part.&nbsp; How many times have you had to go edit some source code just to change the text or subject of a message?&nbsp; Isn't that just terribly annoying. We use configuration files, MVC with HTML templates, etc, etc. to <strong>not</strong> hard code things into our apps, but for some reason many people ( myself included for years ) have neglected Email.</p>

<p>Not any longer, I've switched to using this module as my standard way of sending Email these days.&nbsp; If you are interested in learning more about MIME::Lite::TT::HTML, check out my short howto <a href="http://www.revsys.com/writings/perl/sending-email-with-perl.html">Sending Email with Perl Best Practice</a> on the subject. </p>

<img src="http://feeds.feedburner.com/~r/revsys/JkwX/~4/155572702" height="1" width="1"/>]]></content:encoded>


<category>E-mail</category>
<category>Featured Posts</category>
<category>perl</category>

<dc:creator>Frank Wiles</dc:creator>
<pubDate>Thu, 31 May 2007 13:54:36 -0500</pubDate>

<feedburner:origLink>http://blog.revsys.com/2007/05/email_templates.html</feedburner:origLink></item>
<item>
<title>Gantry book released to the world</title>
<link>http://feeds.feedburner.com/~r/revsys/JkwX/~3/155572703/gantry_book_rel.html</link>
<guid isPermaLink="false">http://blog.revsys.com/2007/04/gantry_book_rel.html</guid>
<description>Phil Crow has released a new book on using Gantry and Bigtop. It's titled Building Web Applications with Gantry and Bigtop I encourage you to check it out!</description>
<content:encoded><![CDATA[<p>Phil Crow has released a new book on using Gantry and Bigtop.&nbsp; It's titled <a href="http://www.lulu.com/content/764823">Building Web Applications with Gantry and Bigtop</a> I encourage you to check it out!</p><img src="http://feeds.feedburner.com/~r/revsys/JkwX/~4/155572703" height="1" width="1"/>]]></content:encoded>


<category>perl</category>

<dc:creator>Frank Wiles</dc:creator>
<pubDate>Wed, 11 Apr 2007 11:12:12 -0500</pubDate>

<feedburner:origLink>http://blog.revsys.com/2007/04/gantry_book_rel.html</feedburner:origLink></item>
<item>
<title>Installing Mail::Cclient on RHEL</title>
<link>http://feeds.feedburner.com/~r/revsys/JkwX/~3/155572704/installing_mail.html</link>
<guid isPermaLink="false">http://blog.revsys.com/2007/03/installing_mail.html</guid>
<description>Ran into a small build problem when trying to install the CPAN module Mail::Cclient on a Red Hat Enterprise Linux system. Figured I would go ahead and document the process in full for others ( and for myself later in...</description>
<content:encoded><![CDATA[<p>Ran into a small build problem when trying to install the CPAN module Mail::Cclient on a Red Hat Enterprise Linux system.&nbsp; Figured I would go ahead and document the process in full for others ( and for myself later in life ).&nbsp; </p>

<p>FIrst off you will most likely need to install two RPMs </p>

<ul><li>libc-client</li>

<li>libc-client-devel</li></ul>

<p>Then you will need to download a distribution of Mail::Cclient, don't even bother trying to install this from the CPAN shell as it won't work. </p>

<p>Unpack your distribution with the normal tar -xvzf Mail-Cclient-x.xx.tar.gz and cd into the directory. You will then, unfortunately, have to edit the Makefile.PL by hand.&nbsp; Specifically you will have to change INC argument to WriteMakefile() to be: </p>

<p>&nbsp; &nbsp; <strong>&quot;INC&quot;&nbsp; &nbsp; =&gt;&nbsp; &nbsp;&quot;-I$CCLIENT_DIR -I/usr/include/imap&quot;,</strong></p>

<p>This instructs the build process to look for the shared library in $CCLIENT_DIR and the headers in /usr/include/imap. </p>

<p>Then it is just a matter of calling: </p>

<p><strong>perl Makefile.PL CCLIENT_DIR=/usr/lib<br />make<br />make install</strong> </p>

<p>Hope this helps someone else who gets bit by this annoyance.</p>

<p><strong>UPDATE: </strong><br />Turns out that I was grabbing an older version of Mail::Cclient ( version 1.1 specifically ) if you use Mail::Cclient 1.12 then the install process requires a few other RPMs: </p>

<ul><li>openssl-devel</li>

<li>pam-devl e</li></ul>

<p>And then you install it with: </p>&nbsp; &nbsp; <p><strong>perl Makefile.PL --cclient_dir=/usr/lib --with-pam --with-cclient-includes=/usr/include/imap/ --with-shared_cclient</strong></p><img src="http://feeds.feedburner.com/~r/revsys/JkwX/~4/155572704" height="1" width="1"/>]]></content:encoded>


<category>perl</category>

<dc:creator>Frank Wiles</dc:creator>
<pubDate>Thu, 22 Mar 2007 10:23:32 -0500</pubDate>

<feedburner:origLink>http://blog.revsys.com/2007/03/installing_mail.html</feedburner:origLink></item>
<item>
<title>Speaking at SCALE in Los Angeles</title>
<link>http://feeds.feedburner.com/~r/revsys/JkwX/~3/155572705/speaking_at_sca.html</link>
<guid isPermaLink="false">http://blog.revsys.com/2007/02/speaking_at_sca.html</guid>
<description>I nearly forgot to blog about this, but next Sunday (February 11th, 2007) I'll be giving a short introduction on using mod_perl 2.0 at the 5th Annual Southern California Linux Expo. I hope to see you there! UPDATE: The slides...</description>
<content:encoded><![CDATA[<p>I nearly forgot to blog about this, but next Sunday (February 11th, 2007) I'll be giving a short introduction on using <a href="http://perl.apache.org">mod_perl 2.0</a> at the 5th Annual <a href="http://www.socallinuxexpo.org/scale5x/">Southern California Linux Expo</a>. I hope to see you there!</p>

<p><strong>UPDATE: </strong>The slides for this talk can be found <a href="http://www.revsys.com/talks/scale5x/mod_perl/">here.</a> </p><img src="http://feeds.feedburner.com/~r/revsys/JkwX/~4/155572705" height="1" width="1"/>]]></content:encoded>


<category>perl</category>

<dc:creator>Frank Wiles</dc:creator>
<pubDate>Tue, 06 Feb 2007 08:50:02 -0600</pubDate>

<feedburner:origLink>http://blog.revsys.com/2007/02/speaking_at_sca.html</feedburner:origLink></item>
<item>
<title>And some people say programmers are boring</title>
<link>http://feeds.feedburner.com/~r/revsys/JkwX/~3/155572706/and_some_people.html</link>
<guid isPermaLink="false">http://blog.revsys.com/2007/01/and_some_people.html</guid>
<description>It is a common stereotype that computer programmers tend to be on the boring side. Not Perl programmers it turns out. We're a wacky bunch. Take for example our benevolent dictator Larry Wall, he's anything but boring. Not to mention...</description>
<content:encoded><![CDATA[<p>It is a common stereotype that computer programmers tend to be on the boring side.&nbsp; Not Perl programmers it turns out.&nbsp; We're a <em>wacky</em> bunch. Take for example our benevolent dictator <a href="http://www.wall.org/~larry/">Larry Wall</a>, he's anything but boring. </p>

<p>Not to mention <a href="http://www.theperlreview.com/Shirt/">Schwern's Shirt</a>. </p>

<p>And what other programming language has an elder like <a href="http://use.perl.org/~brian_d_foy/journal/32173?from=rss">brian d foy</a> who has violated the Posse Commitatus Act? </p>

<p>This is just a small sampling of Perl's fun and wacky side.&nbsp; Personally, I think it's one of the reasons our community is so strong. <br /><br /></p><img src="http://feeds.feedburner.com/~r/revsys/JkwX/~4/155572706" height="1" width="1"/>]]></content:encoded>


<category>perl</category>

<dc:creator>Frank Wiles</dc:creator>
<pubDate>Thu, 18 Jan 2007 11:23:13 -0600</pubDate>

<feedburner:origLink>http://blog.revsys.com/2007/01/and_some_people.html</feedburner:origLink></item>
<item>
<title>Introduction to Gantry, Bigtop, and Tentmaker screencasts</title>
<link>http://feeds.feedburner.com/~r/revsys/JkwX/~3/155572707/introduction_to.html</link>
<guid isPermaLink="false">http://blog.revsys.com/2006/10/introduction_to.html</guid>
<description>Thought I would mention that there are now two screencasts that show off some of the main features of the Gantry framework that I play a minor role in. You can find the screencasts here under movies</description>
<content:encoded><![CDATA[<p>
Thought I would mention that there are now two screencasts that show off some of the main features of the <a href="http://www.usegantry.org">Gantry</a> framework that I play a minor role in. 
</p> 
<p>
You can find the screencasts here under <a href="http://www.usegantry.org/movies/">movies</a> 
</p><img src="http://feeds.feedburner.com/~r/revsys/JkwX/~4/155572707" height="1" width="1"/>]]></content:encoded>


<category>perl</category>

<dc:creator>Frank Wiles</dc:creator>
<pubDate>Thu, 05 Oct 2006 07:00:00 -0500</pubDate>

<feedburner:origLink>http://blog.revsys.com/2006/10/introduction_to.html</feedburner:origLink></item>
<item>
<title>Doing a LEFT OUTER join with DBIx::Class</title>
<link>http://feeds.feedburner.com/~r/revsys/JkwX/~3/155572708/doing_a_left_ou.html</link>
<guid isPermaLink="false">http://blog.revsys.com/2006/07/doing_a_left_ou.html</guid>
<description>I have recently been using DBIx::Class instead of the more popular Class::DBI. It has many advantages over Class::DBI that I won't go into here, but if you haven't used it yet you should definitely check it out. One thing I...</description>
<content:encoded><![CDATA[<p>
I have recently been using <a href="ttp://search.cpan.org/~mstrout/DBIx-Class-0.07000/lib/DBIx/Class.pm">DBIx::Class</a> 
instead of the more popular Class::DBI. It has many advantages over Class::DBI that I won't go into here, but if you haven't used it yet you should definitely check it out.
</p>

<p>
One thing I found the other day is how to setup a special LEFT OUTER join query. If you have a situation where you need to do a LEFT OUTER join on your data, but only say in one particular script.&nbsp; Or maybe a one off report that you won't be keeping around. You could go ahead and put in this relationship in your main model class, but for a <em>one off</em> that is a bit of overkill.&nbsp; 
</p>

<p>
What I hadn't thought about, was you can define those relationships from outside the MyModelClass.pm file itself.&nbsp; Take for example a
simple Artist -&gt; CD relationship, where you want all artists even if they don't have any CDs:&nbsp; 
</p>

<p>&nbsp;</p>

<pre>use ExampleSchema;<br /><br />ExampleSchema::Artist-&gt;has_many('left_outer_albums' =&gt;<br />&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; 'ExampleSchema::Cd', 'artist_id',<br />&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; { join_type =&gt; 'LEFT_OUTER' } );<br /><br />my $schema = ExampleSchema-&gt;connect('dbi:Pg:dbname=outer', '', '');<br /><br />my $rs = $schema-&gt;resultset('Artist')-&gt;search(<br />
&nbsp; &nbsp; undef,<br />
);

while( my $artist = $rs-&gt;next ) {
&nbsp; &nbsp; print &quot;Name: &quot; . $artist-&gt;name . &quot;\n&quot;;
&nbsp; &nbsp; print &quot;Albums: \n&quot;;

&nbsp; &nbsp; foreach my $album ( $artist-&gt;left_outer_albums ) {
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; print &quot;\t&quot; . $album-&gt;title . &quot;\n&quot;;
&nbsp; &nbsp; }
}
</pre>

<p>
The nice thing about this is that this special <em>left_outer_artists</em> is defined and used in the one off and doesn't have to polute your main ExampleSchema::Artist relationships that might confuse someone. It may not be the best practice, but it is something to consider. 
</p><img src="http://feeds.feedburner.com/~r/revsys/JkwX/~4/155572708" height="1" width="1"/>]]></content:encoded>


<category>Featured Posts</category>
<category>perl</category>

<dc:creator>Frank Wiles</dc:creator>
<pubDate>Tue, 25 Jul 2006 07:00:00 -0500</pubDate>

<feedburner:origLink>http://blog.revsys.com/2006/07/doing_a_left_ou.html</feedburner:origLink></item>
<item>
<title>Learn something new about Perl every day</title>
<link>http://feeds.feedburner.com/~r/revsys/JkwX/~3/155572709/learn_something.html</link>
<guid isPermaLink="false">http://blog.revsys.com/2006/04/learn_something.html</guid>
<description>Just when you think you know everything about Perl, something silly rises up and shows you have ignorant you really are. How many times have you written code similar to this? my $filename = "/path/to/file.txt"; my @dir_parts = split('/', $filename);...</description>
<content:encoded><![CDATA[<p>
&nbsp; Just when you think you know everything about Perl, something silly
&nbsp; rises up and shows you have ignorant you really are.
</p>
<p>
&nbsp; How many times have you written code similar to this?
</p>
<pre> <br />&nbsp; &nbsp;&nbsp; &nbsp;my $filename = &quot;/path/to/file.txt&quot;;<br />&nbsp; &nbsp;&nbsp; &nbsp;my @dir_parts = split('/', $filename);<br /><br />&nbsp; &nbsp;&nbsp; &nbsp;my $file = pop( @dir_parts );<br />&nbsp; &nbsp;&nbsp; &nbsp;my $path = join('/', @dir_parts );</pre> 
<p>or</p>
<pre>&nbsp; &nbsp;&nbsp; &nbsp;my ($name) = $filename =~ s/\/(.*?)$/o;</pre>

<p>
While I knew about the existance of File::Basename, the last time I looked at
it I don't believe it was part of Perl Core.&nbsp; I should have suspected, but
now it is a standard Perl module that makes this trivial:
</p>
<pre> <br />&nbsp; &nbsp;&nbsp; &nbsp;use File::Basename;</pre>

<p>&nbsp; &nbsp;&nbsp; &nbsp;# Retrieve just the filename<br /><br />
&nbsp; &nbsp;&nbsp; &nbsp;my $filename_only = basename($filename);</p>

<p>&nbsp; &nbsp;&nbsp; &nbsp;# Get just the path in this filename<br /><br />
&nbsp; &nbsp;&nbsp; &nbsp;my $path_only&nbsp; &nbsp;&nbsp; = dirname($filename);<br /><br />
</p><br />
<p>
&nbsp; You can get even fancier with the fileparse() function provided in<br />
&nbsp; this module.<br />
</p><br />
<pre>
&nbsp; &nbsp;&nbsp; &nbsp;my ($base, $path, $suffix) = fileparse( $filename );
</pre>
<p>
&nbsp; &nbsp;Would yield the filename only in $base, the path in $path, and<br />
&nbsp; &nbsp;nothing in $suffix.&nbsp; This is because we did not provide a regular<br />
&nbsp; &nbsp;expression to match on.<br />
</p><br />
<p>
&nbsp; &nbsp;If we instead used:<br />
</p><br />
<pre>
&nbsp; &nbsp;&nbsp; &nbsp;my ($base, $path, $suffix) = fileparse( $filename, qr{\.txt} );
</pre>
<p>
&nbsp; &nbsp;And we ran it against $filename = '/home/frank/test.txt' and<br />
&nbsp; &nbsp;$filename2 = '/home/frank/test.doc' it would give us:<br />
</p>
<pre>&nbsp; &nbsp;&nbsp; &nbsp;Base: test
&nbsp; &nbsp;&nbsp; &nbsp;Path: /home/frank
&nbsp; &nbsp;&nbsp; &nbsp;Type: .txt
</pre>
<p>
&nbsp; &nbsp;&nbsp; &nbsp;and<br />
</p><br />
<pre>&nbsp; &nbsp;&nbsp; &nbsp;Base: test.doc
&nbsp; &nbsp;&nbsp; &nbsp;Path: /home/frank
&nbsp; &nbsp;&nbsp; &nbsp;Type:
</pre>
<p>
&nbsp; &nbsp;If the filename give to fileparse() does not match, it is not<br />
&nbsp; &nbsp;stripped from the basename.<br />
</p><br />
<p>
It just goes to show that no matter how long you've been using Perl, or how much you <em>think</em> you know, there is always something out there you could be learning. <br />
</p><img src="http://feeds.feedburner.com/~r/revsys/JkwX/~4/155572709" height="1" width="1"/>]]></content:encoded>


<category>perl</category>

<dc:creator>Frank Wiles</dc:creator>
<pubDate>Wed, 26 Apr 2006 07:00:00 -0500</pubDate>

<feedburner:origLink>http://blog.revsys.com/2006/04/learn_something.html</feedburner:origLink></item>
<item>
<title>Been far too long...</title>
<link>http://feeds.feedburner.com/~r/revsys/JkwX/~3/155572710/been_far_too_lo.html</link>
<guid isPermaLink="false">http://blog.revsys.com/2006/04/been_far_too_lo.html</guid>
<description>It's been far too long since I've had time to post on this blog. Time passes at a frightening pace doesn't it? Here two tidbits of info you might be interested in: Released a new version of Apache::DB, Apache::DProf, and...</description>
<content:encoded><![CDATA[<p>
It's been far too long since I've had time to post on this blog.&nbsp; Time passes at a frightening pace doesn't it?&nbsp; Here two tidbits of info you might be interested in: 
</p>
<ol>
&nbsp; <li>Released a new version of
&nbsp; <a href="http://search.cpan.org/~fwiles/Apache-DB-0.13/DB.pm">Apache::DB</a>, 
<a href="http://search.cpan.org/~fwiles/Apache-DB-0.13/lib/Apache/DProf.pm">Apache::DProf</a>,
and 
<a href="http://search.cpan.org/~fwiles/Apache-DB-0.13/lib/Apache/SmallProf.pm">Apache::SmallProf</a>. The new release fixes a bug where you couldn't use Apache::DProf under taint mode and allows you to specify anywhere on the file system for your dprof info to be dumped.&nbsp; Previously it had to be relative to ServerRoot.
</li>
<li>
<a href="http://www.usegantry.org">Gantry</a>, yet another web framework, that I have been helping out with was finally released publically. I helped mostly with <a href="http://www.usegantry.org/cgi-bin/gantry/main/Conf::Tutorial">Gantry::Conf</a>&nbsp; a configuration abstraction interface.&nbsp; It is essentially DBI for configuration files.&nbsp; Right now it doesn't support everything I would like it to, but the hooks are all there and I plan on fleshing the rest out in the near future. 
</li>
</ol>
<img src="http://feeds.feedburner.com/~r/revsys/JkwX/~4/155572710" height="1" width="1"/>]]></content:encoded>


<category>perl</category>

<dc:creator>Frank Wiles</dc:creator>
<pubDate>Thu, 20 Apr 2006 22:01:34 -0500</pubDate>

<feedburner:origLink>http://blog.revsys.com/2006/04/been_far_too_lo.html</feedburner:origLink></item>
<item>
<title>Apache debugging and performance tuning article</title>
<link>http://feeds.feedburner.com/~r/revsys/JkwX/~3/155572711/apache_debuggin.html</link>
<guid isPermaLink="false">http://blog.revsys.com/2006/02/apache_debuggin.html</guid>
<description>Looks like my article on Debugging and performance profiling mod_perl applications is up on www.perl.com.</description>
<content:encoded><![CDATA[<p>
Looks like my article on <a href="http://www.perl.com/pub/a/2006/02/09/debug_mod_perl.html">Debugging and performance profiling mod_perl applications</a> is up on <a href="http://www.perl.com">www.perl.com</a>.
</p><img src="http://feeds.feedburner.com/~r/revsys/JkwX/~4/155572711" height="1" width="1"/>]]></content:encoded>


<category>perl</category>

<dc:creator>Frank Wiles</dc:creator>
<pubDate>Thu, 09 Feb 2006 08:00:00 -0600</pubDate>

<feedburner:origLink>http://blog.revsys.com/2006/02/apache_debuggin.html</feedburner:origLink></item>
<item>
<title>Apache::DB, Apache::DProf, and Apache::SmallProf updates</title>
<link>http://feeds.feedburner.com/~r/revsys/JkwX/~3/155572713/apachedb_apache.html</link>
<guid isPermaLink="false">http://blog.revsys.com/2006/01/apachedb_apache.html</guid>
<description>Recently it came to my attention that there were some fairly serious bugs in some of the CPAN modules I maintain. Stas Bekman was trying to use Apache::DProf to profile the performance of one of his projects and could not...</description>
<content:encoded><![CDATA[<p>
Recently it came to my attention that there were some fairly serious bugs in some of the <a href="http://search.cpan.org/~fwiles/">CPAN modules I maintain</a>.&nbsp; <a href="http://www.stason.org">Stas Bekman</a> was trying to use Apache::DProf to profile the performance of one of his projects and could not get it to work. 
</p>
<p>
The problem essentially boiled down to the generally accepted <em>best practice</em> at <a href="http://perl.apache.org/docs/2.0/user/porting/porting.html#Porting_a_Module_to_Run_under_both_mod_perl_2_0_and_mod_perl_1_0">how to determine if your code is running in mod_perl 1.x or 2.x</a> doesn't work in all cases in all environments.&nbsp; This is because of when the $mod_perl or $mod_perl2 modules are loaded in relation to the Apache lifecycle.&nbsp; 
</p>
<p>
Instead of using:
</p>
<p class="code">
use constant MP2 =&gt; eval { require mod_perl; $mod_perl::VERSION &gt; 1.99 };
</p>
<p>
We're going to use:
</p>
<p class="code">
use constant MP2 =&gt; ( exists $ENV{MOD_PERL_API_VERSION} and $ENV{MOD_PERL_API_VERSION} &gt;= 2 ); 
</p>
<p>
Because this environment variable is guaranteed to always be available and accurate.
</p>
<p>
I've uploaded a new distribution of these modules to CPAN just now and&nbsp; it should make it to your favorite mirror in the next 24/48 hours. If you currently use these modules or the above technique to make your mod_perl code work in both an 1.x and 2.x environment you are encouraged to make these changes as well.
</p><img src="http://feeds.feedburner.com/~r/revsys/JkwX/~4/155572713" height="1" width="1"/>]]></content:encoded>


<category>perl</category>

<dc:creator>Frank Wiles</dc:creator>
<pubDate>Tue, 24 Jan 2006 08:00:00 -0600</pubDate>

<feedburner:origLink>http://blog.revsys.com/2006/01/apachedb_apache.html</feedburner:origLink></item>
<item>
<title>ModPerl::ParamBuilder released</title>
<link>http://feeds.feedburner.com/~r/revsys/JkwX/~3/155572714/modperlparambui.html</link>
<guid isPermaLink="false">http://blog.revsys.com/2006/01/modperlparambui.html</guid>
<description>I just released a new module to CPAN ModPerl::ParamBuilder which makes it much easier to build custom Apache directives for your mod_perl 2.0 applications. You might be asking why you would want to do such a thing. The main reasons...</description>
<content:encoded><![CDATA[<p>
I just released a new module to CPAN <a href="http://search.cpan.org/~fwiles/ModPerl-ParamBuilder-0.08/lib/ModPerl/ParamBuilder.pm">ModPerl::ParamBuilder</a>
which makes it much easier to build <a href="http://perl.apache.org/docs/2.0/user/config/custom.html">custom Apache directives</a> for your mod_perl 2.0 applications.
</p>
<p>
You might be asking why you would want to do such a thing. The main reasons are: 
</p>
<ul>
&nbsp; &nbsp;<li>Custom directives are more efficient than using PerlSetEnv or PerlSetVar. They are evaluated only on server startup and <strong>not</strong> for each request like PerlSetVars</li>
&nbsp; &nbsp;<li>It gives your application a more polished and professional 
&nbsp; &nbsp;&nbsp; &nbsp; look and makes your configuration more intuitive for end users</li>
&nbsp; &nbsp;<li>It's just plain cool</li>
</ul>
<p>
Assuming you're building an application called <em>MyApp</em> that will need to be passed various parameters such as database user, password, database name, database server address, etc. Here is how
<a href="http://search.cpan.org/~fwiles/ModPerl-ParamBuilder-0.08/lib/ModPerl/ParamBuilder.pm">ModPerl::ParamBuilder</a>
fits in.&nbsp; 
</p>
<p>
First you create a separate module that will hold your custom directives. We'll call that <em>MyApp::Params</em> and would look like:
</p>
<p class="code">
package MyApp::Params;<br />
use ModPerl::ParamBuilder;<br />
use base qw( ModPerl::ParamBuilder );<br /><br />

</p>

<p>my $builder = ModPerl::ParamBuilder-&gt;new( __PACKAGE__ ); </p>

<p>$builder-&gt;param('DBUser');<br /><br />
$builder-&gt;param('DBPass');<br /><br />
$builder-&gt;param('DBName');<br /><br />
$builder-&gt;param('DBServer');<br /><br />
$builder-&gt;on_off('AutoCommit');<br /><br /><br />
$builder-&gt;load;<br /><br /> <br />
1; <br />
</p><br />
<p>
Putting these directives to use in your Apache's httpd.conf is easy,<br />
you just need to load your <em>MyApp::Params</em> module. <br />
</p><br />
<p class="code">
PerlLoadModule MyApp::Params<br /><br /><br />
&lt;Location /myapp&gt;<br /><br />
&nbsp; SetHandler perl-script<br /><br />
&nbsp; DBUser apache<br /><br />
&nbsp; DBPass secret<br /><br />
&nbsp; DBServer 127.0.0.1<br /><br />
&nbsp; DBName myapp<br /><br />
&nbsp; AutoCommit On<br /><br />
&nbsp; PerlResponseHandler MyApp::Main<br /><br />
&lt;/Location&gt;<br />
</p><br />
<p>
<strong>NOTE:</strong>You must use <em>PerlLoadModule</em> and not <br />
the more common <em>PerlModule</em> Apache directive for your parameter module.&nbsp; This is because Apache needs to load this module very early in the server startup so that it can read it's own configuration files.<br />
</p><br />
<p>
To retrieve and use these directives from your application you add<br />
the following to <em>MyApp::Main</em>:<br />
</p><br />
<p class="code">
use MyApp::Params;<br /><br /><br />
my $params = MyApp::Params-&gt;new;<br /> <br />
my $config = $params-&gt;get_config;<br /><br /><br />
my $dbuser = $$config{'DBUser'};<br /><br />
# etc <br />
</p><br />
<p>
Hopefully everyone will find this module as useful as I have. Personally, I think being able to build custom Apache directives easily is of the neatest features of mod_perl 2.0. <br />
</p><br />
<p>
<strong>UPDATE:</strong> I've also put up a short <a href="http://www.revsys.com/writings/modperl/ModPerl-ParamBuilder/">short tutorial on how to use ModPerl::ParamBuilder</a>. <br />
</p><br />
<p>
Feel free to <a href="mailto:blog@revsys.com">contact me</a> if you have any questions or have a problem using it. <br />
</p><img src="http://feeds.feedburner.com/~r/revsys/JkwX/~4/155572714" height="1" width="1"/>]]></content:encoded>


<category>perl</category>

<dc:creator>Frank Wiles</dc:creator>
<pubDate>Thu, 12 Jan 2006 03:00:00 -0600</pubDate>

<feedburner:origLink>http://blog.revsys.com/2006/01/modperlparambui.html</feedburner:origLink></item>
<item>
<title>Sending E-mail from Perl</title>
<link>http://feeds.feedburner.com/~r/revsys/JkwX/~3/155572715/sending_email_f.html</link>
<guid isPermaLink="false">http://blog.revsys.com/2006/01/sending_email_f.html</guid>
<description>UPDATE: I've recently found an even better way of sending Email messages than using any of the information listed here. Check out my new post on the subject for the details I'm always amazed at how many people have trouble...</description>
<content:encoded><![CDATA[&nbsp; <p><strong>UPDATE:</strong> I've recently found an even better way of sending Email messages than using any of the information listed here.&nbsp; Check out my <a href="http://blog.revsys.com/2007/05/email_templates.html">new post on the subject</a> for the details</p>

<p>I'm always amazed at how many people have trouble doing something as simple as sending E-mail from Perl or mod_perl.&nbsp; I think this is because new Perl programmers are either unaware of <a href="http://www.cpan.org" title="Comprehensive Perl Archive Network">CPAN</a> or afraid to use it.&nbsp; Trust me CPAN is your friend. :)&nbsp; If you install the <a href="http://search.cpan.org/~gbarr/libnet-1.19/Net/SMTP.pm" title="Net::SMTP">Net::SMTP</a> module, which is part of the libnet CPAN package, on your system it is trivial to send plain text E-mail messages. </p>&nbsp; &nbsp;<p>Here is a brief example: </p>&nbsp; &nbsp;<p class="code"># Create an instance of the module<br />&nbsp; my $smtp = Net::SMTP-&gt;new( 'smtp.example.com') or die &quot;Cannot connect to host: $!&quot;; <br />&nbsp; </p>&nbsp; &nbsp;<p class="code">$smtp-&gt;to( 'recipient@example.com' );<br /> <br />&nbsp; $smtp-&gt;data();<br />&nbsp; $smtp-&gt;datasend(&quot;To: recipient\@example.com\n&quot;);<br />&nbsp; $smtp-&gt;datasend(&quot;From: sender\@example.com\n&quot;);<br />&nbsp; $smtp-&gt;datasend(&quot;Subject: Test Subject\n&quot;);<br />&nbsp; $smtp-&gt;datasend(&quot;\n&quot;);<br />&nbsp; $smtp-&gt;datasend(&quot;This is where the body of your message goes!\n&quot;);<br />&nbsp; $smtp-&gt;quit();</p>&nbsp; &nbsp;<p>This module assumes you know a little bit about the SMTP protocol, but there are tons of modules on CPAN that are even easier to use.&nbsp; This one just happens to be the one I use the most.&nbsp; Some others are: </p>&nbsp; &nbsp;<ul>&nbsp; <li><a href="http://search.cpan.org/~mivkovic/Mail-Sendmail-0.79/Sendmail.pm" title="Mail::Sendmail CPAN module">Mail::Sendmail</a></li>&nbsp; &nbsp;<li><a href="http://search.cpan.org/~gmpassos/Mail-SendEasy-1.2/lib/Mail/SendEasy.pm">Mail::SendEasy</a></li>&nbsp; &nbsp;<li><a href="http://search.cpan.org/~yves/MIME-Lite-3.01/lib/MIME/Lite.pm">MIME::Lite</a></li>&nbsp; &nbsp;<li><a href="http://search.cpan.org/~mthurn/Email-Send-SMTP-Auth-1.007/Auth.pm">Email::Sender::SMTP::Auth</a></li>&nbsp; &nbsp;<li><a href="http://search.cpan.org/~cwest/Email-Send-2.00/lib/Email/Send.pm" title="Email::Send">Email::Send</a></li>&nbsp; </ul>

<p>While I haven't personally used all of these modules, they all seem to have clean interfaces for sending E-mail from your Perl programs.&nbsp; MIME::Lite especially is useful when you want to send attachments along with your message.&nbsp; Hopefully this information helps you in your future projects!</p><img src="http://feeds.feedburner.com/~r/revsys/JkwX/~4/155572715" height="1" width="1"/>]]></content:encoded>


<category>perl</category>

<dc:creator>Frank Wiles</dc:creator>
<pubDate>Thu, 05 Jan 2006 23:22:53 -0600</pubDate>

<feedburner:origLink>http://blog.revsys.com/2006/01/sending_email_f.html</feedburner:origLink></item>

</channel>
</rss>
