×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

PHP In Action: Objects, Design, Agility

samzenpus posted more than 6 years ago | from the read-all-about-it dept.

Book Reviews 232

Michael J. Ross writes "Despite being perhaps the most popular Web language in use, PHP has for much of its history been criticized for not offering the full capabilities of object-oriented programming (OOP). But with the release of version 5, PHP introduced a robust object model, and made it easier for its proponents to create well-architected Web sites and applications. In turn, the new OOP capabilities have facilitated additional best practices, such as design patterns, test-driven development, continual refactoring, and HTML templates. These topics and more are explored in the book PHP in Action: Objects, Design, Agility."Authored by Dagfinn Reiersøl, with Marcus Baker and Chris Shiflett, the book was published on 3 July 2007 by Manning Publications, under the ISBNs 1932394753 and 978-1932394757. Its subtitle accurately reflects the major themes of the work: creating PHP applications built upon objects, utilizing Web-oriented design patterns, and incorporating agile programming techniques such as refactoring and test-driven development. Also covered are methods for effective form handling, database extraction, date and time representation, and more.

As a result of trying to adequately cover such a large number of major topics in a single book, the amount of material is considerable, and the book is certainly longer than the typical Web programming book in general, and PHP book in particular. Spanning 552 pages, the material is organized into 21 chapters, grouped into four parts: In Part 1 ("Tools and concepts"), the authors discuss PHP 5, its strengths and weaknesses, and how well it can be used with advanced programming principles; an overview of objects, exception handling, and references; visibility, abstract classes, and interfaces; effective use of classes and object-oriented design; inheritance, composition, and more on interfaces; advanced object-oriented principles; six design patterns that are especially appropriate for Web-based systems (Strategy, Adapter, Decorator, Null Object, Iterator, and Composite); and lastly, date and time handling using objects.

For developers well-versed in OOP, Part 1 may be more of a review, while Part 2 ("Testing and refactoring") could be the most valuable portion of the book. In the four chapters, the authors dig into the details of test-driven programming, refactoring, and Web testing. These chapters and all that follow take a very pragmatic approach to conveying ideas, which is consistent with the theme of Manning's "In Action" series, based upon the idea that programmers tend to learn best by reading sample code instead of generic discussion. For instance, test-driven development (TDD) is demonstrated by showing how to implement database transactions, a contact manager, and e-mail functionality. Mock objects and top-down testing are illustrated through the creation of an e-mail class, and further extended with a discussion of faking the mail server. Given that testing is the primary theme of the entire part, one might expect a more lengthy discussion of TDD, but Reiersøl correctly notes that this particular book is not trying to replace the many manuscripts and articles already published on agile development; also, the database examples adequately demonstrate the general principles discussed prior. The chapter on refactoring is well worth reading, and touches upon the controversial topic of how much one's PHP code should be separated from the HTML code — a topic later revisited in the chapter on templates. Also explored is a topic critical to maintenance programmers — refactoring versus rewriting. Two different testing frameworks are discussed, PHPUnit and SimpleTest; the latter is used throughout the book. The final chapter in this part explains how to test Web pages programmatically, by faking interaction, and other techniques. The chapter ends with a section providing steps on how to deal with "the horror of legacy code," when the unfortunate programmer has inherited a nightmare of a live Web site.

The third part of the book, "Building the web interface," begins with an examination of templates, the arguments for and against them, and three of the most commonly used template engines: Smarty, PHPTAL, and XSLT. One of the previously discussed design patterns, Composite, is utilized for combining templates to create complex Web pages. The chapter on user interaction makes use of the Model-View-Controller architecture, with the subsequent chapter delving deeper into the topic of controllers for Web pages. The next two chapters cover an area of site development that is a frequent cause of uncertainty, "bandage coding," and security risks: user forms and input validation. The book's coverage of the PEAR package HTML_QuickForm, alone makes it worth reading. Part 3 concludes with a chapter on abstracting database resources through objects and the Singleton pattern.

The fourth and last part of the book ("Databases and infrastructure") is relatively brief, comprising two chapters on marrying SQL with object orientation. The authors present a number of techniques for shoehorning SQL transactions into object-based code, including encapsulating queries inside of methods, building SQL statements dynamically, substituting SQL elements such as column and table names, using SQL aliases, and using SqlGenerator.

It is clear that the lead author, Dagfinn Reiersøl, has put a tremendous amount of time (three years, as noted in the preface) and effort into creating this work. The discussions are wide-ranging and in-depth, and there is just enough sample code to illustrate the ideas being discussed and also break up the visual monotony. The illustrations are limited in number, and consist mostly of class diagrams and UML sequence diagrams. Overall, the treatment of each topic clearly reveals that he has considerable experience with them, and has given thought to the pros and cons of some possible approaches, though not all of them.

However, there are still some weaknesses in the book. For example, in all of the material discussing how to separate the SQL code from the PHP code, I found no mention of stored procedures, such as those made possible in MySQL. All of the sample code appeared to be solid, though there was no clear reason for the inconsistent use of print() versus echo() is different code samples. All of the chapter summaries could be excised without any loss of value, and many of the chapter introductions could be eliminated as well or condensed.

On a more mechanical level, the book had many minor weaknesses: It was not encouraging to see the first erratum even before reaching page 1: "raising own level" on page xix, in the second paragraph. Readers may initially be confused by such attributions as "Uncle Bob [Uncle Bob]" (on page 77). In a future edition, it should be explained that names in square brackets are biographical references listed in the Resources section, which follows Appendix B. In the first sentence in Chapter 12, the reference to "Jackass" will probably be confusing to many readers — particularly non-Americans — and is not in the best of taste. In the text and the table of contents, the chapter and part titles are written in sentence case, instead of title case, for no obvious reason. It is not clear whether this is meant as an unsuccessful attempt at literary hipness, or just an unfortunate reflection of the current text messaging generation, which is eschewing rules of grammar that for centuries have made text easier to read. Finally, there was one problem in the production of the book, and not its writing: Several of the pages had light brown spots on them that were apparently part of the paper, and not a result of post-production staining. But these may be limited to my particular (brand-new) copy of the book.

Readers interested in learning more about the book could start at the publisher's Web page, which features an online table of contents and index, all of the book's source code, two sample chapters (7 and 21) in PDF format, and a link for purchasing the electronic version of the book, also as a PDF file. Any road/code warriors who do development on their laptops, on the go, will appreciate having this book readily available.

