Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Sometimes people who have a problem to solve can do amazing things when they aren't encumbered by knowing the "right way" to go about things.

I was looking over such a piece of code last night. Someone needed a web interface for running tests cases, and put together a web server that would serve up HTML, images, and run Java test cases and return the results (in HTML). All in 61 lines of Perl. Granted, it was hardly a complete web server. It worked off of the first line of the HTTP request, and returned a minimal (but correct) response header. Some of it looked like raw socket code lifted out of the Camel book. No strict, no modules (other than Socket), and only one comment. Still, it solved someone's real problem in less than page of code.

Looking it over, I got to thinking about some of the people who wander in here with real problems to solve. We usually advise them to use strict, use CGI, and reuse some set of modules from CPAN. Instead of a minimal script that'll solve their problem, they're sent off with a shopping list of things needed to build a "correct" (i.e., heavier) solution. And often these solutions require fresh CPAN downloads to install elsewhere, which raises a real barrier in some situations.

The problem with the "right way" is that it's a slippery slope. Do I really need an XML parser if I'm given a simple chunk of XML to deal with, or are regexes sufficient? Do I really need a database for a simple content management system, or are would flat files work adequately? Do I really need to use CGI if I'm doing something simple inside the firewall? The "right way" adds weight that isn't always needed.

But many of us are inclined to do things right. We know that today's requirements are incomplete and will probably grow anyway, and that we'd better plan for the future by building solider solutions than are asked for, leveraging tested, off-the-shelf code where possible to save effort.

I suspect, though, that this leads many of us to over engineer the occasional one-time problem we encounter.


In reply to Simplicity vs. Doing It Right by dws

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 sharing their wisdom with the Monastery: (6)
As of 2024-04-24 11:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found