Skip to content


Understanding MVC: The Basics

This entry is part 1 of 3 in the series Understanding MVC

I’m planning on writing several posts on the Yii framework (for PHP 5), which I’ve been using for the past several months. Before getting into that, though, I thought it’d be worth while to write about the MVC—Model-View-Controller—architecture first. MVC (first defined 30 years ago!) has become a standard approach for frameworks and many other types of application development, where the emphasis is on separating presentation from logic. By taking this route, you can more easily tweak individual parts without (hopefully) breaking the whole.

The basic concept is relatively simple to understand, but I found that the actual implementation of the pattern can be tricky. In other words, it can take some time to master where you put your actual code. In this post, I write about the individual pieces and how the relate to each other. In a follow-up post, I’ll write about how to communicate between them, and what in the world $this means at any particular point! Continued…

Posted in PHP, Web Development.

Tagged with , , .


Useful Web Development Sites

I’m constantly running across different useful sites when it comes to choosing a Web page’s HTML, formatting, CSS, fonts, layout, and so forth. Here are a couple of notable ones:

FontTester, as you might expect, lets you play with different CSS and HTML options to adjust what fonts you use and how they are formatted. The page starts with up to three columns of sample text at the top. Then you can edit the properties of the individual columns to compare and contrast different effects. Once you have the look you like, including color, line height, indentation, and more, you can copy the corresponding CSS.

If you’re new to CSS, you might want to check out CSS Basics. I think it’s a fairly straightforward, easy to understand introduction to Cascading Style Sheets. Once you’ve grasped CSS fundamentals, and found yourself wanting more, check out the exhaustive 84 Amazingly Useful CSS Tips & Resources. There are links to LOTS of good content there; just give yourself time to kill and don’t forget to take good notes!

Once you’ve got a site fairly well developed, you ought to do the professional thing and check its accessibility. This is a pretty easy step to skip, especially if you don’t have personal experience in accessing sites using non-standard tools. Sitepoint put together an article worth reading called 12 Tools To Check Your Site’s Accessibility. Some are software plug-ins that work with Dreamweaver, Eclipse, Firefox, or Opera; other tools are Web based, just like those used to validate a site’s HTML. Besides increasing the potential number of viewers for your site, making it universally accessible may even be something that’s mandated by the client. For example, I do a lot of work for educational institutions and the federal government, both of which insist on sites being accessible.

Posted in Web Development.

Tagged with , , .


JavaScript Block Comments

I ran across an interesting little tidbit in a JavaScript book, I think, or online. Likely I saw it in something Douglas Crockford wrote, but couldn’t be certain. Anyway, it has to do with comments in JavaScript. The language supports two comment types:

1. Single line using the double slash:

// This is a comment.

2. Multiline (also called block) using the slash-asterisk combination:

/* This comment
can go over multiple
lines. */

The argument made (wherever it was made) is that you shouldn’t use the multiline comment style as the */ character combination can appear in JavaScript code. Namely, it might appear in a regular expression match, when slashes are used to delineate the pattern and the asterisk is a pattern modifier that looks for zero or more of something. A syntax error will arise if you use block comments around some code that includes a problematic regular expression:

/* some code
var x = 'some string'.search(/[a-z]*/g);
some code */

That’s obviously a useless example in itself, but it shows a situation in which a problem is caused by using block comments.

All that being said, I wouldn’t suggest that you avoid using multiline comments. They’re quite handy, both for adding lots of documentation and for debugging purposes (by making blocks of code inert). But the potential conflict is something to be aware of, particularly when you apply multiline comments to render some code non-executing and all of a sudden have a syntax problem.

Posted in JavaScript.


Blog Returning

Well, it’s been a rather rough couple of months for my family and I. My wife had a serious health issue and then we moved to another state. Hopefully things have settled now, as much as they will, and we’ve returned to a new variation on what is normal for us. I’ve finally caught up with my support forum (although if I missed a post, please let me know) and am working on getting through my accumulated email. In the next week I intend to start regularly posting in this blog again. I’ve got a few bits of news to report upon (things going on in the industry), and a lot more to write about the Yii framework. As always, I thank you for your interest in what I have to say. My sincerest thanks to those who’ve offered support and kind words over these trying few months.

Posted in Uncategorized.


Blog Offline Until Further Notice

Due to a serious personal emergency, I will not be able to maintain my blog—submit new posts or approve and respond to comments—for the foreseeable future. My apologies to those actively reading this or paying for it through Amazon’s subscription service. My thanks in advance for your well wishes.

Posted in Uncategorized.