Yet most of these objections are minor and easily fixable, and do not detract from the value of this book. I especially liked the depth of experience brought to each topic, and the authors' consideration of differing viewpoints. PHP in Action is a competent, engaging, and detailed discussion of object-oriented and agile programming principles that can help PHP developers boost their effectiveness and the quality of their code.

Michael J. Ross is a Web developer, writer, and freelance editor.

You can purchase PHP in Action: Objects, Design, Agility from amazon.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

cancel ×
This is a preview of your comment

No Comment Title Entered

Anonymous Coward 1 minute ago

No Comment Entered

232 comments

3.... 2.....1.... (5, Funny)

wellingtonsteve (892855) | more than 6 years ago | (#22156930)

Cue the PHP vs Every Other Language debate..

Re:3.... 2.....1.... (2, Funny)

Anonymous Coward | more than 6 years ago | (#22157072)

Visual Basic is so much better than PHP.

Discuss.

Re:3.... 2.....1.... (3, Funny)

Anonymous Coward | more than 6 years ago | (#22157138)

I do all my scripting in Logo.

Re:3.... 2.....1.... (1)

wellingtonsteve (892855) | more than 6 years ago | (#22157198)

Personally I favour Haskell for web development

Re:3.... 2.....1.... (0)

Anonymous Coward | more than 6 years ago | (#22157314)

Visual Basic is so much better than PHP.

Discuss.
VB:
Const visualBasicIsSoMuchBetterThanPhp as Boolean = True

PHP:
define("visualBasicIsSoMuchBetterThanPhp", True);

Conclusion reached: VB is indeed better. Thanks for your attention.

Re:3.... 2.....1.... (0)

Anonymous Coward | more than 6 years ago | (#22157378)

And VB is so multi platform too. That is why it's the best. It's not named Visual Beginners All-Purpose Symbolic Instruction Code for nothing.

Re:3.... 2.....1.... (2, Informative)

gambolt (1146363) | more than 6 years ago | (#22157640)

I've been playing with Keppler, a Lua web stack. It's surprisingly robust for how easy it is to get started with.

http://www.keplerproject.org/wiki/US/HomePage [keplerproject.org]

Re:3.... 2.....1.... (0)

Anonymous Coward | more than 6 years ago | (#22157810)

The Kepler folks sure are doing a fine job keeping anyone from using their framework due to the complete lack of any documentation or examples.

Re:3.... 2.....1.... (0)

Anonymous Coward | more than 6 years ago | (#22157992)

The problem with lua is that every minor version has it's own syntax and ABI. If you choose lua 5.x, you're pretty much stuck with that version. I did a simple lua sendfile binding in C that broke when I went from lua 5.0 - 5.1, IIRC the module loading changed too. Nekovm and Haxe or even parrot are better real world choices for web development.

If I was looking to embed a language runtime, luaJIT would win.

Re:3.... 2.....1.... (0)

Anonymous Coward | more than 6 years ago | (#22158098)

PHP in Action: bugs, tears, sleepless sysadmins

Re:3.... 2.....1.... (2, Insightful)

Anonymous Coward | more than 6 years ago | (#22158960)

For all the criticisms about PHP, I won't bite the hand that feeds me. It's widely available, easy to work with, in demand, and best of all, FOSS. I'm a businessman and a web designer, not a computer scientist. I think that anyone who gripes about PHP's shortcomings is just wasting their breath: It's not going away, it's been used for very large sites (see Facebook, Wikipedia, GoDaddy, etc.), and most of us find it to be a really great tool. It's not as though PHP gets in the way of developing with [insert language here].

PHP is For Newbs (1, Funny)

Anonymous Coward | more than 6 years ago | (#22156950)

J/K. Programming bigots are all wankers in my book.

Programming bigots are wankers and morons (-1, Troll)

Anonymous Coward | more than 6 years ago | (#22157036)

Blows the mind.
It's one thing to justifiably hate niggers and so on and so forth, but to discriminate against programming languages is both immoral and insane.

Next release PHP will support ideas from 70s! (0)

Anonymous Coward | more than 6 years ago | (#22156986)

In another 5 years we'll be able to run neural nets on PHP!

Re:Next release PHP will support ideas from 70s! (1)

ryanscottjones (851460) | more than 6 years ago | (#22157870)

In another 5 years we'll be able to run neural nets on PHP!
What's stopping you from doing that now?

NIGGERS in action: robbing, stealing, killing (-1, Troll)

Anonymous Coward | more than 6 years ago | (#22156990)

They're a menace. Nigger review over.

Ron Paul, MD

REST IN PEACE HEATH LEDGER (-1, Flamebait)

Anonymous Coward | more than 6 years ago | (#22157012)

Buttfucker extraordinaire.

Slashdot allowing plain old advertisements now? (1)

rgagnon (1123029) | more than 6 years ago | (#22157022)

What a nice ad for a book. How'd this get past the firehose spam filtereing mods?

Re:Slashdot allowing plain old advertisements now? (1)

TheSpoom (715771) | more than 6 years ago | (#22157056)

Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
And they have since I remember joining.

There are stories here that make you wonder, but IMHO this isn't one of them.

Slashvertisements (-1, Flamebait)

Anonymous Coward | more than 6 years ago | (#22157100)

I realise that Slashdot allows you to submit your own book reviews.
I have a book I'm writing about niggers which I'd like someone to review. Contact me at ronpaul2008.com.

Dr. Ron Paul

Re:Slashvertisements (-1, Offtopic)

Anonymous Coward | more than 6 years ago | (#22158154)

Finally, some one speaks the truth about Dr. Paul.

Looks like a great book if you're stuck with PHP (5, Informative)

bigtrike (904535) | more than 6 years ago | (#22157212)

This looks like a great book for those of us already stuck with PHP. For the rest, I'd suggest avoiding it entirely. PHP 5's OOP is still pretty awful and still has many caveats which have simply never existed in other languages. For example, the exception handling is pretty useless as it generates "Fatal error: Exception thrown without a stack frame in Unknown on line 0" when used in a number of contexts.

Stuck? (2, Insightful)

AutopsyReport (856852) | more than 6 years ago | (#22157414)

Get over it. PHP is not perfect, but it does a damn good job. If it didn't, it wouldn't be so widely used. You can respectfully disagree, but try to maintain some civility here instead of suggesting we all just avoid PHP as if it's some kind of curse. There isn't a tool in the world that doesn't have it's flaws.

I've been using PHP for eight years and there hasn't been a day where I wished I had chosen another language. Sure, I wish the PHP of today was available eight years ago, but I can't complain with what is available now.

I've said it before and I'll say it again: (3, Funny)

Anonymous Coward | more than 6 years ago | (#22157496)

PHP: Because 10 million newbies can't be wrong.

Re:Stuck? (5, Interesting)

LuckyStarr (12445) | more than 6 years ago | (#22157714)

I've been using PHP for eight years and there hasn't been a day where I wished I had chosen another language. Sure, I wish the PHP of today was available eight years ago, but I can't complain with what is available now.
That makes me wonder what other languages beside PHP you know.

Re:Stuck? (1)

alex4u2nv (869827) | more than 6 years ago | (#22158996)

I think thats what a lot of developers are failing to realize. That one "shoe" doesn't fit all, and that you need the right tool for the job.

For instance, you can't take out your drain plug with a hammer, but who says it can't be done with a lot of work?
So to, you won't build a website you plan on dumping on easily available webhost on Java.
You're not going to tackle something as tedious as google's finance app with javascript, etc. But thats not saying it can't be done without a lot of work.

So as a developer, your "tool" isn't VI, or the IDE, or compilers. Your ultimate toolsets are your languages.

Re:Stuck? (5, Funny)

Samus (1382) | more than 6 years ago | (#22157748)

Get over it. GWB is not perfect, but he does a damn good job. If he didn't, he wouldn't be so widely loved. You can respectfully disagree, but try to maintain some civility here instead of suggesting we all just avoid GWB as if he's some kind of curse. There isn't a tool in the world that doesn't have his flaws.

I've been praising GWB for eight years and there hasn't been a day where I wished I had chosen another president. Sure, I wish the economy of eight years ago was available today, but I can't complain with what is available now.
Just a parody. I'm not trying to turn this thread political. Laugh or don't laugh then move on.

Re:Stuck? (-1, Offtopic)

Anonymous Coward | more than 6 years ago | (#22158012)

Sure, I wish the economy of eight years ago was available today,

hehe, Ironic? The economy of 8 years ago was pretty much at the same point if not much worse than today. It was called the "Dot Com Bubble" then and GWB stepped it an picked up the pieces of "Clinton". Though, I'm not stupid enough to blame Clinton for private businesses investing in stupid startups that had an "e-" in their name, just like I cannot blame Bush for stupid banks and borrows creating the Housing Market bubble that burst.

Re:Stuck? (2, Insightful)

dubl-u (51156) | more than 6 years ago | (#22158272)

Get over it. PHP is not perfect, but it does a damn good job. If it didn't, it wouldn't be so widely used.

Yes, all things that are popular are good and work well! Windows 3.1 and Visual Basic were very popular. So was the belief that the earth is flat. And there's chlamydia. That's hella popular.

I've been using PHP for eight years and there hasn't been a day where I wished I had chosen another language.

No offense, but if you've been using the same language for eight years without any regrets, I don't see you as having enough perspective to offer up much useful information.

As far as I can tell, PHP is popular because it's perfectly adequate language for cranking out some basic dynamic pages, and it's very easy to learn and set up. However, just like Visual Basic, the things that make it useful in the shallow end of the pool keep it from being useful at scale. And from the eternal trickle of security issues and the host of weird issues with it [toykeeper.net], it was apparently designed by amateurs.

If you're happy with it, that's awesome. Carry on. Just don't get your knickers in a twist because a lot of people correctly see it as the wrong tool for their jobs.

Re:Looks like a great book if you're stuck with PH (1)

Dan Posluns (794424) | more than 6 years ago | (#22157758)

I love PHP for prototyping ideas, and the html-integration as well as the hard-to-beat completeness of the supporting libraries makes it great for writing quick scripts where I want a webbish-GUI. Everything exposed in the global namespace? No problem when all I want to do is some quick processing of an image or some other data.

But that very nature lends itself to a paradigm that makes it far too easy to eschew software engineering principals. So you reap what you sow.

Yes, you can do OOP in PHP. But on large projects - and especially multi-programmer projects - you or somebody on your team is probably gonna wind up succumbing to doing things the way the language makes easy.

Now excuse me while I go write some sparkly, gorgeous Python code.

Dan.

Don't blame the language for your stupidity (1)

i_ate_god (899684) | more than 6 years ago | (#22158232)

That error is a result of throwing an exception where it can't ever be caught. This is YOUR FAULT entirely and not PHP's fault, but nice try shifting blame and all that.

function __destruct()
{
throw new Exception('Look at me, I'm a fucking moron');
}

Just because you can't build a tree house doesn't mean it's the fault of the hammer. Nice try shifting blame though, you really sound far more intelligent than me and my crass reply to your idiocy.

Are you sure you understand? (2, Interesting)

bigtrike (904535) | more than 6 years ago | (#22158946)

My problem had nothing to do with destructors. There are other contexts where they can't be used. But of course you knew that, even though they're not really documented.

function a() { new DateTime('2007-02-32'); }
function b() { a(); }
register_shutdown_function('b');

And even then my complaint isn't that you can't do that, but that there is absolutely no way to track down the source of that error because unlike most other PHP errors, you're told it's on line 0 of Unknown.

PHP5 (5, Interesting)

corychristison (951993) | more than 6 years ago | (#22157224)

But with the released of version 5, PHP introduced a robust object model, and made it easier for its proponents to create well-architected Web sites and applications.
... PHP 5 was released ~2.5 years ago. It MUST be noted that there were some significant changes in the 5.2.x branch. I don't see any mention of PHP 5.2 in this review. This book is already dated.

I do web development & design for a living. I use PHP because it is what I got into and I have not yet had the time and/or drive to really try anything else. PHP is so available and that is its real strength. It's biggest problem is those lazy folks who are still running 4.2.x or some branch that is or is to be discontinued very soon here. As well there are some known exploits and issues in the older branches.

I love the rapid-ness of PHP though. At present I even use PHP-GTK2 to prototype all of my idea's while I learn new languages. That is, I'll make a rough draft in PHP-GTK and then try to do the same in C/C++... which is much more painstaking for someone who has used web development for so long. But I am slowly un-learning my habits to depend on magic to handle memory for me, etc.

Yup. Just my random bablings.. I am sure there was a reason I started writing this comment.

Re:PHP5 (1)

SanityInAnarchy (655584) | more than 6 years ago | (#22157386)

PHP is so available and that is its real strength. It's biggest problem is those lazy folks who are still running 4.2.x or some branch that is or is to be discontinued very soon here.

You kind of contradicted yourself there. That, or PHP is much more pervasive than I give it credit for, such that even the 5.2.x branch is more widely deployed than everything else... but I kind of doubt that.

I love the rapid-ness of PHP though. At present I even use PHP-GTK2 to prototype all of my idea's while I learn new languages. That is, I'll make a rough draft in PHP-GTK and then try to do the same in C/C++... which is much more painstaking for someone who has used web development for so long. But I am slowly un-learning my habits to depend on magic to handle memory for me, etc.

You know, there's quite a lot besides PHP and C/C++. Not all of it makes you handle your own memory -- but you absolutely should have that experience of having to do that, so that you understand what's going on behind the scenes (why not to slurp the whole file, etc).

Re:PHP5 (1)

garett_spencley (193892) | more than 6 years ago | (#22158568)

Not all of it makes you handle your own memory -- but you absolutely should have that experience of having to do that, so that you understand what's going on behind the scenes (why not to slurp the whole file, etc).

Agreed. Even PHP developers should know about memory management. I use PHP all the time, I love it. But it can be just as dangerous as any other language. Functions like file_get_contents() are extremely convenient but also extremely stupid. It's kind of similar to C's strcpy() (only it won't cause a buffer overflow). If your php.ini file has sane a memory_limit setting then you're not going to crash the server. But an inexperienced programmer might not know any better and increase the limit to the available memory on the server and cause it to swap with something as simple as:

$foo = file_get_contents(/path/to/sufficiently/large/file);

or

$foo = array();
for($i = 0; $i 33554432; $i++) {
      $foo[$i] = $i;
}

etc.

Re:PHP5 (1)

corychristison (951993) | more than 6 years ago | (#22158614)

You kind of contradicted yourself there.
I don't quite see the contradiction there, perhaps it was the way I worded it? What I meant to get across was that PHP 5.2 is the current stable branch and that there are some hosts out there that are still strictly only PHP4... despite some of the security issues.

You know, there's quite a lot besides PHP and C/C++. Not all of it makes you handle your own memory -- but you absolutely should have that experience of having to do that, so that you understand what's going on behind the scenes (why not to slurp the whole file, etc).
T'was just an example... I've dabbled with other languages as well (Python/PyGTK, TCL & TK, etc.) I just feel that C/C++ is a good route to go and am putting a lot more work into learning it because it allows a lot of control and fine-tuning in the event that I need it (yes, I know ASM is better, but also a steeper learning curve.)

Re:PHP5 (1)

jaydonnell (648194) | more than 6 years ago | (#22158672)

I haven't used php in years. Can you link to a page that highlights the significant changes in 5.2?

Re:PHP5 (1)

corychristison (951993) | more than 6 years ago | (#22159190)

Re:PHP5 (1)

jaydonnell (648194) | more than 6 years ago | (#22159278)

Thanks. I found those from google earlier, but when I read over those lists I don't see anythign that jumps out as somethign that would make the book different or that would warrant coverage. Which of those things are really cool new features? Did any change the way you do things?

Re:PHP5 (1)

mbadolato (105588) | more than 6 years ago | (#22159240)

I haven't used php in years. Can you link to a page that highlights the significant changes in 5.2

Did you even TRY to look for it yourself? I haven't used PHP in years either, yet I just went to php.net and right there in the second news entry on the front page, it announced 5.2.5 is released, and contains a link for Changelog for PHP 5. Boy that was hard.

PHP needs more work (5, Insightful)

Anonymous Coward | more than 6 years ago | (#22157226)

<?php
function foo(){ return array(1=>'a', 2=>'b'); }
echo foo()[1];
?>

Parse error: syntax error, unexpected '[', expecting ',' or ';' in ... on line 3
wtf?

Re:PHP needs more work (5, Informative)

corychristison (951993) | more than 6 years ago | (#22157408)

While what you may have not exected, there are many ways around this... the most simple of which:

<?php

function foo($get)
{
$array = array(1=>'a', 2=>'b');
return $array[$get];
}

echo foo(1):

?>
Which, in reality is cleaner in the first place. :-)

Re:PHP needs more work (3, Informative)

Azarael (896715) | more than 6 years ago | (#22157576)

If foo() is explode() or something similar though, you're out of luck. I expect that this is what the OP was referring to.

Re:PHP needs more work (1)

hardburn (141468) | more than 6 years ago | (#22157764)

No, gack, flasck, no.

In practice, you almost never want to use only one element of an array. If you do, you probably actually wanted to use an associative array. Instead, you generally want to work over the complete array, such as with map, grep, or foreach (or whatever the PHP equivalents are).

There are cases where you do need to index a specific array element (like sorting operations, and then only if you don't have a library that provides one for you), but these are the exception. You could have a useful programming language that doesn't have any array indexes at all.

Re:PHP needs more work (1)

corychristison (951993) | more than 6 years ago | (#22158324)

From the example given (a simple echo) it was indeed a good replacement.

<?php

function foo( $get=chr(7) )
{
$array = array(1=>'a', 2=>'b');
if( $get =! chr(7) )
{
return $array[$get];
}
return $array;
}

echo foo(1);
// will echo 'a'

// you may also use like so:
list($item1, $item2) = foo();

?>
This is usually pretty useful (in web design anyway) for configuration... as it is read only. If you need write, then what was the point of putting it in a function?

Re:PHP needs more work (2, Informative)

nuzak (959558) | more than 6 years ago | (#22157878)

No, it's not cleaner in the slightest. Now you can't get at the whole array. Unless you want to overload the function. All that boilerplate because the designers of PHP still don't pay attention to basic things like this.

Another workaround is to just use a temporary. Or a different language outright.

Re:PHP needs more work (0)

Anonymous Coward | more than 6 years ago | (#22158332)

Sorry, If a function returns an array I should be able to dereference the returned value to get what I need without having to store the whole array. I ran into the problem the last time I used php. The memory is dim but I think that I needed to get the some aspect of a file in the filesystem and was using the built-in stat() function.

Re:PHP needs more work (0)

Anonymous Coward | more than 6 years ago | (#22158330)

list($v) = f();

Re:PHP needs more work (1)

nicklott (533496) | more than 6 years ago | (#22158532)

Why would you expect that to work? That's just lazy programming. Using another few chars to assign what the function returns to another var isn't going to kill you, and the bytecode will come out the same.

Re:PHP needs more work (1)

thue (121682) | more than 6 years ago | (#22159254)

test.php
<?php
function f() {f();}
f();
?>

t@t ~> php test.php
zsh: segmentation fault php test.php

I had some fun with that when I accidentally introduced it while developing, and the webserver suddenly kept serving up blank pages.

PHP catches almost all other kinds of user errors, and shows a nice error message, but when I reported this one they referred me to the manual and marked the bug report BOGUS. I still maintain that the interpreter crashing is not expected behaviour.

Re:PHP needs more work (1)

schneidafunk (795759) | more than 6 years ago | (#22159264)

don't knock the language simply because you don't know how to use it. 'a', 2=>'b'); } $array = foo(); echo $array[1]; ?>

Re:PHP needs more work (1)

schneidafunk (795759) | more than 6 years ago | (#22159384)

woops, my code got clipped ... the original foo() function is fine, you just have to call it differently. as posted above: $array = foo(); echo $array[1];

English, do you speak it? (1, Funny)

Anonymous Coward | more than 6 years ago | (#22157248)

In turn, the new OOP capabilities have facilitated additional best practices, such as design patterns, test-driven development, continual refactoring, and HTML templates.


Bingo, sir.

Re:English, do you speak it? (1)

Metasquares (555685) | more than 6 years ago | (#22159312)

"Best practices" is a misnomer anyway. It implies that the aforementioned software development practices are somehow optimal. If this is as good as software engineering can ever get, we're in trouble!

ISBNs (1, Informative)

Anonymous Coward | more than 6 years ago | (#22157352)

"under the ISBNs 1932394753 and 978-1932394757"

The former is a traditional ISBN. The latter is what was (or is) called a Bookland EAN (978 is like a country code you'd find in any EAN, specifying that the rest of the numbers make up an ISBN.) They're both ISBNs now, as ISBN space expansion necessitated reformatting, but I guess my point is that, while they're different formats, they represent the same ISBN. The review makes it sound like they're different printings.

yeah right (3, Insightful)

mrsbrisby (60242) | more than 6 years ago | (#22157436)

PHP has for much of its history been criticized for not offering the full capabilities of object-oriented programming (OOP).
Yeah, that's exactly why it's criticized. It has nothing to do with the fact it takes them three releases to fix a simple integer overflow, that they thought "safe_mode" was an access control system, that "require" pulls in files unexpectedly from malicious sites. It has nothing to do with the fact that mysql_connect() takes arguments, and programmers are encouraged to use mysql_connect() in a way that makes it incompatible with the default mysql install. It has nothing to do with the fact that regular expressions are so prevalent and yet there is no syntax for them. It has nothing to do with the fact that the language mutates drastically with toplevel global configuration variables.

Seriously, it has nothing to do with the fact we're sick and tired of cleaning scripts written by people who don't know what they're doing, and we like blocking access to your site for major vulnerabilities. We actually love it how when your script gets owned, you don't notice for months because you do the development on the server, all the while jerkoffs are udp-flooding from your site. Because you'll never pay for this usage, and you'll expect us to fix your script, it doesn't matter because we're just really upset that it isn't "offerring the full capibilities of object-oriented programming".

That and we sometimes wonder what it would be like to fling poo...

Re:yeah right (1)

SirSlud (67381) | more than 6 years ago | (#22157702)

That and we sometimes wonder what it would be like to fling poo...

Well, there's always the option of becoming a Perl developer. ;)

Where to start out language wise? (1)

poetmatt (793785) | more than 6 years ago | (#22157438)

As a complete programming noob looking to get into web-related design and things of that nature, what languages are good to start with and to branch to other languages? Would that be like C-> PHP -> SQL? What other languages apply and/or in what order are languages needed to learn to start to bring things together for well designed websites?

Re:Where to start out language wise? (1)

Azarael (896715) | more than 6 years ago | (#22157690)

These days you can insert Python and quite a few other languages into the middle slot (D also comes to mind). I'd suggest just doing some searching around the net to see if you can find something that suits you.

Re:Where to start out language wise? (1)

pahoran (893196) | more than 6 years ago | (#22157738)

It doesn't really matter. What matters is that you learn _how_ to program well. This comes with time and experience. Going to school or reading a _lot_ of books can reduce the amount of time required to gain experience.

If you want to get started fast with web sites use PHP. Accept the fact that you won't know too much about how much is happening under the hood, but you will still get things that run. You will start to build experience.

If you can accept a slower pace, then start with C. You'll learn a lot more about how things work (mostly by shooting yourself in the foot alot).

If you want to get started really quickly and really never know what you're doing, use Rails.

If you don't want to try any of those, try another one.

Hmm, SQL ... it is not a procedural language so it doesn't compare well to C or PHP. Learn about different types of languages if you're interested in the differences. If you want to interface with relational databases you'll probably need to know SQL. If you don't know what a relational database is then either read about them (or don't if you never think you're going to write apps that use them).

Also, realize that when you start you probably aren't going to code very efficiently or securely. Don't put any information near your web server that you care about too much.

Re:Where to start out language wise? (1)

poetmatt (793785) | more than 6 years ago | (#22157982)

I plan to go book-hunting and slashdot folk definitely know programming well so I'm glad I asked :) I don't expect this overnight, I just want a good idea of where to start. I was going to try C, but other than arrays and basic system calls I didn't really take much away from it...which I was dumbfounded by because I couldn't figure out how a language that is a large basis of many OS's (feel free to correct me if I am misinformed on that)...seemed to do not much more than basic manipulation of tables, arrays, etc.

Thank you for the security advice and all the rest too...would it be sufficient to run a virtual machine of the server without an exceptional knowledge of security or would my home/office system be too easily compromised even if its in a sandbox?

Re:Where to start out language wise? (1)

pahoran (893196) | more than 6 years ago | (#22158694)

Hmm, that is an interesting question.... I think you might know more than you're letting on. :)

I think you would be all right as long as you didn't let the virtual machine that your server is running on know about the existence of your home/office hard drive partition. To be really safe I'd use a separate physical machine as your web server and lock it out of the rest of your home/office network, but I tend to be labeled paranoid.

As far as C goes ... its power is in its libraries, not in the basic language constructs. Those libraries are a bit hard to learn, though, and things like file I/O are more straightforward in PHP or Python. This is because (in C) you are really only one level of abstraction above the assembler and so things tend to be a bit more tedious. With practice, though, you can knock out C code just about as fast as PHP code. Personally, I think the increased knowledge of how lower-level parts of the system work is worth the price.

You might try playing with C++ and the STL if you want to mix low-level power with some higher-level tools like file streams, strings, templates, etc. Java has been advocated in this thread, but you don't get enough low-level freedom with it, in my Humble but Accurate opinion. :) That said, Java works great for many things -- I just personally prefer C++.

Usually when I have a web app that needs a powerful piece I write all but the that piece in Python or PHP. The powerful piece is usually in C++ and the front end calls the back end when it needs some heavy lifting done. This requires an intimate knowledge of what your web server is going to do and where the less efficient parts of execution are.

You can also configure your web _server_ to do some of its tasks more efficiently using ISAPI (IIS) or modules (Apache). These pieces almost always are written in C or C++.

My rule of thumb is:
1. When it has to be written fast or I don't need to optimize it much I use Python or PHP (most web programming falls into this category).
2. When I need to tweak lower level components I use C++. Usually I write non-web applications in C++. If there are portions of a web app that could gain speed from C++, I write those portions in C++.
3. When I need to optimize A LOT I usually take something written in C++ and refactor parts of it into C to make it faster.

Some crazy (or highly motivated) people add a step 4 and refactor portions of their C code into assembly code to make things screaming fast.

Re:Where to start out language wise? (1)

hal9000(jr) (316943) | more than 6 years ago | (#22157844)

Definetly learn SQL. You will need it. PHP is easy enough to learn and you can start making dynamic web apps quickly. You do want to find some good books and sites that discuss PHP programming. You don't need to know other languages.

Re:Where to start out language wise? (1)

nuzak (959558) | more than 6 years ago | (#22157936)

Java. Yes, it's a craptastic language, but you wanted web development, and until you at least know something about JavaEE, if only to have educated reasons to hate it, a good chunk of potential clients see you as swimming in the kiddie pool. Plus, you get to branch to other languages that are actually a pleasure, like Scala.

Re:Where to start out language wise? (0)

Anonymous Coward | more than 6 years ago | (#22158000)

C -> Smalltalk -> Smalltalk -> Smalltalk -> Smalltalk (notice a theme)
C -> Smalltalk -> Lisp
C -> Smalltalk -> Erlang

done.

PHP - duh. Avoid like the plague. This doesn't even qualify as a language, just a hacked together set of web libraries. No PHP is not object-oriented. See Smalltalk or Lisp.

C# - Nice language, awful web framework, MS bs. Good development environment. Fixes a lot of what is wrong with Java, but at the expense of less good, free libraries.

Java - yuck for productivity, lots of examples of how not to do web development. A giant mess all around, avoid like the plague. Still, there are some great libraries available and it's widely supported.

Python - Not bad, but wants to be like Smalltalk or Lisp, yet fails miserably. Many weird conventions, broken pieces (threading), and confused libraries. Well supported though and a pleasure to develop in vs. Java and C#. A better choice than Ruby by light years for similar development.

Ruby - Incomplete. Use Python if you want something like this but with a stronger base. Don't be tempted by the Rails nonsense. Great for command line scripts, not so much for big time real development. Give it a few more years. If you don't see the fundamental problems in this language, you have no business programming. The language can be fixed, but it will take time.

Smalltalk - An actual object oriented language. Makes Java, C#, and even Ruby look procedural. It also has the single best and most productive development environment.

Lisp - Makes Smalltalk look procedural, but annoying to read and development environment sucks.

Erlang - Holy moses. Wish it had more support and a better development environment.

Re:Where to start out language wise? (1)

avi33 (116048) | more than 6 years ago | (#22158212)

Well, I hate to go back to the dreaded car analogy, but C -> PHP -> SQL is a bit like saying you should learn mechanical engineering before you learn to change the oil in your car, then learn how to back it out of the driveway.

If you have nothing but brains and time, C will be a great start...managing references vs. pointers and memory...you will be bulletproof when you start using a 21st century language. Not to start a flamewar here, but maybe it's useful in plenty of ways (mostly learning how freaking hard it was to program 40 years ago), I'm sure a bunch of people will jump down my throat and tell me I wouldn't be able to wake up in the morning and make it to my coffee machine without using C 12 times. My point is, it's hard, and not exactly a recommended place to start if you just want to build web sites. If you want to major in Computer Science, on the other hand...have at it.

Let's skip ahead to SQL. It's doesn't matter what language you "program" in, SQL is what you use to put and get data in and out of a database. 95% of the time, it's "Select [something] from [tablename] where [parameter] equals "whatever"... or a similar insert/update statement. Hordes, and I mean HORDES of sites use little more than that, but you can obviously go hog wild in this department and become an Oracle DBA and make piles of money if you like.

As far as a programming language to render pages and interact with a database? There are dozens of legitimate choices, and whichever one you pick, you will have millions of people agreeing with you or derisively calling you an idiot. Some people think java is robust and "enterprise" - some think it blows. PHP has some issues pointed out clearly above, but I've used it for basic web development and never ran into any problems (or had a site 0wned). c# or asp/vbscript is easyish (but widely hated on here), and you might need a $10,000 OS/product suite to run it on your own hardware (but obviously you can find that environment at any hosting company). Ruby, Python, Perl, whatever...advocates and critics abound. Keep in mind, you learn a lot from the code you borrow/find on the web, so if you pick an obscure language, you might make life harder down the road. i.e. Lisp might be the most perfect language ever designed, according to some, but if I needed "sample code" to rip off for my own web development efforts, I can't imagine finding a decent function after googling for ten minutes. Not so with php etc. (Of course, you'll also find some *bad* functions too!)

I'd look for 'tutorials' or 'getting started' and probably start with PHP or python. Actually, I'd spend a few days on 3-4 different ones...they'll all start off doing the same thing, and you might find that one is just easier to look at and comprehend. Look up LAMP (Linux/Apache/MySQL/PHP/Python) and you'll find loads of stuff.

Let the flames begin, I'm a "web developer" and not a "software engineer" - this is slashdot after all - but you asked.

Re:Where to start out language wise? (1)

poetmatt (793785) | more than 6 years ago | (#22158720)

I didn't intend for C-> PHP -> SQL, I was asking if there such a chain. I am asking what that chain would be :) So yes, I want to learn the oil change before becoming the aeronautic pilot and do the steps imbetween as well.

With that said, thank you very much for your explanation :) It does answer the kinds of questions I was looking to answer, as many others have done (thankfully).

Re:Where to start out language wise? (1)

Phrogman (80473) | more than 6 years ago | (#22158248)

Despite its naysayers - and hey this wouldn't be slashdot if you mentioned a programming/scripting language and dozen people didn't immediately post about how bad the language in question was - PHP is an excellent introduction to web-based programming. Sure, there are other approaches you can take, which may even be far better, Ruby, Python, Java etc, but with PHP you can accomplish something and start learning in very short order and there is still a lot to absorb. I think its a good way to learn programming for the web. I can build something in PHP in a fraction of the time it would take me in Java, and to be honest (IMHO) I think the result is just as effective to the user. PHP is easy to learn, effective enough, and not a bad place to start. At least you will have something to compare it to when you try out other languages down the road.

"robust object model??" (5, Insightful)

Maxmin (921568) | more than 6 years ago | (#22157498)

PHP introduced a robust object model, and made it easier for its proponents to create well-architected Web sites and applications.

While I agree with the latter overall, I dispute "robust object model." What's missing? Polymorphism is sketchy, and static initializers are missing, for two. In PHP5, you can only initialize static properties with literals or constants - no function or method calls.

Also, calling up the inheritance chain, to a grandparent class's implementation of a method, is difficult to say the least.

While PHP5 is a *lot* better than PHP4 (and probably Perl if one took the time to compare) - it's not really comparable to truly robust OOP languages such as Java, Smalltalk and C++.

Mind you, I code in PHP5 for a living. It gets the job done, but it has to be called on its limitations, and you gotta be honest and tell programmers who want OOP from PHP5 that it has limits, and how to work around them. None of this "robust object model" stuff.

Re:"robust object model??" (1)

SanityInAnarchy (655584) | more than 6 years ago | (#22157644)

While PHP5 is a *lot* better than PHP4 (and probably Perl if one took the time to compare) - it's not really comparable to truly robust OOP languages such as Java, Smalltalk and C++.

How is it better than Perl?

I'll admit Perl's OOP is weird. It's weird syntactically, it's weird conceptually, it feels bolted on, etc.

But scratch the surface a bit -- it's also every bit as powerful as Java or C++. Moreso, I'd say, especially if you like "duck typing" (to steal a Ruby term).

Re:"robust object model??" (1)

nuzak (959558) | more than 6 years ago | (#22157970)

> static initializers are missing

I come to bury PHP with a backhoe, not to praise it, but: why on earth does it actually need static initializers? PHP code runs as a script. You just stick the initialization code in the script.

Re:"robust object model??" (1)

Bob9113 (14996) | more than 6 years ago | (#22158204)

Mind you, I code in PHP5 for a living. It gets the job done, but it has to be called on its limitations, and you gotta be honest and tell programmers who want OOP from PHP5 that it has limits, and how to work around them. None of this "robust object model" stuff.

As a long-time OO programmer who has been baptized by fire over the past two months in PHP, I strongly concur with your sentiment. PHP is another good tool to have in the tool box, and the OO is decent but a little short of full-blown. Your suggestion that people be prepared for the reasonable limitations in PHP OO is a sound one. Well said.

That's not why it's been criticized. (4, Insightful)

SanityInAnarchy (655584) | more than 6 years ago | (#22157530)

PHP has for much of its history been criticized for not offering the full capabilities of object-oriented programming (OOP).

Nope. PHP has been criticized for:

  • starting out as insecure by default
  • lacking the basic capabilities of most other languages -- not just OOP, but things like anonymous subroutines
  • being designed around the need to embed code in a template (not a good idea -- separate content from logic from presentation!)
  • having essentially nothing compelling to offer once other languages got said templating ability -- but sensibly as an add-on, not as a core feature of the language (all PHP files, even library code, must be sandwiched between <?php and ?>)

I could go on. Not all of these are really legitimate complaints, or a reason not to use the language; indeed, it has evolved. Due to the amount of code that exists in PHP, and the amount of cheap hosting which runs some form of PHP, I can no longer accuse people of being stupid for choosing PHP, although I might call them insane for liking it if they've given anything else half a chance.

But I wouldn't put a lack of basic OOP particularly high on the list, especially with how dysfunctional the OOP was when it was finally added.

Disclaimer: As much as I enjoy flamewars, and although I realize this will feed one, that's not why I'm posting. I'm just posting to clarify -- if you thought all PHP needed was OOP, you're dead wrong. If you're trying to improve PHP, look beyond OOP. (Look especially to the mysql_add_slashes_no_really_i_mean_it_this_time() functions, and compare them to Perl's support for prepared queries.)

Perl and rationality (0)

Anonymous Coward | more than 6 years ago | (#22157858)

How can I consider a language that was created by an irrational person?

Re:That's not why it's been criticized. (1)

fredrik70 (161208) | more than 6 years ago | (#22158962)

but they *do* have anonymous functions, with the create_function() call.
The annoying thing is though that the function will not get cleared from memory once if goes out of scope, making it leak memory. great.

Be Aware, PHP behind !!! (2, Insightful)

YuuShiSann (793626) | more than 6 years ago | (#22157620)

I've used Smalltalk, C++, Java, Python etc. 1st time experience using PHP in real OO dev with phpUnit. I have enough pain with PHP language defects that remind me with the pain with C++. This is my wisdom, use PHP carefully like C++ as there are a lot of language traps behind the close door. The biggest defects is the array comparison. I think PHP is doing copy-on-write behind the scene; but the lacking of way to compare the object identity is a real pain. Both '==' & '===' are fooling. There are still a lot defects I've discovered. I think I have enough content to write an anit-pattern for PHP.

Re:Be Aware, PHP behind !!! (4, Interesting)

nuzak (959558) | more than 6 years ago | (#22158104)

I remember the the discussion on IRC that lead to the creation of the === operator. The designers of the language (back when they hung out on IRC) actually did not comprehend the concept of "object identity". I had to eventually resort to calling it a pointer compare, at which time I was told "PHP isn't C, it doesn't have pointers". That was pretty much the end of PHP for me.

Publisher web site (3, Informative)

Anonymous Coward | more than 6 years ago | (#22157646)

Maybe a ./ editor can fix the link in the article for the rest of us ;-)

The publisher link in the article should have been: http://www.manning.com/reiersol/ [manning.com]

Thanks in advance

php's ok for non-OOP applications (1)

pak9rabid (1011935) | more than 6 years ago | (#22157678)

For something that doesn't require the complexity of OOP, I think PHP does a decent job of getting what u need done quickly...assuming you're not a tard of a programmer. I like it's syntax (I come from a C background), as compared to Perl (which resembes the illegitimate child of C and LISP with down syndrome). Not to mention the documentation via www.php.net is nice.

Grammar...where is the QC? (0, Troll)

Gaston (111011) | more than 6 years ago | (#22157906)

"But with the released of version 5, PHP introduced..."

Any reasonable 10 year old word processor grammar check would catch this. Or Slashdot can just hire a 10 year old.

Want Real OOP Evidence (2, Insightful)

Tablizer (95088) | more than 6 years ago | (#22158056)

a robust object model, and made it easier for its proponents to create well-architected Web sites and applications.

I've never seen good examples of OOP making websites or typical business clearly better. Any bad non-OO coding presented was merely poor knowledge of procedural, bad specific languages, or lack of knowledge about good relational techniques. I challenge anybody to clearly demonstrate OOP being better for the mentioned domains.

I've found flaws with the OO books out there. For one, they assume unrealistic change patterns to artificially boost OO. And please no anecdotes; for those are not dissectable. If OO fits your own personal psychology better, that's fine, but I don't wear your head.
     

Re:Want Real OOP Evidence (1)

bishiraver (707931) | more than 6 years ago | (#22158424)

1) maintainability
2) understandability
3) code reusability
4) loosely coupled code
5) modular code

If you don't understand how these can be helpful in business and heavy web applications, you've probably never worked on one with a team before..

Re:Want Real OOP Evidence (1)

mlwmohawk (801821) | more than 6 years ago | (#22158860)

I have to laugh. I was just having a conversation with a Java/Swing guy and everything you list is precisely what what's missing from the modern "OO" environment.

Yes, I agree, as a concept, well written OO can provide those things that you mention:

1) maintainability
2) understandability
3) code reusability
4) loosely coupled code
5) modular code


Then again, *any* well written code provides those things. What we see, however, is ever growing heaps of interdependent class libraries who's periodic API deltas cause huge amounts of "re-integration" every time a single component is upgraded.

I would say, if you think OO is some magic bullet, spend a week on Java Swing.

Re:Want Real OOP Evidence (1)

kingmundi (54911) | more than 6 years ago | (#22158874)

I just want to comment on

2) understandability

This actually is a result of a self fulfilling prophecy of sorts. No one, to my knowledge, has ever demonstrated that OO was inherently more understandable than other methodologies. But I do not dispute your point in the context of the other points you bring up, for in a sense, it is true.

The reason...

It appears to me that colleges all bought into OO. And so they churned out a vast number of graduates who all spoke the OO language. And so if you hire people, you are more likely to find someone who does things in OO. Or the majority of books published (like the one in the review) concentrate on OO.

My personal opinion (not to be construed as an attack against your post) is that OO on a basic level is more difficult to understand than a procedural equivalent. I base this on anecdotal evidence of all the programming teams I have worked on over the years. (~20 other coworkers over 10 years) and having to explain the nuances of various systems in OO.

PHP and the web (4, Insightful)

mlwmohawk (801821) | more than 6 years ago | (#22158236)

PHP, or "Personal Home Page" to us old time users (Not PHP Hypertext Processor, as some revisionists would have to believe.) is a simple web scripting language first envisioned in the 90s for making simple web pages.

For what it is, PHP is pretty good, a quick and dirty scripting language that, if used right, can make some pretty impressive applications.

The real problem with PHP is the bickering and infighting little boys club that is the PHP development community. Over time they've learned a lot, but for the most part they believe they know everything and everyone else is wrong. Even though there are public forums, decisions are made on IRC chats. It is not as transparent or well functioning as groups like Apache, PostgreSQL, and others. A lot of petty crap goes on behind the scenes and a lot of people who would have been active contributors get pissed off and leave.

I could go on with first hand and second hand stories and it is my opinion that it is this lack of professionalism that hinders PHP quality and adoption on an enterprise level.

All that being said, PHP has a solid purpose in the web world. Java and .NET environments, and things like JSF or Swing are HUGELY complex and difficult to manage. With a continuum between simple HTML docs to HUGE applications, PHP sits in a very wide middle ground that it easy to manage and deploy.

Break backwards compatibility, fix PHP for good (1, Insightful)

Anonymous Coward | more than 6 years ago | (#22158326)

As someone who's been using PHP for about 7 years (and someone who's gotten quite wealthy because of it), I have to say, among its many inadequacies, the insane inconsistencies PHP has with naming conventions makes me want to eat glass. I say with PHP 6.0 they should deliberately break backwards compatibility and go with one solid naming convention for methods and functions. I don't care if they go with functions_with_underscores or functionsInCamelCase, just as long as it's consistent.

Someone lost the definition of OOP (1)

Sweep The Leg (925950) | more than 6 years ago | (#22158350)

It's bad enough to say Java, C#, and C++ are object oriented. It is a crime to say the same thing about PHP. This is book is yet more firewood. When I interview someone and they say they are a PHP programmer, it's usually a "thanks, we'll be in touch." It is today's equivalent of ASP or VB (classic) programmer. As an aside, anyone who considers themselves a "insert language programmer" (like many here) needs to find a new career. Any decent programmer should be able to work in any language to do the job. There's no excuse anymore for not learning at least 3 languages. If you work on real systems, it's tough to get by not knowing at least more than one anyway. Try picking up Smalltalk or Lisp and getting a taste what a real OO language can do. I recommend any of the Smalltalk books by Kent Beck as a good start. Smalltalk (also Lisp and others) is infinitely more stable and better designed than PHP. It also has its own development environments that are amazing and integrate perfectly. Most other languages are about 20+ years behind. It never ceases to amaze me how all the Ruby zombies especially have no idea what a pale imitation the language is and what insane syntax it uses vs. Smalltalk. C# is perhaps worse as it tries to mimic Java, C++, and now Smalltalk (predicates, lambda expressions, anonymous functions). It just goes to show you what is popular is not what is better. All the people that use that as justification I am sure would have made Hitler a very happy man and never owned a beta VCR.

PHP is a fine language (2, Insightful)

s2theg (1185203) | more than 6 years ago | (#22158870)

I chose to work with PHP due to its flexibility. Writing software by creating types is useful in certain places, but I have found that it tends to require more code to be written than is needed for most web applications. Many of the applications which I currently maintain have been written elegantly using basic GET and POST checking and a series simple of functions.

Re:PHP is a fine language (1)

potHead42 (188922) | more than 6 years ago | (#22159354)

Writing software by creating types is useful in certain places, but I have found that it tends to require more code to be written than is needed for most web applications.
Umm... you know, there are other dynamically typed languages besides PHP...
Load More Comments
Slashdot Account

Need an Account?

Forgot your password?

Don't worry, we never post anything without your permission.

Submission Text Formatting Tips

We support a small subset of HTML, namely these tags:

  • b
  • i
  • p
  • br
  • a
  • ol
  • ul
  • li
  • dl
  • dt
  • dd
  • em
  • strong
  • tt
  • blockquote
  • div
  • quote
  • ecode

"ecode" can be used for code snippets, for example:

<ecode>    while(1) { do_something(); } </ecode>
Sign up for Slashdot Newsletters
Create a Slashdot Account

Loading...