Beta

×

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!

Core Web Application Development with PHP & MySQL

samzenpus posted more than 8 years ago | from the build-it-now dept.

Programming 149

jsuda writes "Core Web Application Development with PHP and MySQL is an intermediate to advanced-level guide for programmers and developers. It bills itself as >everything one needs to know about building robust database applications. That is a bit of puffery but this is a comprehensive practical guide for designing and building production-quality, database-enabled applications." Read the rest of John's review.

The author is an open-source platform expert and software developer. He comes from a background of working with standard desktop Windows-based applications and made the transition to building dynamic web applications. His experience in making the transition informs this book as a comprehensive explanation of how to use the various technologies that go into writing web applications. For those making similar transitions, this is a very fine presentation done by a thoughtful, systematic designer. For those already busy in the PHP/MySQL area, the advanced level of instruction is likely to be valuable.

The emphasis is on open-source applications, particularly PHP5 and MySQL in an XHTML/Javascript environment. But, beyond technologies, the author's focus is on the strategies and systematic approach one needs to design and implement successful web applications. He writes for an advanced audience which is already basically familiar with programming and XHTML. Those writing or planning dynamic web applications will benefit most from the book.

There are 33 chapters in five parts - basics of PHP, database basics, planning web applications, implementation, and sample projects. There are three appendices covering installation and configuration of PHP, MySQL, and other related open-source applications like Apache, a set of charts of database function equivalents among the leading database types - MySQL, Oracle, PostgreSQL, Microsoft SQL Server, and a short list of recommended reading.

This is a large format book of 912 pages, including index. My reviewer's copy is a prepublication version containing grayscale graphics and much white space, especially around the code snippets, making reading easy and comfortable. Although the material is high-level and technical, the writing seems light and casual. Wandschneider's writing style flows easily, never bogs down even with technical details, and the book reads much faster than one might expect.

Although the best part of the book contains the three start-to-finish sample projects at the end - a calendar system, weblog engine, and e-commerce store, the lead-in chapters are nicely done, too. Chapters 1 and 2 are about getting started in PHP. There is a brief comparison to perl and C++, but the bulk is about PHP terminology and programming concepts. Much is made of PHP5's new object-oriented features, but the discussions of that here (and in Chapter 4) was about the only parts which I feel needed more clarity - the rest of the chapters are very clearly stated and contain plenty of good examples.

Chapters 3 - 7 continue with scripting concepts like functions, classes, arrays, strings and characters. The discussion is not designed to instruct comprehensively about PHP itself but works on a higher level of showing how PHP interacts with MySQL and other technologies on an overall basis. You can get detailed PHP coding instructions elsewhere. Chapter 6 contains an unusually good discussion of character sets, usable for global applications, and provides instructions on configuring Unicode and multi-byte support for high-level applications.

Part 2, Chapters 8 - 12, take the same approach to MySQL and databases in general. They include discussion of basic terminology and concepts, designing and creating databases, storing and retrieving data, PHP-to-database connectivity, and advanced topics, like use of "transactions" and advanced querying.

Part 3, Chapters 13 - 17, deal with the server-side matters. Again, the level of presentation is not on comprehensive details of PHP, MySQL, and web services, but present a comprehensive overview to guide planning, design, and implementation. Here the author states overall design considerations of a website noting how to incorporate CSS, HTML, code libraries, user interfaces, and web services into a working dynamic website.

User management and security concerns are noted throughout the book and Chapters 14 - 17 deal specifically with validation, and software and hardware security, including tips on how to secure your server. These passages on security are some of the better and clearest written I've experienced in this area.

