Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Simplicity vs. Doing It Right

by jryan (Vicar)
on Oct 13, 2002 at 00:39 UTC ( [id://204836]=note: print w/replies, xml ) Need Help??


in reply to Simplicity vs. Doing It Right

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?

Personally, I'd prefer pre-built XML parser to rolling my own, especially after the "simple chunk of XML" becomes more complex.

Do I really need a database for a simple content management system, or are would flat files work adequately?

Well, it depends on the definition of simple. If you're doing something for your own personal site, sure, why not. I didn't even use a database for mine, I used a "nested-template" based solution that I whipped up myself.

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.

Yes. Why do work that you don't need to? It takes me about 12 and a half seconds to type:

use CGI; my $q = CGI->new; my $param = $q->param("param");

And the best part is, I don't even need to think about it. And I know it won't break if I ever have to use it outside the firewall. Why would you roll your own version of this well rounded wheel, especially if you know better?

I guess what I'm really trying to say is that it really depends on the situation. Sure, you're friend's mini web server worked great, and theres certainly nothing wrong with a piece of code that does exactly what it is supposed to do to solve the problem at hand, even if it is incomplete in the broad sense.

However, when people come here for help, it is a different situation. I most certainly expect that should recieve the most complete, accurate information on the "right way" to solve the problem. Why should they get anything less?

Replies are listed 'Best First'.
Re: Re: Simplicity vs. Doing It Right
by dws (Chancellor) on Oct 13, 2002 at 03:24 UTC
    Why do work that you don't need to? It takes me about 12 and a half seconds to type: use CGI; ...

    Sure. After you've used CGI a few times it only takes a few seconds. But I'll wager the first time took a lot longer. It took me hours, because I wanted to understand what was going on under the covers. Ditto for the XML:: stuff. The first time can be a killer. If the only advice we give people is to use CGI, XML::*, etc., then we might be short-changing them. It might be the "right" way, but is it the only way? Heck no. Applying a regex to $ENV{'QUERY_STRING'} works just fine for some one-off problems. Do I do that anymore? No. But in some cases, it's O.K. to send people away with that as an option.

      Sure, it can take hours the first time you use a module if you go it alone, especially if you read what is happening under the hood first (I often do this too). However, this isn't the case when you read: "You need to use module X, just like this: *short code snippet follows*." Why send people off with a solution that you know will cause them more work than necessary, especially when the "right way" is so much easier to implement?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (5)
As of 2024-03-28 13:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found