





Web Development with Apache and Perl 221
Web Development with Apache and Perl | |
author | Theo Petersen |
pages | 400 |
publisher | Manning |
rating | 8 |
reviewer | davorg |
ISBN | 1-930110-06-5 |
summary | Good Overview of the State of the Art in Open Source Web Development |
I mention Stein's book because that's what this new book reminded me of most (that, by the way, is a huge compliment). Petersen realises that an overview of the whole web development area would be difficult to write (and, ultimately, unhelpful) so he restricts himself to a subset of the available technologies - Perl and Apache - and gives a thorough review of the state of the art of web development in these areas.
But before he gets into the details of Apache and Perl, in chapter 1 Petersen takes a look at the wider world of Open Source Software and in the process presents one of the best arguments I've seen in print for why a company should choose Open Source Software. In chapters 2 and 3 he takes the same approach with web servers and scripting languages, giving compelling reasons for choosing Apache and Perl.
Having chosen his architecture, in part 2, Petersen moves on to looking at some common tools for web development. Chapter 4 looks at databases. The two main Open Source Databases (MySQL and PostgreSQL) are compared and MySQL is chosen as the basis for the rest of the examples. Chapter 5 discusses the shortcomings of the standard CGI architecture and introduces mod_perl as an alternative. This is a good introduction to a technology that some people can find hard to get to grips with. Petersen takes us through the use of Apache::Registry before moving on to the complexity and power of mod_perl handlers.
Chapter 6 looks at the importance of security in web applications and discusses in some depth the problems of user authentication and the use of SSL for secure data transmission. Chapter 7 looks at ways to separate content from presentation. First we look briefly at server-side includes, but the majority of the chapter is taken up with a review of the various templating systems that are available for Perl. The chapter finishes with a detailed look at two of the most popular templating solutions - HTML::Mason and Template Toolkit.
Part 3 of the book looks at three different types of web site in great detail. In each case Petersen uses the examples to take a brief survey of a number of the existing tools. For example chapter 9 looks at a community web site and contains information about a number of web-based forums and chat rooms. It also takes an extended look at Slashcode the software that runs Slashdot. Chapter 9 takes a similar approach for intranet sites and Chapter 10 for online stores.
In part 4 we take a longer term view of a web site. Chapter 11 looks at content management systems and chapter 12 lookat at performance tuning. Both of these chapters are full of useful advice on how to make running a web server as painless as possible.
I think this is a very useful book to have on your bookshelf. Anyone who is developing web applications using Apache and Perl will find something useful in the book. It should be obvious that in order for a single book to cover so much ground, sometimes there isn't quite as much technical detail as you might like, but there is a good bibliography that will show you where to go for more information. In my opinion the high-level approach makes the book particularly useful for a couple of groups of potential readers. Firstly I think it makes a great introduction to the subject for someone coming to Apache and Perl for the first time. Secondly (and perhaps most importantly) I can see the book (in particular the first three chapters) being very useful reading material for a manager who is making a decision between using Open Source Software or some proprietary technology.
You can purchase Web Development with Apache and Perl from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
Sounds Like A Good Book, Creepy Cover Illustration (Score:4, Funny)
I much prefer the O'Reilly animals.
And yes. I am being a little facetious here.
Re:Sounds Like A Good Book, Creepy Cover Illustrat (Score:3, Funny)
What, even the slug book [miketaylor.org.uk]? :-)
Re:Sounds Like A Good Book, Creepy Cover Illustrat (Score:1)
Yes, I think even the slug book!
Re:Sounds Like A Good Book, Creepy Cover Illustrat (Score:1)
2 pages, $1.95
Okay, do we REALLY need a 2 page book? And what good is true with out
Re:Sounds Like A Good Book, Creepy Cover Illustrat (Score:2)
OSS and Dev in Perl and Apache (Score:1, Interesting)
Re:OSS and Dev in Perl and Apache (Score:2)
From davorg's commentary, "in chapter 1 Petersen takes a look at the wider world of Open Source Software and in the process presents one of the best arguments I've seen in print for why a company should choose Open Source Software." That does *NOT* mean that Perl/Apache is the best argument for going Open Source, he's merely saying that the book provides good reasoning for doing so. The Mythical Man-Month was written 25 years ago and refers mainly to assembly and PL/I code (which is irrelevant since 95% of coding occurs in a higher level language today, and all's quiet on the PL/I front), but it still remains a definitive reference on software engineering principles and how to manage massive software projects. Good insight comes from the abstract, not the implemenatation.
Re:OSS and Dev in Perl and Apache (Score:1)
Delrin
Isn't it time web development moved on? (Score:1, Insightful)
Re:Isn't it time web development moved on? (Score:1)
http://www.perl.com/pub/a/2001/10/17/etoys.html [perl.com]
Java is *not the answer*! Besides, I thought discussion on Slashdot was limited to software libre . . . .
You need to read up on website design (Score:1)
Re:Isn't it time web development moved on? (Score:2, Informative)
BUT
The chances of getting a large group of perl developers to code a large enterprise E-Comerce website and not take shortcuts nor kludges, and not to just fall away from good design and architecture is very rare.
Java, along with J2EE, JSPs, and taglibs FORCE you to follow good practice and design. Its a lot harder to 'kludge' something up without still following design and OOP (granted, its still possible). Another thing I LOVE telling C++/Perl/ASP people is taglibs. No other language has anything similar. An HTML monkey, that has NO coding experience, can modify JSP's that utilize taglibs. It just produces XML that HTML monkeys view as just more HTML tags.
All in all, having a perfectly designed J2EE website (built with experienced J2EE developers) vs a perfectly designed Perl/CGI website (built with experienced Perl developers) would show that the J2EE website would be easier to maintain and the ability of non-developers to change the design of the pages without any trouble.
The only negative point of J2EE is that its MADE for large projects. If you have a small e-commerce website, J2EE is overkill, and will take too much time to write. Perl/CGI is great for this type of site. But that is where I draw the line.
Re:Isn't it time web development moved on? (Score:1)
Java, along with J2EE, JSPs, and taglibs FORCE you to follow good practice and design. Its a lot harder to 'kludge' something up without still following design and OOP (granted, its still possible). Another thing I LOVE telling C++/Perl/ASP people is taglibs. No other language has anything similar. An HTML monkey, that has NO coding experience, can modify JSP's that utilize taglibs. It just produces XML that HTML monkeys view as just more HTML tags.
I think you should go to AxKit.org [axkit.org] then and tell them they have nothing similiar :-) . It's a direct (I think) port of Cocoon from Java into Perl.
Re:Isn't it time web development moved on? (Score:1)
For a quick and dirty form or simple "database" of information perl is easiest for me. Why should I have to sit down and read through PHP stuff when I already know perl?
Re:Isn't it time web development moved on? (Score:3, Interesting)
You know, I thought exactly the same thing - I've written a LOT of perl-driven sites over the years and always considered PHP a sort of "perl for dummies" until I actually decided to use it.
Maybe the earlier versions were bad (you can see by the fact the language still has a lot of ugly constructs that it's evolving all the time), but it really is excellent for putting a dynamic site together very quickly. The huge amount of convenience functions just save so much time (yeah, ok you could have a massive library of Perl objects and functions you coud pull in to every script, but it's not going to be as fast).
Then there's the fact a designer can work on the same files as a coder without having to use templates.
It's fast too! No, not C/C++ fast, but I certainly haven't noticed any database driven sites being held back by it - and freedom from
Of course, for command-line tools I still use Perl.
Re:Isn't it time web development moved on? (Score:1)
Re:Isn't it time web development moved on? (Score:5, Insightful)
That being said (anti-flamebait!) I'm amazed you mentioned ASP, not because of of its flamebait value, but because, um, it sucks. I swear to God, there must be "if(client != "IEWin"){slow_down(); crash_unpredictably();}" in the source somewhere. Even these days, old-school Perl CGI is often the right tool for the job. Unless you're developing 100% for IEWin, IIS, and MS-SQL, ASP never is.
Re:Isn't it time web development moved on? (Score:1)
that has nothing to do with ASP at all. that's 100% in the web programmer's hands. MS-SQL is certainly no worse than MySQL, which the book advocates.
i'd rather use Apache than IIS anyday though.
Re:Isn't it time web development moved on? (Score:1)
Wasn't there comparision of Apache and IIS done last year that basically found that you should use the platform that your server software is best suited for? that is, they found that if you need to run a bizniz web server on Win32, then you should use IIS, MSSQL, ASP and friends.
They found that, from a maintenance, performance and development standpoint, running Apache on Win32 (for example) was pounding a square peg into a round hole. Note that nobody was saying "you can't run Apache on Win32", just that it was not recommended for various reasons. The number one reason was performance.
Obviously, Microsoft has plenty of access to obscure or even "secret" Win32 APIs.
Just one study, AFAIK, and I don't know how dependable the source is, but it seemed to confirm some anecdotal evidence I had accumulated.
Re:Isn't it time web development moved on? (Score:2, Informative)
Go to monster and search on perl/cgi based jobs for web work.
Now search on Java based jobs for web work.
In general,
Your general simple/small/little processing pages use perl.
Your smaller companies that require dynamic pages use ASP.
Large business that have huge enterprise sites with multiple intraweb applications run Java/J2EE.
I've had multiple jobs that required me to change a smaller webapp from perl into Java since it started small and grew into a large program and started becoming difficult to maintain.
If I had time, I'd love to take slashcode and make it into a fully J2EE website to prove, once and for all, how much of an advantage it is for large websites to change to J2EE.
Now, don't get me wrong, perl is a WONDERFUL scripting language that I use almost daily. It makes great little sites (or even large sites that don't require a huge amount of processing/code) that you need to create in a short amount of time. Just, when it comes to making a large project with funding and time, J2EE has enough advantages and features that makes the job so much nicer. Maybe I'll make a journal entry to fully argue the points back and forth.
Re:Isn't it time web development moved on? (Score:2)
I mean, when I've played with OS X programming in Obj-C, I know that Cocoa apps could be written in Eiffel or Ada or any number of other languages. But the tools don't support these languages, and the tools make things so unbelievably easy.
So is it the tools, or is the language/runtime?
Re:Isn't it time web development moved on? (Score:2)
1) Connect to a database
2) Be good at string handling
Why are strings important? Well, most stuff in web development is about strings. You interact with the DB via strings, you send the client a bunch of strings etc. Hell, even a god-awful language like Tcl can be really good for web development when you couple it with a kick-ass toolkit, like aolserver/openacs. Incidentally, aolserver/openacs and expect are the only reasons any mentally stable person agrees to learn Tcl.
Performance, on the other hand, is not that important. Most of the time you'll be waiting for the database or to push data to that guy behind a 14.4 modem anyway. What matters performance-wise is that you have some mechanism of keeping the script interpreter loaded all the time (like aolserver/mod_perl/php/java) and having persistent db connections.
So why use Java? It's not really good at handling strings, strong typing is often not necessary in web development and having to compile your code before you test it slows you down (yes, I know JPS:s are automagically compiled). As I said at the beginning of my rant, it's all about the tools. Java has _excellent_ tool support. XML stuff, web services, layered architectures (J2EE), you name it. Java has it. And all the major players in the industry are behind it, except Microsoft of course.
Java is also scalable. For the really simple site, writing a JSP page is as simple as writing a PHP/ASP page. For the high-end stuff, you can have 27 bazillion layers all cleanly separated on separate clusters costing umpteen million dollars.
Re:Isn't it time web development moved on? (Score:2)
You should try ASP.NET then. Not only is it precompiled and therefore much faster, it also is cross-browser, cross-platform friendly.
For some totally unfounded reason, I am septikal of this claim ...
Re:Isn't it time web development moved on? (Score:2)
Not necessarily true (Score:1)
Re:Not necessarily true (Score:2, Interesting)
From the site:
Re:Not necessarily true (Score:2)
Re:Not necessarily true (Score:2)
But that 'caching' layer would be in addition to what it's already doing. mod_perl is already caching compiled scripts in memory. PHP by default is not. To accurately compare the max speed available, run the accelerator from php-accelerator.co.uk on the PHP machine.
Of course speed isn't everything, but you seemed to want to make it a big factor in comparison with PHP, and I was simply pointing out the flaw with the comparison.
Re:Isn't it time web development moved on? (Score:1)
Also I think the embedded nature of PHP, while handy in simple cases, encourages people to mix up program logic and presentation.
And of course my favorite, you can't beat using the CPAN shell to install new modules.
I don't know about performance, I haven't seen benchmarks on mod_perl vs. PHP, but if you think most web apps are hindered by program runtime, you are looking in the wrong place for optimizations.
Re:Isn't it time web development moved on? (Score:1)
Have you heard of Pear DB [evolt.org]?
What is PEAR? [php.net]
Good Luck.
Better than CPAN.pm, CPANPLUS (Score:2)
Re:Isn't it time web development moved on? (Score:2)
Because it's using native drivers wherever it can and you get the best performance that way. If you WANT abstraction (and the accompanying slowdown) you can use ADODB, Metabase, PEARDB, or other projects.
Re:Isn't it time web development moved on? (Score:2)
Ever visited php.net ? the official PHP manual is one of the best manuals I've ever read.
Everything is there! Well organized and easy to find. You also have user comments which are extremely helpful.
<i>"Speaking of database calls, why is there zero abstraction in PHP?"</i>
How hard is it to code your own wrapper functions to add your own level of abstraction on top of php's DB functions? Or use one of the million classes out there already created for you?
<i>"Also I think the embedded nature of PHP, while handy in simple cases, encourages people to mix up program logic and presentation. "</i>
So you are telling me that you prefer:
#!/usr/bin/perl
$var="Hello World";
print "Content-type:text/html\n\n";
print "<html>\n";
print "<body>\n";
print "$var\n";
print "</body>\n";
print "</html>\n";
Over this?
<?php $var="Hello World"; ?>
<html>
<body>
<?php print "$var\n"; ?>
</body>
</html>
Embedded languages like php/jsp/asp PROMOTE separation of presentation and program logic!
In addition for more complex cases, it is easy create html templates to add yet another level of abstraction to your scripts/presentation.
Ask your html designers to try importing the
How about text editors that do syntax high-lighting? with <? ?> they can do syntax highlighting for both, HTML AND PHP! giving the programmer a visual of the actual separation!
So.. the embedded approach encourages people to mix up program logic with presentation? Don't think so.
Re:Isn't it time web development moved on? (Score:2)
Re:Isn't it time web development moved on? (Score:2)
If you are just comparing how short something can be and still say "Hello, world" when you view it on a browser, then I can do you one better. Step 1: Create a text file that contains the following:
Hello, world.
Step 2: Change the .txt file suffix to .html
The C++ way of writing a "Hello, World" program looks inefficient to a BASIC programmer for the same reason you are turning your nose up to Perl's CGI:pm object... the BASIC programmer doesn't yet understand the power of what he's looking at.
Re: Isn't it time web development moved on? (Score:2, Informative)
You never heard of mod_perl [apache.org], FastCGI [fastcgi.com], Embperl [apache.org], or the Template Toolkit [template-toolkit.org] if you're still talking about PERL CGI scripts, have you?
Apache and PERL is still the bleeding edge of web developement. It's just no more alone at the top. Perhaps you should take a look on these Benchmarks [chamas.com]. Especially the JSP don't look very good there and Embperl2 is usually very close to PHP regarding performance. Only Apache modules written in C are without real competitor. But you should also think about the ease of developent if you compare C code with PERL, PHP, ASP or JSP.
Re:Isn't it time web development moved on? (Score:2)
Apache and Perl was the way to go in 1996, but times have changed. Systems like PHP and (here comes the -1 Flamebait mod) ASP are faster and more efficient than Perl CGI. Serious webmasters do it in Java or C anyhow, for serious speed.
Serious Web programmer do not even mention "CGI" and "speed" in the same sentence.
Now,for some serious flamebait : PHP has always stuck me as an adequate, if somewhat anemic, Perl replacement but nothing more. It have a few very good library (PEAR and Horde), but nothing nearly as complete as CPAN. Zend is reputed very fast, but is it faster than mod_perl ? Instead of throwing half-baked opinion, please provide some hard number to back up your claim.
And what's ASP ? Is this some kind of tasty threat ? Never heard of that before ...
Re:Isn't it time web development moved on? (Score:2)
dave "or something like that."
Re:Isn't it time web development moved on? (Score:2)
Re:Isn't it time web development moved on? (Score:1)
Serious webmasters do it in Java or C anyhow, for serious speed.
If speed is your only concern for using a particular language in web development, I think you're missing ths big picture.
IMHO, the difference in speed between C/Java/Perl/PHP/ASP for web development doesn't mean squat. If you are querying a database 1,000,000 times a day for content that changes twice, you have a problem.
Pick any language you want. Who cares. When you start talking about high hit counts and high loads, more of the problem will come down to caching, push vs. pull of content, and server/cluster/network layout.
Re:Isn't it time web development moved on? (Score:1)
"Apache and Perl was the way to go in 1996, but times have changed." What?! This is the same type of fallacious argument that Microsoft uses against UNIX; "it's 30 years old, it can't be any good!"
Of course, generally, the entire reason one uses a high-level language (like Perl, or Python, or PHP, or whatever...) is because quickly putting something together is more important than lightning-fast speed. It's safe to say that web development is one of those tasks which generally benefits more from the former than the latter. With this in mind, your (unsupported claims) of Perl CGI's "efficiency" problems are irrelevant. Could we see something like benchmarks, or any kind of evidence?
Your comment about "serious" webmasters "doing it" in "Java or C" for "serious speed" strikes me as being particularly odd. Your use of the word "serious" seems quite silly; there are plenty of serious [kuro5hin.org] 'webmasters' [slashcode.com] using [apache.org] Perl [w3.org]. As for the languages you mention, almost no one uses C; that defeats the entire purpose of general web development methodology. Again, your claims are completely unsupported by any further evidence.
Personally, if I need to do any web scripting, I have my own language of choice [python.org].
Re:Isn't it time web development moved on? (Score:3, Insightful)
Perl with mod_perl is *very* fast and no slower than PHP with mod_php. Perl on it's own certainly isn't very nippy under high load, but then PHP without mod_php isnt great either, though many PHP fans don't take the time to understand the difference before determining which is better (which is understandable when you take into account that PHP is now used more than Perl by less experienced users, due to it's greater ease of use).
ASP pages (at least served by IIS) are significantly less able to cope with high load than Perl with mod_perl. IIS really strains when serving dynamic load (though it's superb at serving static content, though that's not so useful
There seems to be a big PHP bandwagon among the hip and trendy crowd these days. That's not entirely a bad thing, because (like Perl) PHP is a GoodThing(TM) but it is a when they are just repeating what everyone else is doing (which is always a bit worrying).
The most compelling arguments are that PHP is of course easier, and so on balance PHP markup is much less prone to errors than Perl scripting.
Serious webmasters do it in Java or C anyhow, for serious speed.
Sorry, but I really dispute this. Not that serious webmaster to it in Java or C, just that it's not always very quick (I'll justify that in a minute) and that there is an implication there that 'serious webmasters' work only or even mostly in Java or C which I disagree with.
If you are writing a large scale project with many developers some find it easier to keep control over the project if it's written in Java or C (over Perl) because of Perl's flexible nature (which some see as a curse when you have a large project). I can certainly see the merits of this and am a big fan of Java.
The drawback is with C is that C code takes much, much longer to write, takes longer to modify and is more prone to errors due it's complexity. Very little CGI is written in C due to this. I think that most appropriate place for C CGI's is for particular CPU or memory intensive functions who's functionality will remain relatively static over time. This way you can rapidly build flexible CGI interfaces around a very fast C program, meaning that your servers are not tied up with that function, but that you can still easily modify and adapt the front end of your site. Perl modules written in C are typically created to be used in this sort of context.
Java is excellent in that it imposes a similar strictness to C while allowing you to still comparatively rapidly produce code that is less error prone than either C or Perl (IMO), meaning it's great for development among many developers. The drawbacks are however that it still takes longer to code a solution in Java than in Perl (though it's quicker than C) and Java does not really become an option for high load situations unless you have large Sun hardware with plenty of RAM (several Gigabytes) to throw at it - though at which point it really shines.
So 'speed' is a relative term, yes certainly code in C will execute faster than in Perl, but if it takes you a month instead of a week to write, you may have just wasted 3 weeks worth of project time (and this can doom a project or kill a startup). It's much, much quicker to write and modify code in Perl (or PHP) than in Java or C (though modifying _other_peoples_ Perl can be a different story, though I've never had any problem doing that, I can see how other people do).
I once worked out timescales for a project that went like ~2 months of Perl coding or ~4 months of Java or ~6 months of C and noted the problems/advantages of each and let my manager pick one. We went with Perl (with the option to have parts in Java or C as we came across parts of the project that would benefit), even though Perl alone might struggle with the load of the task we were doing, because it was felt that Perl would easier to maintain, given that more people in the company were comfortable with Perl, Perl meant rapid development allow us to bend with typically ever changing requirements and that Perl monkeys are easier and cheaper to find (should we all leave and minion adjustments required to the software at a later stage).
As I final note I'd say that PHP certainly is quite appropriate in many situations and I don't dislike it at all, but for those with a strong Unix bent, unless they have good Perl already they might be better off doing at least a couple of projects in Perl, as Perl becomes a key 'life skill' due the fact that it can be used to write extremely useful scripts that do very complex things very quickly, so learning it is very useful.
Re:Isn't it time web development moved on? (Score:2)
And I'll back you up on this. Although you disputed it by talking about time-to-deployment, I dispute it on grounds of actual speed of page returns. I worked at Borland and built tons of apps using Perl (pre-JBuilder), then at Arzoo using JSP, and now at SST using PHP. PHP is by far faster than the rest. And there is another Web team at SST, and that team works on competing projects, and they used ASP at first, and now JSP, and they regularly come and ask how the hell we return pages so quickly. Because we're experiencing some real-world payoffs -- for example, our group is getting the new projects -- I'm sticking with PHP.
I think the biggest problem with PHP is that it is fast enough to allow us to be sloppy -- if we want to put 20 SQL queries on a page and have 15 included files, we can do it without much of a performance hit (though MySQL is crazy-fast on selects, so that deserves credit too). Back in the old days, I'd have to optimize, optimize, optimize. Maybe even drop some less necessary features because the slowdown was too much. If you really want to talk about super-slow Web apps, remember IntraBuilder. Anyone remember that? It was a Borland product with a LiveScript clone on the backend, and oh my God would it crumble under pressure. We had to use it at Borland, sort of a eat-your-own-dogfood kind of thing. But when your own employees start to hate your product and bristle at the mention of it, the product is doomed.
Web Development and the Federal Government (Score:2, Interesting)
And yet, it's still being used in the Department of Foreign Affairs as need-to-know material for our intranet site developers.
However, most of the n00bs here seem to read PHP and MySQL web development [amazon.com], by Luke Welling and Laura Thomson.
The Canadian government uses Java, XML, VB/VBA, SQL Server, and ASP, but SQL and PHP are the primary ones.
I did ask around at web development and we did in fact order copies of the new book that you reviewed though. Cool, eh?
Are books the way forward? (Score:5, Insightful)
A paper book is certainly more portable, and for most people easier on the eye, especially when you read for a long time but . .
Topical material is quickly out of date
You can't search too easily for the topic or phrase you want
You can't easily look up a reference for a term or concept you don't understand
If a certain paragraph doesn't make sense you can't look for alternative statements of the same concept
Once you've read it there isn't any easy way to look up a particular section when you next need it (the books at home, borrowed by a colleague etc)
Books cost!
Re:Are books the way forward? (Score:1)
Re:Are books the way forward? (Score:5, Insightful)
Depends on what you want to do. Online is better when you are at a computer (with net access) and know what you want to know about. Paper is better when you just want to learn something interesting. I have not yet found a good way to skim online documentation and when something catches my eye drill down deep. Scrolling doesn't seem to work that way for some reason. An index is worse, it doesn't tell you if something is useful, so you have to look, which means wait for page loading times. After a few misses you give up.
Both types have their place. I wouldn't want to be without my printer, even though I haven't turned it on in several weeks. There will never be a paperless office because when the problem gets really tough I print out everything, and then (as Fred Brooks said) take to the floor to figgure things out. Don't try to get rid of paper, use both paper and the computer to compliment each other.
Re:Are books the way forward? (Score:2)
Really.
No page load times, the document is on your hard drive. It has good indexing and its hierarchial structure makes "drilling down deep" easy. And if you want, just throw the source document to TeX for the printout.
Re:Are books the way forward? (Score:1)
I think that's why things that are generally at a higher-level (as the review says this book is) tend to be much better, and have a longer shelf-life, than the typical programming book. At the same time, I find it to be helpful to get particular books to build my own basis for a particular language or application, and then find more detailed and up-to-date information from there. Of course, I have about 6 boxes of computer books (mostly programming, some administration) sitting in my room waiting to be unpacked after moving across the country about a month ago.
As another poster pointed out, though, the ebooks that are packed on the CD with more and more of the new books are great, especially when you don't want to lug a 900 page book around (or worse, 3 or 4 of them, as I have a tendency to read on multiple things at a time to keep from getting bored with a particular subject).
Re:Are books the way forward? (Score:3, Insightful)
For one, Subways, busses, trains, airplanes, sidewalks, and doctors offices.
Two, it's always better to have a paperback copy of documentation when fixing a computer. Even if you have another computer around (and you should), paperbacks still leave smaller holes in the wall.
Three, when you are done with it you can loan it to a colleague. I've worked with enough clueless people to know that a little education can go a long way in smoothing a long term working relationship.
Likewise, many of the supposed advantages proported of HTML are not so, namely timeliness and loanability. For some reason it seems to take as much cost to keep a site up to date after two years (or so) as it did to create the thing in the first place. Why would the publisher plunk down the coin to keep the site current? If they are going to recieve payment for updated versions of the html book, how is that any different from buying a dead-tree edition? And how, exactly, can you loan out a html book with the publisher's blessing? I understand that in HTML you can just page through and download the bloody thing, but... That seems like a lot more trouble than figuring out who you loaned your book to.
And furthermore, if you are at a computer you can look up concepts you don't understand without any trouble. The portability of white pulp doesn't preclude reading it at a computer. And when Mozilla / IE / Netscape / AOL / ICab / Opera / Lynx / Konqueror crashes your system, your paperback will still be running fine and you will still know what you were looking up. (Opera, BTW, automatically saves the windows you have open, allowing you to painlessly resume after crashes).
I don't think, in the current state, that searching and easy dissemination outweigh portability, ease-of-reading, and loanability in this circumstance.
Dead tree technology has been around for three thousand years. Three thousand years of R and D is a lot of engineering. Let's not be so quick to abandon that power, eigh?
-Chris
Re:Are books the way forward? (Score:2)
For a through analysis of the abstract concepts, no.
1) A good book that deals with the real problems ("web development" in this case) will stay up to date for as long as the problem is. The implementation details are incidental to the real value of the book.
Half of my web development books are obsolete, they use Tomcat 3.x/JSP 1.0/Servlets 1.x code and examples, and things have changed dramatically in that area.
Yet those are the same ones I actually use, because I'm not consulting books about APIs or specs, I'm reading books about software development.
A better example is perhaps "Design Patterns". I consider it a book that NEEDS to be skimmed over; that's how you read and use it. No single line of code has helped me in that book so far, but I consider it invaluable.
From what I remember of "The Art of Computer Programming", it's technologically irrelevant and obsolete, yet many consider it's invaluable to help understand technology because Itanium-assembler code is not the issue.
2) To most people a monitor is an inferior surface to read, and even for some who are comfortable with it (like me) it's just not as flexible as a book: we have learned to detect patterns over multiple pages, even multiple chapters, and we haven't learned to do it with the scroll bar. For some reason, we seem to be more efficient with 3-4 open books on our desk than 3-4 books on our "desktop", sharing psychological space with our software applications.
This could be solved with electronic paper, but many still feel the need for paper books.
While software makes it easier to look for things you already know you're looking for, in ways software is good at looking for, paper still lets humans do the kind of searching they are best at: browsing through the unknown.
3) You can look in a book for an alternative statement of the same concept.
It's called an "index", it's normally at the end of the page, and it tells you where the concept is mentioned/explained/used.
Hyperlinks are nothing more than the bastard child and logical extension of indexes and references. That's what makes them so insanely useful.
Now, if you mean you can't look for alternative statements by doing a search in Google, well, that's called research. It's been done ever since there were books, and it's the reason why the Dewey system was such a big deal back then.
Conclusion:
Electronic text is more convenient for some things (directed searches, instant references, etc) but it still doesn't offer some important advantages of the paper-world.
Besides cost, there is no logical reason, however, not to have both versions of the text in a newly produced text.
Even the most generalized, theory-oriented book would benefit from hyperlinking and searchable text, and some updated material. Providing both versions is the sensible solution.
But assuming that costs restrict the publication to only one kind of media, there are books better suited to e-text (most O'reilly books, essentially technical manuals) and there are books better suited to paper (a good Data Structures or Software Engineering book).
I guess it depends on whether you're meant to read the book, or to "consult" it.
Amazon has lots of sample pages (Score:5, Informative)
No Discussion of XSLT? (Score:5, Interesting)
It's a real missed opportunity if this book doesn't also talk about using XSLT as a way to separate content from presentation - especially as the Apache project has its own XSLT engine, Xalan, available in both C++ and Java.
A quick HOWTO on wiring that gear into an Apache configuration would be really useful.
Re:No Discussion of XSLT? (Score:1)
Actually there is a section in that chapter about XML technologies. It mentions AxKit [axkit.org] in particular.
Re:No Discussion of XSLT? (Score:3, Informative)
print "<html>\n";
print "<head>\n";
print "<title>\n";
No wonder so many people think Perl is obsolete as a web development tool. This is a hideous way to do things. Anything but the most trivial HTML produced in this way will be very difficult for a programmer to maintain - let alone a web designer.
Here is a short tutorial I recently wrote on separating content from presentation using HTML templates with Perl.
http://www.calypteanna.com/templates.html [calypteanna.com]
Re:No Discussion of XSLT? (Score:1)
Interesting article. But Im'm interested why you invented your own templating system instead of using one of the ones aready available for Perl, like HTML::Template, HTML::Mason or the Template Toolkit.
The <<$secret_number>> Pattern is born (Score:2)
Stinky Cheese Man: Here is a short tutorial I recently wrote on separating content from presentation using HTML templates with Perl. http://www.calypteanna.com/templates.html
ARF! I hope you are joking. That you got modded up for implementing Model-View-Controller using $MAGIC_NUMBER is the funniest thing I've seen all week.
Re:No Discussion of XSLT? (Score:2)
print <<EOT
<body>hello $yourname;
EOT
;
I think every web developer ends up inventing their own template engine sometime in their professional lives. Most who know anything about the industry already know they're reinvented the wheel, and that it was a learning process, or that it had to be small and self-contained and therefore not use an external lib (my rationale for one that I wrote) and not something terribly revolutionary. I'm not saying you're that naive, but the posts to freshmeat I keep seeing for Yet Another Template Based Content Management System seem to indicate that not everyone has gotten the message.
If you want a perl template system that's mature, use something like TT2 [template-toolkit.org]. A simple CMS in TT2 was something like 20 lines of mod_perl code and a couple template files.
Re:No Discussion of XSLT? (Score:2)
blah.cgi
#!/usr/bin/perl
DBConnect();
# do all the SQL stuff here. No HTML in CGI
$SQL = qq[SELECT
do "inc/blah.inc"
DBDisconnect();
exit(0);
.. and inc/blah.inc contains:
print qq[Content/type: text/html
<html>
<head>
</head>
<body>
</body>
</html>
];
Good documents on security (Score:1, Informative)
not to be too flamey (Score:2)
Im currently engaged in trying to update someone else's perl web application and the five hairs i have left are screaming for me to just ditch it all and reimplement in php. It just *seems* more web oriented, perl tries to be many things to many people, while php is all web all the time. I think this shows in the fundemental design of the languages.
Re:not to be too flamey (Score:2)
i would like to hear some sensable (non religous) reasons that post-1998 php would not be the default open source web application development platform
Because mod_perl using some sort of templating is sooooo much nicer than PHP. PHP makes it a pain to separate code from presentation. Yes, people do do it, and there are templating php modules available, but none as nice as the perl offerings (Template Toolkit, HTML::Template, etc). Perl is also just a funner language to write in than php. You can do about everything in php you can do in perl, but it just doesn't feel right (doing re's in php makes me want to vomit, calling those stupid preg_match() functions and stuff). I maintain two semi-complex web-sites that I had originally written in php, but moved to mod_perl because it's so much nicer to write in. And according to my benchmarking, the mod_perl sites are as fast or faster.
Re:not to be too flamey (Score:3, Informative)
When doing a full evaluation I'd like to have a look at all the options. People looking at Perl tend to overlook some of the support systems in it which allow you to produce a more structured application and tend to try and reinvent their own systems. This is bad, and is where people who haven't stopped to think about what they're doing get their misconceptions.
For example I suggest you have a look at the Tempalte Toolkit [tt2.org] language that allows you to use a simple templating system to write directly in HTML and then call to pure Perl plugins when you need the power - and the ability to use existing modules off of CPAN. Slashdot uses the Template Toolkit to do some of it's templates.
Another system that someone sensible would look at is the AxKit [axkit.org] system. AxKit is Apache Foundation project similar to Java's Cacoon system that allows you to use XSP and XSLT and other buzzword friendly XML systems to do dynamic transformation of XML with perl taglibs as you need it. What's PHP's way of dealing with XML? Can you write XSLT stuff in it? Can you use XPath, SAX and all that to process document pipelines? What's the framework like to work with? Honestly, I'd like to know - I haven't looked into it at all.
On a simplier note, you might want to look at some of the very simple web application frame works, for example CGI::Application (which despite it's name will run very fast under mod_perl.)
Finally, I'm not sure how easy it is to test PHP. Perl has quite a powerful set of testing tools that you can use to easily determine if each bit of your code is working correctly...I'd be really interested if someone could post a discussion of what PHP has to offer in this area.
I can understand how someone else's web application could seem terrible....but I've seen terrible php too! But it's unfair to blame the language for a particlar code example - I congratulate you on your sensible decision to examine the options properly.
Re:not to be too flamey (Score:2)
At Devshed.com:
Using PHP with XML (part 1)
http://www.devshed.com/Server_Side/XML/XMLwit
Using PHP with XML (part 2)
http://www.devshed.com/Server_Side/XML/XMLwit
Disclaimer: I have not used XML with PHP before. I just remembered seeing these tutorials when I read the parent post.
Re:not to be too flamey (Score:2)
I was wondering if anyone knew anything more about XML frameworks for PHP. In Perl, undef AxKit (and in Java, under Cacoon) you don't have to go though all this file opening and closing stuff that's covered in the article - rather the framework knows (thought the httpd.conf) what filters to send each XML 'document' (object tree, SAX stream, etc, etc) to convert it to the right thing.
Re:not to be too flamey (Score:2)
PHP is more "easy-come-easy-go". You get in, learn, use it, but feel no real loss when some other new-fangled paradigm or language comes along and all the PHB's want you to use that lang instead.
Plus, there are less ways for bored programmers to make mince-meat out of PHP. There are no serious obfusication contests for it, so nobody will be training for it on production code.
(I just wish they would add named parameters to PHP. I miss those.)
Re:not to be too flamey (Score:2)
This is one of the reasons I suggest things like the Template Toolkit - for simple things like loading other templates in, doing calculations, itterating over lists, etc, etc, it's really simple. It's designed that way. It's really got that easy come easy go quality that you were looking for.
Of course, if you need the power of a fully fledged language you can use a plugin - or better you can get someone else to write the plugin for you (which in my experience normally means creating a interface for an existing module so you can easily use it how you want from within the template.)
Re:not to be too flamey (Score:1)
Anyway, here's my list of why you should consider mod_perl more "web-oriented" than PHP.
Swing on over to the mod_perl Cookbook [modperlcookbook.org] site or the main mod_perl site [apache.org] for many reasons why you should consider this great technology.
(note I co-authored the cookbook above. But I've used mod_perl professionally for quite some time and have compared it to other, more lacking environments and whole-heartedly recommend it.)
Re:not to be too flamey (Score:3, Interesting)
I really tried to like PHP. It has somewhat more "regular" syntax than perl, lacking most of the awful @$% decoration of variables and such. I launched into creating this monstrously nifty CMS system in PHP, very OO in the internals, very extendable...
Then I learned that PHP passes all objects by value. There is a pass by reference syntax, I just had no idea that this was the required default for objects. Fine, ok, it looks kinda like perl, but it's not perl, I can accept this. Then I learn that PHP has no facility to distinguish objects by identity. Now I need to generate a unique ID on every object. I went to Zeev himself to address this problem, and the man had to be taught the concept of object identity (what eq gets you in lisp and a pointer compare gets you in C, basically). He then proceeded to dismiss out of hand the entire concept, and went and suggested a === operator that actually did the polar opposite of what it is supposed to do, resulting in more expensive comparison (still by value mind you) than any other comparison operator. Zeev said "PHP is not an object oriented language" (direct quote).
I asked for a facility to disable certain functions at runtime -- I needed to run them first, then in the same process, disallow them from being run again (since it could take arbitrary user code that would be fine so long as it didn't touch the filesystem or open sockets). Actually I had it able to override built-in functions, but all I really cared about was being able to disable them. Offered sample code. Refused. The rationale was that the idea was too dangerous, that people could hang themselves with it. I pointed out my failure to grasp how deliberate disabling of functionality opened up any problem areas. Silence.
I asked at one point whether PHP had the intent of achieving a broader focus beyond the web. The response was "no, php is a web language". Perl not only tries to be many things to many people, it *is*. PHP itself has a nice bazaar culture of development, but the Zend virtual machine is absolutely a cathedral. I can't in good faith use a language that has been crippled, in ways that affect me directly, and has been deliberately left so in order to effect some sense of parsimony. This is "why PHP is not my favorite language" (one of those euphimistic forms going around, like "___ considered harmful")
Re:not to be too flamey (Score:2)
It's not, though it has OO support tagged on. If I need to write a complex app that needs a high level of OO I use Java. For 99% of my PHP needs though the basic OO in PHP sufices.
I asked at one point whether PHP had the intent of achieving a broader focus beyond the web. The response was "no, php is a web language".
You say that as though it's a bad thing. I like the idea that it's focussed. It does its job and it does it well.
Perl not only tries to be many things to many people, it *is*.
Including being a real pain in the ass?
I can't in good faith use a language that has been crippled, in ways that affect me directly, and has been deliberately left so in order to effect some sense of parsimony.
You mean you are pissed off that the language hasn't been warped to suit your needs but stayed within what the majority of its users want? Did it occur to you that perhaps PHP wasn't the appropriate tool for the job?
This is "why PHP is not my favorite language"
That's only half the sentence. The other half is "for web development", which is what we are discussing here. PHP is a tool that suits a purpose, as is Perl, Java, Python, etc. Perhaps you should analyse the problem then choose the language rather than the other way around?
Phillip.
Re:not to be too flamey (Score:2)
I don't know why you felt compelled to reply to my anecdote in such a fashion. I'm not really trashing PHP the language, but merely pointing out my rather negative experience in trying to engage in productive dialogue with the makers of the virtual machine it runs on. Frankly I think you just wanted to get your digs in.
Re:not to be too flamey (Score:2)
The (admittedly few) Java projects we've done *required* more time to create/implement, and not because of the size of the project, but because of the language itself, when compared to developing equivalent functionality in Perl or PHP.
The arguments (Score:3, Insightful)
Could you _please_ share some of them with us? Because I'm really sick & tired of the same old "Anyone can change the source and fix the bugs" argument. Sooner or later people will have to realise, that the companies we want to convince switching to linux is a good idea, couldn't care less about the ability to change the source. Some of them even get turned off by this argument, since they believe it contans an implicit "You will have to change the buggy code yourself", just like when you're buying a house and the ad says it's perfect for a creative, DIY-type person - and you know you'll have to replace the roof, the walls and the floors within 2 weeks.
Re:The arguments (Score:1)
Re:Meow! (Score:1)
Re:The arguments (Score:1)
Also because of the large developer base for most Open Source Projects the software produced tends to be of a higher quality. I'm not saying this is true of all Open Source software, but there seems to be a very high correlation.
Re:The arguments (Score:2)
But that cuts both ways. The house you sited is attractive to the can't stop handy person who wants to buy a house, fix it, and sell it at a big profit a few years latter. Doubling your moneyin two years is not unusual on a house like this. (note, if you hire the work done you fall behind, but if you do it yourself, and live there you come out ahead when you consider the rent you would pay otherwise, and you have to love working on houses).
The advantage of openSource is you can, but don't have to modify it. Instead of dropping the statement entirely, we should drop the "and fix the bugs" part. When you use a closed source program you are at the mercy of your vender to get new features. If you want X, and they say it won't sell enough to be worth it, then you are stuck. With open source you can do it yourself if you have to.
Re:The arguments (Score:1)
Re:The arguments (Score:2)
Which means that, as any good real state agent knows, insisting with the same pitch is not likely to convince them to change their nature to adapt to the house.
Source == Instructions (Score:2)
I use source as a "manual" all the time. It's the definitive guide, and when you really have to know how something works (or you want to create a quick work-around, or do something the software was never intended to do) the best way is to take a look at how the thing is built. In fact, it's become annoying when I don't have the ability to see the source code, I'm so used to being able to see it.
Here's a real-life, recent example of where having source would have made my life easier. I had to design a tool that would export data from Steltor's CorporateTime calendaring system. I was making XML of all the events based on certain criteria, and arranging everything in cronological order. The CorporateTime API uses as a timestamp a 7 digit value, and all data is tagged with this number as representing when the data was created. Trouble is, what does the number mean? How do I take this number and translate it into April 3rd, 2002?
After some fiddling around, I figured out what he number meant. It's the number of minutes an event occurred past CorporateTime's epoch, which is midnight on 1/1/1990. Instead of having to waste time "decoding" this as coming from a blackbox (there was no information in any manual, web site or documentation about this value other than it existed and was a timestamp), I would have loved to go looking through the source code to find out what they were talking about. The only place this value is documented is in the source, and it was frustrating not to be able to see it.
Don't always think of having source code as being able to change that code. Think of it as (at least) a way to see inside the minds of the developers who wrote the application. That's a valuable thing, for any kind of organization.
-B
Re:The arguments (Score:2)
Basically, *you* (a company) may not have the interest in hacking the source, but some of your developers probably will. A house is actually a perfect analogy. No, no one wants to buy a house where they *have* to replace everything, but if I had a nickel for every time I've said "I wish we could paint the walls in this apartment to something not glaring white", I'd have enough to buy the paint.
Re:The arguments (Score:3, Insightful)
That's fine, but if you haven't seen other arguments, you haven't been looking very hard.
1) The code is auditable. Individuals might find little value in this (although some really do), corporations and governments can fund a few people to look for trojans, back doors, or spyware, or even just to check for overall quality or functionality. This gives people and organizations an extra tool in their risk-mitigation toolbox. A real world example is Sun Microsystems' adoption of GNOME for Solaris. Could Sun be as sure that GNOME met their needs had the source been closed to them? Probably not. Has Sun found ways to "pay for" GNOME? Absolutely. They don't hide the fact that GNOME is Open Source, and they have contributed back to the project. There is a pretty good chance that people using GNOME on Linux or FreeBSD have benefitted somewhat from Sun's work.
2) The developers' motives are different. Why is it that OpenOffice.org uses an easy to work with documented native file format? Why have binary configuration files not appeared in the
3) Open Source software lasts longer and is more stable (in a configuration-management mindset). If I install a Linux distribution today, there will always be an upgrade and maintenance path independent of any corporation. Linux has long since reached a threshold, where it can never go away. Many Open Source applications are like this, too. Emacs will still be here in ten years, as will GCC and XFree86, for example. An Open Source system almost never ceases to be useful. An executable is corrupted? Just recompile it. Discover a previously unknown bug? Contact the authors directly and talk about it. You need to collect data from old files? Unpack-n-grep.
4) Open Source software lasts longer and is more stable (from a robustness point of view). Many Open Source applications are so mature that people take their stability for granted. How often does Emacs fail due to flaws in its code? Under normal use, almost never (the last time I saw Emacs crash was years ago). The same is true for Apache, GCC, XFree86, and the Linux kernel. While there is a huge pool of Open Source projects that are not this mature, it is a normal process for the occasional super-star to emerge and become best-of-breed in its category.
Now, how much of all this is true of Microsoft and their products?
Re:The arguments (Score:2)
Preaching to the choir (Score:2)
However, "things are getting better" is an argument for the convinced. If anything, it's an apology on the eyes of someone who's considering the switch, but has not made the decision.
Re:The arguments (Score:2)
Don't ask me how I am typing this while sitting on my hands.
Control is in MY hands (Score:2)
2. 0.9%: Read only source is the ultimate documentation. If there is some weird config file question, or I wonder about exactly how it manages a session, or exactly what happens if
3. 0.1%: Writable source means I can edit it, add features, change features, fix bugs -- if I want to / have to. I can also pay someone else if necessary.
To sum it up:
6. 100.0%: I retain control. No vendor has a lock on me. I am not dependent on someone else's lawyers, business plans, competitors, you name it. I retain control.
Web resource for perl / cgi newbies (Score:2)
http://www.kilgallonfamily.com/perlhappypath/in
It is about 8 months out of date, but is VERY simple and straightforward. Perfect for a newbie. It walks you through just about all the basics, and is designed to keep a new and inexperienced student motivated and excited about what they are doing.
I taught it several times, and it works well in a classroom. It is released under the GPL.
Bill
Re:Web resource for perl / cgi newbies (Score:2)
http://www.kilgallonfamily.com/perlhappypath/
ohh no (Score:1)
Why Perl (Score:5, Insightful)
I wanted to do innovative, creative stuff, so I started writing Perl.
No regrets. I don't think that aspect of Perl has been particularly usurped. Nor do I think there's another language which provides a platform for faster time-to-market and feature iteration.
As mentioned elsewhere on this thread, and Java and PHP have their own distinct advantages also.
--LP
Perl is very useful (Score:2, Insightful)
Perl & Apache is an excellent combination for bringing sanity to legacy systems.
As far as dealing with legacy systems, nothing is better than Perl. For example, in a project I'm working on, in my company there is a vast array of legacy tools which require using telnet to get the work done. And the web interface I'm building (CGI & Net::Telnet) get's the work done beautifily. (Try doing this in PHP or Java.) The admin people are happy, and the development time so far has been almost negligible. Perl is the supreme glue language.
Re:Perl is very useful (Score:2)
Not that I have tried so far, but I don't see what the great difficulty would be: interface code would be trivial, client code would be not too difficult either. There are more than a few Telnet classes out there if you don't want to deal with the raw Socket class yourself.
Now, whether the development time would be "negligible" or not, is another matter. For a Servlet-based application, it could very well be.
Web Developer Books (Score:2)
For the Perl/Java tech argument. Well designed java pages can be just as fast, or faster then poor perl cgi's, and vis versa. I too have seen very slow JSP/servlet's. JSP's should not be programmed the same way as a language like PHP or perl in many cases, it will be slow. Perl ranks third for me, but not totally off the charts.
I for one would argue JSP based development makes more sense for most sites, due to development productivity, and language functionality. And as I said before, a well design Java site can execute as fast or faster than some perl CGI sites. PHP ranks right behind JSP's in my mind, since they don't provide as much functionality, although they are very fast for simple things.
Perl should be a tool in your developer's toolbox, although I believe PHP or JSP's are in most cases a better tool for the job of making dynamic web sites.
-Pete
How about (Score:2)
perl is not how to run a website (Score:2)
If you're going to flame (Score:2)
any website coded by perl 1337 hackers who spent more time reading slashdot than studying CS is doomed to become an unmaintainable mess. look for programmers whose code is better designed for web use or at least maintainability (be it in perl, php, python, etc).
There you go.
my review of the Stein book (Score:2)
Danny.
Re:If (Score:2)
>we really need shit like this pointed out?
Do you see the market share Windows has? While it isn't right for everyone, there are a lot of people who ARE right for open source but don't know it yet.
Re:The problem with this book (Score:1)
Re:MySql over Postgres? perl over php? (Score:2)
Hey, someone writing a book has to make these choices. If you don't like them, write your own book based on your preferences. You prefer php to perl? Then don't buy this book!