What is Larry Thinking? #25 => Ajax, PHP vs. ???, and Starting a New Business

February 2, 2010

In this edition…

About This Newsletter

Not much to say as an introduction: it’s another newsletter, without a cohesive plan. Although it did cross my mind that I could come up with a more clever title than “Larry Ullman’s Newsletter” (or my blog, “Larry Ullman’s Blog”). My thanks to everyone for their nice words on these newsletters and please keep those comments and questions coming!

On the Blog => Access Control and Authentication in Yii

A couple of weeks back I completed a three-part series on authentication and authorization using the Yii framework. If you’re curious about this aspect of the framework, start with the first post on Simple Authentication. Also, it looks like the blog is on a restricted diet (fewer posts) while I continue working on my next book.

On the Web => HTML Purifier

Some time back I came across HTML Purifier. Written in PHP (it requires PHP 5), HTML Purifier is a standards-compliant HTML filter. It can be used to prevent Cross-Site Scripting attacks (XSS), improve the compliance of HTML entered by a user, and even convert deprecated tags into more-appropriate ones. To see it in action before installing it yourself, check out the online demo.

Q&A => How do I go about learning Ajax?

It seems like what is expected of Web developers has changed significantly over the past couple of years. Maybe it’s the economy, maybe it’s the changing technologies and the demands created by that stupid “Web 2.0” buzzword. In any case, where you used to have Web designers that created HTML and JavaScript (or it was created for them by Dreamweaver) and Web programmers that used PHP to add server-side functionality, Web programmers are now expected to be more familiar with the client-side of things. Part of the cause is the rise of Ajax, which marries client-side JavaScript with server-side functionality. Also, it’s a lot easier for a Web programmer to learn JavaScript than it is for a Web designer to learn PHP (and SQL and MySQL). So how do server-side people go about learning Ajax?

To start off in a totally self-serving manner, I’ve written a chapter on Ajax in my “PHP 5 Advanced” book as well as written an entirely separate book on Ajax: “Building a Web Site with Ajax: Visual QuickProject Guide”. Both cover the theory and just enough JavaScript (a new acronym: JEJ) to create smart cross-browser Ajax applications. The dedicated book has more examples and gives a fuller sense of Ajax’s possibilities, of course. Another way I’d recommend learning Ajax would be to just start with a framework like jQuery (in my books I write Ajax code from scratch). The learning curve is a lot more approachable this way, you just need to accept that you won’t be truly learning Ajax or JavaScript, but sometimes that’s okay and having something that just works is most important.

Q&A => PHP vs ASP.NET vs ???

I just recently received a question about choosing PHP over ASP.NET, or whether there’s a value in knowing both, or something else, for dynamic Web development. I’ve covered this before in my newsletters but it’s worth revisiting. I’m of the opinion that it’s best to be fairly strong with one thing than mediocre with several (I mean that with respect to competing technologies like PHP and ASP.NET, not companion technologies like PHP and MySQL). I’ve developed most of my Web applications using PHP, I’ve done a couple with ASP.NET, a couple with Ruby on Rails, and a few pages here and there using JavaServer Pages (JSP), so I have a fairly decent understanding of the available tools (I’ve never used ColdFusion, however).

The problem with ASP.NET, in my opinion, is that it only runs on Windows and can only be developed on Windows (this is more functionally true than actually true as there are ways to force ASP.NET onto other platforms). This is a show-stopper for me. But if you’re dedicated to only using Windows for development and for hosting, ASP.NET is pretty powerful and easy enough to learn. You’ll spend more money going this route, though: the serious tools, like Microsoft’s Visual Studio, are very expensive, as are add-ons you might want to use in a site. For example, one ASP.NET project I did required a forum. Instead of creating my own, I thought I’d use a standalone product that could be integrated (as I would do in a PHP site). The only available third-party products were all commercial; there was nothing freely available like Phorum or phpBB. Conversely, PHP can be run on most operating systems and there are tons of free add-ons available. Personally, I don’t see a justification to learn ASP.NET if you’re already doing PHP development. (And, if you’re curious, I learned ASP.NET because: A) I like learning new things; B) Microsoft had me up to their headquarters to show it to me; and, C) there were a couple of jobs that I wanted to do that required ASP.NET).

If you’re already primarily an ASP.NET developer (you’re probably not subscribed to this list but…) there may be a value in learning PHP so that you can develop on other platforms. But you’re likely to find PHP to be harder and more time consuming, as it’s not really comparable to ASP.NET. The latter is actually a framework, and C# or Visual Basic is used for the programming.

All that being said, the hardest part of Web development is understanding the theories and best practices. From there, switching from one technology to another is largely about syntax. So I’m not inclined to recommend learning multiple Web development technologies, but if you want to try, it’s not that hard as they’re functionally similar.

