What is Larry Thinking? #23 => MVC, Open Source, Git, and Programming

October 30, 2009

In this edition…

About this Newsletter

Just a basic, getting-this-going-again newsletter, with some suggestions for things you could check out and some updates on what I’m up to. The next newsletter will have a giveaway (my PHP for the Web book, plus some foreign language editions). As always, thanks for reading and please do let me know what comments and questions you have!

On the Blog => Understanding MVC

I’ve recently wrapped up two Web sites that used the Yii framework (for PHP) and have been meaning to write about various Yii-related topics in my blog. But first, I figured it’d be worthwhile to add some thoughts on the MVC (Model, View, Controller) design pattern, to give a sense of overall architecture. The first of three posts on that topic can be found here. Specific Yii posts should be going up soon.

In the Forum => Being Self-Taught

Someone asked me in the forums how I learned all this stuff myself. You can read my reply, as well as some input from others, there.

On the Web => Best of Open Source Software Awards

InfoWorld released their awards for the best open source software a few weeks back. As a person that uses a ton of open source stuff, it’s always good to see what other people are touting. It’s a thorough article, full of tons of recommendations, organized by category, but you have to read it carefully to find all the names and then search online to get to their Web sites (i.e., no direct links).

On the Web => Git: Your New Best Friend

I’ve been asked in the past which version control package I prefer to use. Now, to be completely honest, I don’t often use any version control package, only because of the development situation I’m in. I’m normally a one-man operation, so I create an entire project on my computer, polish it up, then present it to the client on a live server. Subsequent changes are relatively minor and can be done either on my own computer or on the live server, requiring alterations to just a few files. When necessary, I use my FTP program’s synchronization feature to only upload or download changed files. It’s a simple and reliable process that works for me. But it’s not for everyone, so if you have the need for version control, I’d recommend Git, created by Linus Torvald (the guy that created Linux). It’s comparatively simple and easy to use. For an introduction to Git, check out this article at Sitepoint. It’s a basic introduction, but, like many on the subject, only discusses using Git on one computer. You’ll need to use the follow-up resources (at the end of the article) to learn about using Git between a live server and your computer, which is where version control really matters.

I’ll add that when you go choosing a version control package, you should look into whatever your text editor or IDE supports, if applicable. Being able to work with the version control software directly in your development application saves you the added steps of using the file system or the command line to download and upload versions of the code.

On the Web => Titanium Desktop

As anyone that reads my newsletter and/or blog know, I’m a big fan of Adobe’s AIR technology for developing cross-platform, desktop applications. I generally lean towards using open-source solutions, but I don’t see a problem in advocating or using AIR, as it’s both free to develop with and free for the end users to install. But I thought it’d be worthwhile to mention an alternative to AIR (I haven’t personally used it, though). Titanium comes in both a desktop and mobile phone version and uses your basic Web technologies—HTML, CSS, and JavaScript—plus Python and/or Ruby for development. The development process seems quite different than AIR but it similarly outputs executables for Windows, Linux, and Mac OS X.

Q&A => How do I improve my programming skills?

The formal question I received (some time ago) was “As someone who only has a few hours a week, maybe 5 or 6 at the most, to sit down and code PHP while trying to learn – what would you suggest a good way to make sure a person would move from the basic to more intermediate programming? At the same time building up on the base of knowledge.” Given those parameters, my answer is that I would probably spend half my time reading a varied list of sources: books, online articles, forums, and newsgroups. The last two are great for real-world examples and help, but they tend to lack the cohesion and complete context you get from more formal publications. Then spend the other half of your time implementing some of the new ideas you run across, or coming up with your own challenges to solve. In a self-referential way, I’m a big advocate of learning by both reading and doing.

Q&A => How do you organize your code library?

This is a very good question and many might be surprised to know that I don’t really have a good system (nobody’s perfect). I’ve created a folder template system that I just copy for new projects (assuming I’m not using a framework). It contains default directories, a basic index.php page, HTML header and footers, a MySQL connection script, and a configuration file. Other than that, I normally just go into the PHP scripts for previous projects and copy out functions or files as I need them. This works just fine for me but, as with many things, if you’re in a team or different environment, you’d likely need something more formal and developed.

What is Larry Thinking? => Mac’s Snow Leopard Release

As I’ve made quite clear, many times over, I’m a pretty big Mac fan, perhaps even an evangelist, although I feel like my esteem for Apple’s products has tempered some over the years. I think Apple does user interface exceptional well but, more importantly, I think they make great business decisions. Finding ways, through the iPhone and iPod, to sell Apple products to non-Mac users was brilliant. Although, on the down-side, when it comes to MP3 players and cellphones, Apple now behaves in much the same way that Microsoft did for all those years (for which Microsoft was justifiably criticized). But I digress…. What I was thinking about recently was the latest release of the Macintosh operating system, Snow Leopard (aka version 10.6).

What I think is brilliant and courageous here is Apple’s decision to release essentially a maintenance and performance version of the OS. There are some new features, yes, but nothing ground-breaking. Or nothing ground-breaking up front. The new OS is 64-bit, which is great, but not something the end user will necessarily notice. The new operating system is simply faster, more stable, and contains less bloat than its predecessors. And that’s a bold change to make. Perhaps because users expect as much, but software developers of all types have gotten into the nasty habit of just adding more and more features in each new release. Maybe this justifies an upgrade price, maybe it’s just a matter of responding to user demand (which is valid), but I think we all know that anytime you add features to an existing application (Web or desktop), there are negative consequences, be they mere performance or outright bugs. So doing a release that’s just better, without being flashier, is bold. And smart. And to only charge $29 (US) for it is fantastic.

Clearly, not all situations make this kind of upgrade possible, technically or from a business perspective. But it’s something to keep in mind the next time you go to “improve” something you’ve already created.

Larry Ullman’s Book News => E-commerce, Flex, JavaScript

So, to start, I was to have written and publish an e-commerce book (using PHP and MySQL) this summer, but because of the unexpected events, I was unable to even begin the title. That project is still in the works but, unfortunately is still delayed. New Riders has hired me to write a Flex 4 book, which I’m very excited about. Because Flex 4 is being released sometime in early 2010, the Flex 4 book will be timed accordingly, therefore bumping back the e-commerce book again. I’m sorry it worked out that way, but it makes the most sense. On the bright side, PayPal recently changed its API, so when I do write the e-commerce book I’ll be able to take advantage of that change.

I’m also still planning on doing a self-published JavaScript book, to be readable for free online or in a paid PDF version (maybe $5 US). Yet again, I’ve got a new tool for the job, which hopefully will be the last change I make. Originally I thought I’d do it in wiki format, which is great for Web pages and allows for easy reader feedback, but isn’t so great for creating PDFs. Then I thought I’d use Apple’s Pages program, mostly because it’ll create the table of contents for me (not the best justification), but generating the HTML will be a challenge. Now I’m thinking I’ll use Adobe’s InDesign, which is a professional layout tool (my formally published books are done using it) that can turn out both Web pages and PDFs. Plus it’ll also self-generate the table of contents for me. Anyway, I’m still working on this behind the scenes but have no expected release date as of yet. My hope will be to wrap it up a few minutes before all the content becomes obsolete!