Part IV continues the systematic approach to website construction discussing error handling, debugging, cookies, and sessions (again some of the clearest explanations I've read), authorization, and data validation with regular expressions. Chapter 21 is entirely about globalization and localization that is, dealing with the fact that the Internet is global and that there is a need to deal with foreign language sets. There are tips on how to determine users' locations and how to script to account for different language sets, including Unicode.

Chapters 23 and 27 are about XML and are especially useful now that XML and XHTML are becoming the reigning protocols of dynamic web activity. There is an extensive sample of using XML to work with the Google API. Using XML with PHP is an advanced topic and it is only generally covered here, together with XML web services and SOAP. Other chapters cover the use of extensions to PHP, like PEAR, developing a coding "style", creating test suites, configuring PHP.ini, and more. The three working examples are extensively commented and contain complete code examples.

The book comes with a comparison CD-ROM containing all of the sample code, and versions of PHP5, MySQL, and Apache HTTP server."


You can purchase Core Web Application Development with Php & MySQL from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

cancel ×

149 comments

Sorry! There are no comments related to the filter you selected.

WOW A FREE EARLY PASS (1)

Dragoonkain (704719) | more than 8 years ago | (#14292771)

i was excited about it, until i realized my 'early pass' was nothing more than a book slashvertisement.. shame on you slashdot.. tisk tisk

Re:WOW A FREE EARLY PASS (-1, Offtopic)

Anonymous Coward | more than 8 years ago | (#14292908)

I'm on the same Day Pass, but Firefox blocked the advertisement. So, should I turn my Day Pass back in?

Re:WOW A FREE EARLY PASS (-1, Flamebait)

Anonymous Coward | more than 8 years ago | (#14292996)

robust database applications + MySQL

Seems like something does not quite fit here...

Re:WOW A FREE EARLY PASS (-1, Offtopic)

Anonymous Coward | more than 8 years ago | (#14293384)

The next Slashdot story is visible early to free day pass visitors.

buuuuuuuuuuullllllllllllllll shiiiiiiiiiiiiiiiit, bye bye my beloved /. your time has come, poor decision, especially when the latest trend is /. reporting news 2-3 days behind other blogs, why should we come here any more? before it was nostalgic, and now, it is pointless and frustrating, so good bye dear friend!

Greater than everything! (1, Funny)

Anonymous Coward | more than 8 years ago | (#14292775)

Must take up a lot of shelf space.

Fr1st ps0t. (-1, Offtopic)

UseTheSource (66510) | more than 8 years ago | (#14292778)

I'll have to check it out!

frosty (-1)

Anonymous Coward | more than 8 years ago | (#14292791)

and queue the myraid of posts about why $_ is better than php-mysql...

What a useless review (-1, Troll)

vtrac (876898) | more than 8 years ago | (#14292817)

It's like I read the table of contents.

What, no AJAX? (5, Insightful)

WVDominick (860381) | more than 8 years ago | (#14292821)

An honest question for anybody to answer. Do most people still learn by picking up a 900+ page book rather than learning from example? I find most technical books extremely difficult to finish so I very rarely attempt to read them.

Re:What, no AJAX? (1)

netkid91 (915818) | more than 8 years ago | (#14292859)

They must be written in PERL.

Re:What, no AJAX? (4, Insightful)

op12 (830015) | more than 8 years ago | (#14292868)

Learning from examples and code snippets is one thing, but learning to code robustly is another. I think that is the emphasis here. Plus, as mentioned, "Although the best part of the book contains the three start-to-finish sample projects at the end - a calendar system, weblog engine, and e-commerce store, the lead-in chapters are nicely done, too...The three working examples are extensively commented and contain complete code examples."

Re:What, no AJAX? (3, Informative)

WVDominick (860381) | more than 8 years ago | (#14292915)

While I agree with you that it will take a while to become an expert coder by just learning from examples, but the same can be said for reading multiple 900 page books on the subject. Maybe it's just me, but I don't enjoy trudging through tons of text when I can just open up some code and go to work.

Re:What, no AJAX? (2, Insightful)

Anonymous Coward | more than 8 years ago | (#14292983)

Here's a tip: skip stuff you already know

Most books like this are at least 1/3rd boilerplate. Learn to skim.

Re:What, no AJAX? (1)

WVDominick (860381) | more than 8 years ago | (#14293029)

That I do, but is a book about programming really necessary with the abundant information out there on the internet? I would also like to clarify that I'm sure this is a good book and some people may find it very useful.

Re:What, no AJAX? (0)

Anonymous Coward | more than 8 years ago | (#14293296)

The best place to learn to code is nowhere near a computer.

Pick up a piece of paper and a pencil, and start coding, it works wonders for your understanding.

Re:What, no AJAX? (1)

WVDominick (860381) | more than 8 years ago | (#14293334)

What is this "paper" and "pencil" you speak of?

Re:What, no AJAX? (1)

JoeCommodore (567479) | more than 8 years ago | (#14293988)

I must be a hot programmer then, because I use a PEN!

Here is a related axiom: "Programming is debugging a blank sheet of paper."

Re:What, no AJAX? (1)

leonmergen (807379) | more than 8 years ago | (#14293554)

Yes. As soon as you start digging into more advanced topics, books can really help. When you're doing things like PHP, which is practiced by lots (millions?) of people out there, I personally feel that a book can be handy for people that want one central place of a lot of information, but not necessary to learn to master the language properly...

Re:What, no AJAX? (3, Insightful)

Anonymous Coward | more than 8 years ago | (#14293710)

I don't enjoy trudging through tons of text when I can just open up some code and go to work.

But, as soon as the code stops working, you're stuck because you don't really understand what the code does. IMHO, this is just an instance of the "cargo-cult programming" problem. Yes, you can copy/paste a great application within the hour, but you lose maintainability and scalability, mainly because you have no idea what's happening behind the scenes.

Nothing really substitutes a good understanding of what you're doing. For that, you need to spend a little more time and energy than just copy/pasting code.

Re:What, no AJAX? (1)

jacksonj04 (800021) | more than 8 years ago | (#14293243)

I use a book for some things (Such as date widgets), and to pick up best practices, but learn how to build applications from ripping existing applications apart.

I think it's down to the individual. Some need to see the whole thing laid out to see how it works, others can just frig existing things until they fit. But never underestimate the value of a reference book.

Re:What, no AJAX? (1)

WVDominick (860381) | more than 8 years ago | (#14293272)

I agree completely about using a book as a reference. I still use the internet as my first source though.

Re:What, no AJAX? (1)

Parham (892904) | more than 8 years ago | (#14294075)

I think your comment is especially true when it comes to PHP and MySQL. The websites for PHP and MySQL have a massive amount of information and documentation which could replace several books written for them already. The comments in their documentation on the two websites posted by users is even more useful:

MySQL documentation [mysql.com]
PHP documentation [php.net]

FaiLzotrs (-1, Troll)

Anonymous Coward | more than 8 years ago | (#14292866)

infinitesimall7 vitality. Like an IF *BSD IS TO all over KAmerica

Debugger (3, Interesting)

truz24 (800762) | more than 8 years ago | (#14292874)

Does anyone know of a good debugger for PHP applications? I'd like to be able to step through the execution of a php script...

Re:Debugger (0)

Anonymous Coward | more than 8 years ago | (#14292957)

ZEND

Re:Debugger (5, Informative)

warewolfe (877477) | more than 8 years ago | (#14293067)

Try phpeclipse which works within the Eclipse IDE. for info check here http://www.phpeclipse.de/tiki-view_articles.php/ [phpeclipse.de]

Re:Debugger (0)

Anonymous Coward | more than 8 years ago | (#14293185)

I've been using phpEclipse and the debugger for nearly a year now.

My review would be mixed. It certainly does help me debug, but not without issues...

I have just upgraded to a new version, and I haven't had a chance to see of those issues are still present, so I won't comment on them at this point.

Re:Debugger (2, Informative)

yahyamf (751776) | more than 8 years ago | (#14293275)

NuSphere's Phped is pretty good. It's not free though. It also has an excellent built in profiler that shows how much time each line of code takes to execute.

Re:Debugger (1)

heavy snowfall (847023) | more than 8 years ago | (#14294310)

Zend studio. Try the trial and you'll fall in love.. :) It's got live syntax checking, great, uncluttered debugging etc.. But I don't think it can connect to mysql. That kinda sucks.

Oxymoron (-1, Troll)

DogDude (805747) | more than 8 years ago | (#14292906)

everything one needs to know about building robust database applications.... with MySQL?

And if you believe that, I'm writing a book about creating mission critical, real time database apps using flat files and XML.

Re:Oxymoron (-1, Redundant)

Anonymous Coward | more than 8 years ago | (#14292972)

Well you sure don't do it with a toy operating system like Linux. You use a real operating system like solaris.

See, I can play the elitism game too.

Help is at hand (2, Informative)

adnonsense (826530) | more than 8 years ago | (#14292974)

Not great. (1)

temojen (678985) | more than 8 years ago | (#14293214)

Most of the MySQL using code I've seen out there doesn't use transactions, but instead just trusts that changes will be independent and take effect. Jumping to an ACID compliant (by default) database won't make a huge difference if you're not using proper transactions anyways. Although the better multi-join query performance may help.

Re:Oxymoron (1)

Gnight (163400) | more than 8 years ago | (#14293043)

Oh phooey.

MySQL is fine for the vast majority of applications out there. You can build robust database applications with it, no problem. Now, if what you are really trying to say is that there's better things out there, then sure I'll agree with you. But to just say that you can't get robustness out of MySQL... I don't think that's accurate at all.

Re:Oxymoron (1)

DogDude (805747) | more than 8 years ago | (#14293149)

No offense intended, but when I think "robust" I think of certain basic minimum requirements that MySQL is either lacking, or are in 1.0 release phase.

Re:Oxymoron (1)

garaged (579941) | more than 8 years ago | (#14294225)

and your that mind tries hard to make essentials for any project, and don't mind the drawbacks from one another

Re:Oxymoron (3, Funny)

SSpade (549608) | more than 8 years ago | (#14293154)

Gnight writes

Oh phooey.

MySQL is fine for the vast majority of applications out there. You can build robust database applications with it, no problem. Now, if what you are really trying to say is that there's better things out there, then sure I'll agree with you. But to just say that you can't get robustness out of MySQL... I don't think that's accurate at all.

Hmm. Certainly looks like an informed opinion, but I wonder whether it could be from someone with a bias, perhaps?

--
It compiles! Ship it!

Ah. There's the dead giveaway. Gnight is on the the MySQL Quality Assurance team.

Re:Oxymoron (1)

chromatic (9471) | more than 8 years ago | (#14294309)

Gnight is on the the MySQL Quality Assurance team.

More projects should be so lucky. MySQL has had a huge automated test suite for years.

Re:Oxymoron (5, Insightful)

kpharmer (452893) | more than 8 years ago | (#14293232)

> MySQL is fine for the vast majority of applications out there.

Ya, I've heard that line of bs from mysql for about a half-dozen years:
    - they said it when they didn't have transactions - and it wasn't true
    - they said it when they didn't have unions or subselects - and it wasn't true
    - they said it when they didn't have referential integrity - and it wasn't true
    - they said it when they didn't have triggers, stored procs, and views - and it wasn't true

Now, they've resolved *most* of the problems, and it's *almost* true. Sure, you can build robust applications with it. Of course, you can build robust applications with msql as well - it's just the extra effort that is required to achive "robustness" when:
    - silent errors and data corruption problems current and historical
    - frequent deviations from ansi sql (comments, nulls, etc)
    - simple optimizer that is notorious for performance problems on 5+ way joins
    - if you're planning on having your app run at various isps, most don't support current version - leaving you stuck historical issues (no views, etc)
    - lack of parallelism or partitioning features - giving it about 2-5% of the speed of oracle/db2/informix when it comes to large table scans (reporting, analytics, etc)

So, sure. You can build robust apps with it. But man, it is so much more work than using postgresql. Let alone db2 or oracle. Maybe this makes sense for somebody (asp model targeting large number of isps) where you can afford the economics of re-inventing the wheel since most isps are running back-level versions.

Now, this might change in two years. Assuming that MySQL comes up with a substitute for Innodb (no attractive options yet), simplifies their licensing, and resolves the most significant existing issues. Then yes, it will be a reasonable option, right up there with postgesql, etc. Until then save your licensing dollars for something better and freer.

Sure, whatever... (0)

Anonymous Coward | more than 8 years ago | (#14293823)

But man, it is so much more work than using postgresql.

Must be why everyone is using Postgess... OH WAIT! NOT!

Re:Oxymoron (1)

Karma Farmer (595141) | more than 8 years ago | (#14293869)

MySQL is a perfectly fine set of APIs to wrap around flat files. And, since the majority of websites would get by just fine with flat files with very simple file-level locking, by extension the majority of websites would get by just fine with MySQL.

However, I don't think anyone with any knowledge uses MySQL as a database. The idea is absurd.

Re:Oxymoron (1)

Jack9 (11421) | more than 8 years ago | (#14294335)

Assuming that MySQL comes up with a substitute for Innodb (no attractive options yet), simplifies their licensing, and resolves the most significant existing issues.
I'm also you don't like the licensing, but I'm not going to argue philosophy when I have the practical experience of NEVER coming up against it, over the years. I use it as a tool, not as something to repackage and resell.

Please expand on why Innodb is a valid reason to reject MySQL or even make it unattractive.

P.S.
For websites, MySQL still seems like a good choice. MySpace uses MySQL. I wonder what they would have to say?

Re:Oxymoron (2, Interesting)

bani (467531) | more than 8 years ago | (#14294490)

Sounds like a moving target to me. No matter what mysql does (or doesn't do), it will never be "good enough", because elitists will always need something to bash. Even if it was just the postgresql codebase renamed. It would still "suck" because it's "mysql".

It's just a fashionable and trendy target to bash.

Sorta like the (open|free|net)bsd zealots who bash linux. They're so insecure in their choice of OS that they need to put down something else in order to feel better.

Re:Oxymoron (0)

Anonymous Coward | more than 8 years ago | (#14293395)

You haven't used mysql in a while have you? You ought to give v. 5 a try.

Re:Oxymoron (1)

DogDude (805747) | more than 8 years ago | (#14293472)

For me, the database is the most important piece of our business. Absolutely mission critical. If a database goes down, nobody gets paid. I wouldn't even consider using any database version that is less then several years old. I'll let other people break it in and find all of the bugs and stability issues, first, before I trust my (and my employees') livelihoods to it.

Re:Oxymoron (1)

mikecito (777939) | more than 8 years ago | (#14293762)

It seems to me that using database software only after it's several years old is extreme. I mean, that would mean you barely considered moving to SQL Server 2000 last year? I can see waiting maybe 3-4 months, at most a year, but several years? It sounds to me that if your database is that important, and backups of the data just aren't enough, then you need a less stressful line of work. Stop and smell the roses, and try out new products. They have this new Windows version now that has a green start button, instead of gray. It's crazy out there!

Re:Oxymoron (1)

DogDude (805747) | more than 8 years ago | (#14294118)

ou need a less stressful line of work.

That's what happens when you own a new, small business. *Everything* is absolutely, positively mission critical, with little to no room for error. We also stay one full calendar year behind releases for our point-of-sale software since, of course, if that goes flaky, I'm equally broke. Hell, I won't even use USB devices quite yet. All good, solid, parallel port and serial port connections for our important equipment.

If our database got corrupted, for example, we'd have to take time to shut down and restore from a backup, and try to fudge all of the missing data. Some super important data, like credit card transactions, would be lost, which means than $5K worth of lost transactions means $5K lost if we hadn't settled recently. A day or two down to deal with the headache would be many thousands in lost sales, and of course, pissed off customers that may or may not come back. And, we'd have employees twiddling their thumbs. It really *is* that important from my point of view.

Re:Oxymoron (1)

ohwell (929463) | more than 8 years ago | (#14294610)

why fudge any missing data, you do use transactions don't you? Somehow I'm not believing your story one bit it seems contrived!

Re:Oxymoron (2, Insightful)

Karma Farmer (595141) | more than 8 years ago | (#14293915)

You know, there are a lot of places using databases servers that haven't been restarted since mysql v. 2 was the latest and greatest.

The fact that every six months mysql comes out with a brand new, latest and greatest, we-honestly-got-it-right-this-time-for-real version doesn't give anyone warm fuzzies.

Re:Oxymoron (0, Redundant)

gregarican (694358) | more than 8 years ago | (#14293418)

Why in the hell was this modded down as 'Troll'? Anyone who is vaguely familiar with database systems knows that mySQL is one of the more entry-level players out there. Sure for hosting a bunch of select statements it's great. But it's barely catching up with the competition by providing such _groundbreaking_ items such as record level locking, triggers, stored procs, etc. now or perhaps in an upcoming version. Plus there still are the infamous mySQL gotchas, many of which apply today as they did back in 1997 or so. Gimme a break, people!

Re:Oxymoron (1)

bani (467531) | more than 8 years ago | (#14294545)

it was modded down as troll because it was a troll.

all this database elitism smacks of the old "my amiga is better than your atari" infantilism.

only those people so insecure in their choice of software would find a need to go out of their way to bash something else.

after all, everyone with an IQ greater than a glass of water knows both postgresql and mysql suck. oracle is the only real database in the entire universe.

PHP is so 2004 (-1, Offtopic)

Anonymous Coward | more than 8 years ago | (#14292924)

Who needs to use PHP when you can use Ruby on Rails. I'm dead serious. PHP is so cryptic compared to RoR.

Multi-tier (5, Insightful)

Spy der Mann (805235) | more than 8 years ago | (#14292949)

I can't understand how a book which (according to the review) doesn't have a chapter dedicated to the concept of "multi-tier programming", can have the presumption to say it's '>everything you need'. Heck, it doesn't even MENTION templates.

As some of you know, multi-tier applications have (at least) 3 tiers: Database, business-logic, and interface. Java guys know this better: Model-View-Controller.

I have implemented for my webapps an MVC framework, and maintaining them or modifying them is a piece of cake. It's so easy i get bored with it sometimes.
In comparison, recently I've had to adapt the OSCommerce 2.2MS2 (built in PHP) for one of our clients' store. Every single php file in it has database, business-logic and interface ALL MIXED. The only separation they have is wrappers around SQL functions (that's not true separation, but a mockery). Maintaining it is a LIVING NIGHTMARE.

So please do yourselves a favor: Study the MVC approach and implement an MVC framework in PHP. You can use any templating library you can find. (for database, i use an adapted version of phplib's sql library). This alone has saved me not hours, but weeks of work, and is worth ">everything" you could learn from that book.

Re:Multi-tier (0)

Anonymous Coward | more than 8 years ago | (#14293126)

So it's your way or the highway?

Re:Multi-tier (0)

Anonymous Coward | more than 8 years ago | (#14293285)

Please. The fact that you believe that implementing an MVC pattern to organize your UI layer equates to building a "multi-tier app" shows that you actually have no idea how to implement a true n-tiered application. Maybe you could spend some time getting a clue when you're so bored with the ease of implementing MVC and let the people that know what they're talking about reply to this review.

My approach (2, Interesting)

Spy der Mann (805235) | more than 8 years ago | (#14293577)

The fact that you believe that implementing an MVC pattern to organize your UI layer

Oh please, Where did I say i used all that just to implement my UI layer?

Maybe if you paid enough attention to what I said, you'd have realized that I never implied "templates = multitier". Templates are a NECESSARY part of the view, but they alone don't make a multi-tier app.

To clarify, this is how i build my web-apps:

a) I have the main ".php" files which implement the Controller. Actually i use a prepend that includes them, but that's my approach. Each main php file has a function "handle_request()" which does all the processing. I came with this concept while studying Apache Velocity. The main php files include() the particular libraries used in the model, which is split between the business and data-tier.

b) Also, the prepend.php includes (engine.php), which itself include()s security.php. I call this is the "security tier" which lies on top of the controller. The security tier verifies that no weird requests are done, and filters the unnecessary global and environment variables. It also checks the login, session, etc.

c) For the database class I used, has two subclasses: one for reading the data, and another for writing. These can have two different users connected to the MySQL database. All database operations are done thru these classes, saving the app from SQL-injections in read-only queries. Also, having the controller embedded in a function saves us from global variables injection and other nastiness.

d) The controller arranges the GET and POST parameters into an associative array, which it passes to the appropriate business-tier function. In reality, I have the business and data-tier a little bit mixed, but it's organized enough that it doesn't give too much trouble.

e) The business-tier returns another set of parameters, which are to be passed (later) to the template (which template to use is calculated also based on GET and POST, even SESSION).

f) Finally, the controller returns in an associative array, the template file and the e) parameters to the engine.php, which uses a template object to process the output.

As you can see, while processing I do not use a single echo statement. All the data (database output) is passed thru associative arrays. In other frameworks, I'd have returned an XML string which would be passed to an XSLT engine.

So, I hope that's multi-tier enough for you. If you were so kind to show us how YOU implement your multi-tier apps (you didn't), I'd really appreciate it.

Re:My approach (1)

julesh (229690) | more than 8 years ago | (#14293805)

I'm still not sure if this is technically 3 tier, as both your business logic and UI tiers are executing in the same context.

I've worked on an app that works very similarly to that, but the associative arrays of results generated by the business logic tier are recoded into XML and passed as a result to an HTTP request from the UI tier. It's actually a trivial modification to make once you have a framework like it sounds you do, but makes a big difference in flexibility and scalability of the solution.

Re:My approach (1, Insightful)

Anonymous Coward | more than 8 years ago | (#14294041)

I believe that the poster may have been hinting at your misuse of the MVC pattern, and not your application structure per se. No Java developer worth her salt would equate the three components of MVC (model, view, controller) to business-logic, interface, and database and build an entire app that way. In any scalable tiered app that I've been a part of, MVC is used to structure only the UI layer of an application. Your app structure really only splits up your single layer app into components, which is a good start, but not truly tiered.

Re:My approach (1)

TGK (262438) | more than 8 years ago | (#14294541)

Ah! A kindred spirit. You might want to check out fusebox [fusebox.org] if you haven't allready. I find that the MVC system works wonderfully therein and that fusebox's layout system takes 90% of the headache out of the layout files.

Even though it's built to work primarly with Cold Fusion, there's a Fusebox port - which as long as you don't need to build a HUGE application works really well.

Re:Multi-tier (1)

MrCoke (445461) | more than 8 years ago | (#14293299)

Agreed. That's the way most database applications should be build if maintenance is high on the priority list.

Also: PLEASE MAKE USE OF GOOD DATABASE CONCEPTS. Foreign keys are there for a reason you know and they become really important if the application reaches a particular size. Study triggers and stored procedures. Look at the SQL execution path for hints to optimize the SQL query.

And please, MAKE USE OF GOOD DATABASE DESIGN CONCEPTS. It's amazing howmuch redundancy is build in present database applications wich is not good for performance or maintainability.

Re:Multi-tier (1, Flamebait)

temojen (678985) | more than 8 years ago | (#14293321)

So what you're saying is... Don't use MySQL.

Re:Multi-tier (1)

MrCoke (445461) | more than 8 years ago | (#14293411)

I was referring to some good DB practices, nothing more.

People should make their own opinions, not repeat others.

PS: I'm a DB2 fan

Re:Multi-tier (2, Interesting)

temojen (678985) | more than 8 years ago | (#14293491)

Fun things like (enforced) foreign keys, triggers, stored procedures, query analysis, etc aren't easy on any but the latest MySQL incarnations. But it helps to have taken a course or two in databases (mine used DB2, but I prefer PostgreSQL now as I'm now more familiar with it) so that you know that these (plus normalization) are good ideas.

Re:Multi-tier (0)

Anonymous Coward | more than 8 years ago | (#14293307)

Or just use Ruby On Rails http://www.rubyonrails.com/ [rubyonrails.com]

Yuck templates (2, Insightful)

SmallFurryCreature (593017) | more than 8 years ago | (#14293638)

I fucking hate them. Not as much as I hate people that preach about database abstraction but I do fucking hate them.

Why? Because of maintenance. But templates are supposed to make it easier to maintain aren't they.

No. Templates are there to add another layer of complexity to an app. Seperating the html from the php so that the designers are not confused? Hire better designers. Easily allow you to modify the site?

Well yeah if you think changing the color is a modification that should be in the html (should be in css) then yeah.

Perhaps I only seen bad implementiations of templates but in my experience the end result was always that you could never tell wich part of the fucking site was controlling what and that even simple modifications meant you had to figure out the template engine being used.

In my experience sites either have tiny changes that can be done by the coder and designer working together in a good team OR should have been in css anyway. The big redesigns usually require a code change anyway.

Worse, I had to handle more then one site where the answer was simple, Oh you want that change, sorry no that can't be done in the template. Template changes is for cosmetic changes, not functionality changes. Most buyers of e-commerce sites just don't seem to realize it. They think template means you can change your website. Yeah, in the same way a skin can change your winamp/xmms.

Perhaps I just build my sites wrong, I tend to make the html and php far to intertwined with a lot of the html being build by the code not just the php filling in certain blanks.

Database abstraction is usually defended by how easy it makes it to switch databases without having to switch code.

Eh yeah right. How often does this happen anyway? Like the site redesign it just is not a frequent occurence. Worse you often find that in favor of abstraction they leave out nice handy features one database supports but nobody else. Mysql_return_id. Every handy and only done by Mysql.

Again perhaps it was just bad experience but I seen several cases where the abstraction layer used did not support this feature forcing me to code around it. Extra PHP code to handle stuff already in the engine. Oh I am happy now!

The company that insisted the most on the abstraction NEVER switched in the two years I was there. Extra code extra bugs for something that is never used.

Image this in the real world. Your car doors being welded shut because one day you might want to turn it into a race car. WTF?

What is my point? Well that theory and practice do not mix. Yeah I 3 tired apps are usefull sometimes BUT that does not mean every bloody application has to use it. Database abastraction is usefull for code that is certain to grow. 99% of websites do not. Templates are usefull when you know you will get a lot of requests for cosmetic changes that are to big to complex to fit into css.

As for the whole saving you hours of work deal. At how many hours cost? I once read a quote that went something like this, "Do not code for code re-use unless you know in advance you are going to re-use it at least 3 times. Else the time coding for re-use will simply not recovered".

It made a lot of sense.

Perhaps I am just allergic to buzzwords.

Re:Yuck templates (2, Informative)

bobdinkel (530885) | more than 8 years ago | (#14294021)

Database Abstraction:
For the most part, I think you're right on about database abstraction. The vast majority or apps will never change databases. However, I think a great deal of the appeal of most DB abstraction packages is the functions. Most packages allow you to get just a single value without having to do a lot of the crap that you would normally have to do. For example, something like this:

$myVar = $db->get_var('SELECT foo FROM bar WHERE baz='123');

Or you can get results returned as an associative array, or whatever. It can save you from a lot of repeated tedium. That might not be reason enough for you to use it, but just so you're aware. Also, I'm not sure what 'mysql_result_id' is. I assume you meant 'mysql_insert_id' and if so, I've used a few different database abstraction packages and every one of them gave me ready access to that value.

Templates:
Like anything, templates can be done wrong. Really wrong. And I've seen some really bad templating. But when done right, templating can make your life so much easier. The point of templating is to make maintenance easier. But it can also make development easier. Categorically rejecting templates is like categorically rejecting user defined functions, IMO.

Re:Yuck templates (1)

Jack9 (11421) | more than 8 years ago | (#14294160)

I've never found any DB abstraction that was better than my homebrew. // Put in global include or instantiate as needed
$MySQL = new mysql_connect(); // optional: user,pass,server,db params

$query = "select foo from bar";
$MySQL->query($query); // I intuitively "see" the difference between a method and var when reading code
while($MySQL->next()){
    $row = $MySQL->get_row();
}
---
Everything MySQL can tell me, the object knows or can figure out from the query itself...yes I substr out the type of query to determine method context

I love examining implementations of SQL absractions. I'm a geek like that.

Core Web Development (3, Insightful)

ackthpt (218170) | more than 8 years ago | (#14293054)

Should include a chapter related to when to roll out changes and when not to.

Ebay changes their site, a week before Christmas. These people are stupid. These people are astoundingly stupid. If you looked up STUPID in the dictionary it wouldn't have the eBay logo, but direct you to an encyclopedia which has more space to go on about their profound acts of stupidity, when they've been stupid, how they've been stupid and how they've often failed to repeal their stupidity or even learn from it.

They aren't the only guilty ones. Less is More and too often I've had to deal with sites poorly constructed, as replacedments for sites which worked quite well.

Probably more along the lines of programing and some Gee-Whizzy things, but every web programming book should dedicate a chapter on when and how to make changes and common pitfalls to avoid.

Re:Core Web Development (4, Informative)

arudloff (564805) | more than 8 years ago | (#14293148)

Christmas is by far e-bay's lowest traffic of the year.. There's a bunch of charts showing the huge drop off, year after year, on the number of auctions starting about a week before christmas..

If someone has the link, post it? I'll see if I can dig it up.

Re:Core Web Development (1)

ackthpt (218170) | more than 8 years ago | (#14293170)

Christmas is by far e-bay's lowest traffic of the year.. There's a bunch of charts showing the huge drop off, year after year, on the number of auctions starting about a week before christmas..

If someone has the link, post it? I'll see if I can dig it up.

I'd like to see that. With all the time off work I imagine people spend more time online, shopping. I've moved a few things and find I tend to buy quite a bit over the period (often more than I should :-)

I think their biggest slack time is during the summer. Whenever I've listed items then I find sales to be very slow.

Re:Core Web Development (0)

Anonymous Coward | more than 8 years ago | (#14293693)

It's because most people realize that even if they find a good bargain on eBay a week before Christmas, they will never receive the item in time.

Re:Core Web Development (0)

Anonymous Coward | more than 8 years ago | (#14293757)

So, even though you said that eBay was "astoundingly stupid" for doing this, you can't even muster a slight excuse for being so completely off the mark? You just reply with what you "think" about their summer sales or whatever, despite having nothing to go on but your obviously flawed gut instinct? Here's some advice: stop digging and you might have a chance of getting yourself out of the hole you're in.

Re:Core Web Development (1)

op12 (830015) | more than 8 years ago | (#14293360)

Actually, it looks like traffic is still climbing [alexa.com] . Last year there appears to have been a drop-off in September or so, but that also was climbing during the holidays.

Re:Core Web Development (1)

mysqlrocks (783488) | more than 8 years ago | (#14293172)

Ebay changes their site, a week before Christmas. These people are stupid.

At a company the size of Ebay, typically web developers don't call the shots on when the changes will occur. This books is for web developers, not managers.

Re:Core Web Development (1)

ackthpt (218170) | more than 8 years ago | (#14293209)

At a company the size of Ebay, typically web developers don't call the shots on when the changes will occur. This books is for web developers, not managers.

Sure, but if managers are so stupid as to propose changes at critical junctures, where are they going to learn if not from the programmers who say, "You really can't mean this. You can't really mean to roll out big changes during the biggest commercial period of the year and when a lot of staff will be on vacation. You really can't be serious." Or has the workplace become more Dilbert-like at eBay?

Re:Core Web Development (1)

mysqlrocks (783488) | more than 8 years ago | (#14293509)

Sure, but if managers are so stupid as to propose changes at critical junctures, where are they going to learn if not from the programmers...

Didn't you get the memo? Management knows best, there is nothing they can learn from FTEs, never-mind programmers of all people. Now about that TPS report...

Re:Core Web Development (1)

nazsco (695026) | more than 8 years ago | (#14293222)

> If you looked up STUPID in the dictionary it wouldn't have the eBay logo

and that logo would be just bellow allmusic.com's, right?

Re:Core Web Development (1)

Lew Payne (592648) | more than 8 years ago | (#14293412)

| > If you looked up STUPID in the dictionary it wouldn't have the eBay logo
|
| and that logo would be just bellow allmusic.com's, right?

Seems to me that "nazsco" would qualify in the "illiterate" category, using
his "bellow" (as in accordian or glass blower) example as supporting evidence.

Re:Core Web Development (0)

Anonymous Coward | more than 8 years ago | (#14293582)

Just because you've had some bad experiences with eBay, that doesn't mean every programming book should devote an entire freaking chapter to something which is 1) obvious, 2) has nothing, really, do to with programming per se, and 3) takes about one sentence to explain anyway.

Now you may continue your incoherent rant.

Clear the soapbox (-1, Flamebait)

veg_all (22581) | more than 8 years ago | (#14293178)

Looks like CyricZ's going to be wearing out another keyboard spewing anti-php FUD.

How can anyone get so exercised about a programming language?

Re:Clear the soapbox (0)

Anonymous Coward | more than 8 years ago | (#14293433)

It's not just programming, you should see the way that guy acts on gamefaqs. It's almost depressing.

Amazon has the same review... (4, Informative)

creimer (824291) | more than 8 years ago | (#14293298)

I guess someone is rehashing this review. If you stroll down the Amazon page [amazon.com] for this book, you get the same review text found in this Slashdot article but dated 10/30/2005. So much for submitting an original review. Then again this is Slashdot.

Re: Amazon has the same re... (by the same author) (2, Informative)

MasterC (70492) | more than 8 years ago | (#14293792)

The submitter of the review on amazon is "John A. Suda" and the submitter here is "jsuda" AND his amazon nickname is "jsuda1". I give it a 99.9999% probability that "John A. Suda" (aka "jsuda1") and "jsuda" are the one and the same. jsuda, here, just apparently decided to wait...almost two months before submitting it here.

Parent got it right on it not being exactly an original review, but at least Joe Bloe didn't (well, 0.0001%) submit John Suda's review.

Re: Amazon has the same re... (by the same author) (3, Informative)

creimer (824291) | more than 8 years ago | (#14293881)

The text violated the Slashdot review guidelines: "If you've reviewed the book elsewhere anywhere besides a personal home page (for instance, on Amazon) please be sure that your review for Slashdot is substantially different."

Re:Amazon has the same review... (1)

Lord Duran (834815) | more than 8 years ago | (#14293854)

You do know it's the same guy, don't you?

where can I download this book? (-1, Flamebait)

Anonymous Coward | more than 8 years ago | (#14293346)

Why should I have to pay for this book?

Books should be free.

The writer can make money by providing support - like answering my questions or better yet...he can get a job flipping burgers.

Re:where can I download this book? (3, Funny)

digitaldc (879047) | more than 8 years ago | (#14293523)

Books should be free.

They are free at the local Library.

Re:where can I download this book? (1)

Shakes268 (856460) | more than 8 years ago | (#14294158)

And with google's new technology, we won't even have to go the library!

I'm holding out for (1)

melted (227442) | more than 8 years ago | (#14293416)

"Core strategic web application paradigm development with AJAX, Synergistic go-to-market edition"

Ep? (-1, Offtopic)

Anonymous Coward | more than 8 years ago | (#14293438)

your own bber for a living got To them...then to stick somethinG Don't walk around And easy - only Rivalry. While

Wondering About the Blog Engine... (1)

jonbeckett73 (847732) | more than 8 years ago | (#14293593)

Having written a blog engine [pluggedout.com] myself using PHP and MySQL and given it away as open source, I'm wondering what he calls "robust code" too... I'm a professional developer in the daytime, and no book code I have ever seen has been good enough for other people to pick up easily (not enough conventions etc).

If you're interested in my project by the way, head on over to the PluggedOut Blog [pluggedout.com] project.

Re:Wondering About the Blog Engine... (0, Flamebait)

CuratorTom (181103) | more than 8 years ago | (#14293758)

Has anyone not written a blog engine in PHP? That's the kind of thing we do when we're bored, isn't it? Here's my 3-hours-one-night hack: PolkaDot [freshmeat.net]

Re:Wondering About the Blog Engine... (0)

Anonymous Coward | more than 8 years ago | (#14294234)

That's a pretty smug thing to say. They guy goes on about his pride and joy and you have to belittle his efforts because you've already done it. Way to go.

- DJNewStyle (Too lazy to register)

Re:Wondering About the Blog Engine... (1)

CuratorTom (181103) | more than 8 years ago | (#14294321)

It was just a joke. His is a full-blown system and mine is a little hack. I wasn't making a serious comparison.

That said, there are an awful lot of PHP-based blogging systems out there. (Mine being probably the simplest and least powerful.)

Save SEVEN ($7) Bucks! (2, Informative)

Anonymous Coward | more than 8 years ago | (#14293642)

Save yourself $7 by buying the book here: Core Web Application Development with PHP & MySQL [amazon.com] . And if you use the "secret" A9.com discount [amazon.com] , you can save an extra 1.57%!

Re:Save SEVEN ($7) Bucks! (1)

0x20 (546659) | more than 8 years ago | (#14294374)

hey, thanks, kaleidojewel-20^H^H^H^H^H^H^H^H^H^H^H^H^HAnonymous Coward! what a generous, and completely selfless, act of hotlinking.

php- web is about the libraries (1)

acomj (20611) | more than 8 years ago | (#14294162)

PHP programming is becomming about the libraries. Smartyhttp://smarty.php.net/ [php.net] - a template library makes putting coherent websites together easier. Although it doesn't do anything for the database part of the site, its one less thing to worry about.

  PEAR confused me and I was programming before it so I have my own libraries. The php web documentation is excellent.

although the java studio creator is now free, and seems like an amazing tool, its not enough to get me away from php
http://developers.sun.com/prodtech/javatools/jscre ator/reference/quicktour/2/flash/index.html [sun.com]

Finally! (3, Insightful)

Qbertino (265505) | more than 8 years ago | (#14294215)

A book on PHP and MySQL. I've been waiting for this for ages!
Really, this is just what we needed.
Load More Comments
Slashdot Login

Need an Account?

Forgot your password?
or Connect with...

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>