Q&A => Do you do any social networking?

I am occasionally asked if I use any of the social networking sites: Twitter, Facebook, MySpace, etc. I’m not personally inclined to do these kinds of things, although I understand there could be a marketing benefit to doing so (but, then again, marketing isn’t my strong suit). Twitter is out for me because I’m not a cell phone person, so the idea of sending and receiving updates through Twitter is beyond me (I know Twitter isn’t just for cell phones but…). I do own a cell phone, but only one person has the number, so that probably tells you what kind of mobile user I am, or am not. But really, with Twitter, the fact is that my life is extremely mundane, so the idea of tweeting updates like “Trying to get through another chapter” and “Have to hit the grocery store before picking up the kids” doesn’t make much sense. If I traveled more, or did anything that interesting, maybe I’d feel differently. Also, to be frank, I have this (arguably unreasonable) dislike for fashionable things, so every time I hear about Twitter, I’m that much less likely to use it myself!

Still I have been a member of LinkedIn, however, for a couple of years. I’m not terribly active with it and it largely strikes me as Facebook for professionals but if you want to connect with me there, you’re more than welcome.

What is Larry Thinking? => Starting a New Business

In my first newsletter, I address a subject that’s come up a lot, both with me and in the industry as a whole: creating new Web sites and businesses. One time in 2002, I was part of a team that tried to create a new venture and failed. In my opinion, it failed not because of a lack of a good idea or resources, but mismanagement. I certainly don’t regret being part of the venture–it cost me nothing but some time, and I made a lot of great connections, but it made me leery when I encounter others trying to make it big. Which I do a lot, as many who read my books have similarly large dreams. I don’t begrudge people their hopes and aspirations, of course, I just want to caution everyone against putting themselves too far out on a ledge because the statistics say that most ventures won’t succeed. It just troubles me greatly when I get people asking about spending thousands of dollars on a server when they haven’t created a line of code or even purchased a domain name.

My point in revisiting this topic is that the most brilliant writer Malcolm Gladwell in his “The Sure Thing” article published in the January 18, 2010 issue of “The New Yorker” talks about business success in an enlightening way (pretty much everything you read by Gladwell will enlighten you). A paragraph about new businesses really struck a chord with me. In it, Gladwell documents the certain qualities that successful new businesses clearly have. For example, the more initial capitalization (i.e., money), the better. Taking over an existing business is more likely to succeed. Selling to other businesses is easier than selling directly to consumers. And it’s better to go after missed consumers than those already being served. Most new businesses don’t do these things (not that they’re necessarily possible for all new businesses anyway), and they also undervalue marketing and finance. In short, many new businesses fail because they don’t have a full, working plan established. And my point, which I’ve said before, is that just having a good idea does not equal success. Adding X feature to a YouTube copy won’t make you rich (and, frankly, by the time you implement that new feature, one of the hundreds of smart people at YouTube will likely have thought of it and implemented it themselves).

Again, I’m not trying to dissuade anyone or rain on their parades, but if you’re asking me for business advice, which people often do, my suggestions are: plan way ahead, spend money wisely, and try to have realistic expectations.

Book Giveaway => PHP for the Web: Visual QuickStart Guide and Translations

I had a strong response to the PHP for the Web: Visual QuickStart Guide giveaway. My thanks to everyone for their interest and my apologies if you did not get picked to receive a book. I haven’t yet sent out the books (been working too much) but really hope to this Friday. All I have left to giveaway are some translations, so my next official giveaway will be the Effortless Flex 4 Development book later this Spring. (Please don’t ask now, or ahead of time, for a free copy.)

Larry Ullman’s Book News => Effortless Flex 4 Development

I’ve finished up the rough table of contents for my next book, tentatively titled Effortless Flex 4 Development (I forgot to add the “4” in the previous newsletter). My approach is this: when talking about Rich Internet Application’s (RIAs), a lot of focus is given to the User Interface(UI) because RIAs provide a user experience closer to what they come to expect from their desktop applications. However, I would argue that data is just as important. So the book does cover Flex 4 for those unfamiliar with it (whether new to Flex or just to Flex 4) but the meat of the book will be on using data. Specifically, I’ll be using PHP as the server-side agent, and a combination of data formats (JSON, XML, and AMFPHP). The data and PHP emphasis is one way in which the book will differ from existing ones; plus, PHP support is a promoted feature in Flex 4.

I’ve also written the first two chapters of the book, about 60 pages. Apparently I’ve forgotten how hard it is to write a book, or maybe I’m just rusty. I’ll continue to post updates on the book as it progresses.

Later this year I’m still planning on writing my E-Commerce with PHP and MySQL book, and hopefully even my self-published JavaScript book. If I get my act together, my site for selling PDF copies of the JavaScript book will make for a good code example in my e-commerce text.