JS301 Week 2: Advanced Functions, the DOM & jQuery

This week we’ll get into the power of functions in JavaScript without going quite as far as objects.  We will look at variable scope and closures, which are key JavaScript concepts.  We’ll then look at some basic DOM manipulation and jQuery.  You can view the slides on Google Docs (ppt, pdf).  As always feel free to post questions or other feedback here.


JS301 Week 1 Slides

I’m starting the TUG Night School JS301 class this evening.  In the past I’ve put the slides up on the same day as the class in a private members only site for students.  This time around I thought I’d post them here for anyone who might be interested to see.  Feel free to post thoughts or criticisms.  I’ve published the week 1 slides (PDF, PPT) and a start on the week 2 slides in case we run out of material.  Its hard to know how fast a class will move until you’ve met the students.

SOLID PHP & Code Smells – Part 2: Open / Closed Principal

This is the presentation I gave last night to the GTAPHP Meetup Group about the Open/Closed Principal – the ‘O’ in SOLID. The idea is to provide strategies for code re-use which allow you to leave your debugged code alone when extending it for new features. We look at the classical OOP inheritance pattern, the Template Method pattern, the Data Mapper pattern and the Strategy pattern in this presentation.

Here are my own notes I used during the presentation so I wouldn’t get lost with my code edits:

You can work through all the key checkpoints in the refactoring process by following the commits on github.


SPIL: A Non-Framework Proposal for PHP

Update: Now on github.

I’ve just finished listening to the second /dev/hell podcast from Chris (my GTAPHP co-organizer) and Ed where they discussed a big problem with frameworks in PHP.  They’re too big, and its too difficult to extract only the functionality you want without bringing over a whole pile of dependencies at the same time.  I’ve been unhappy about the same kind of problem.  I’ve been looking for a new CMS, and it drives me nuts that big CMS’s include their own frameworks instead of building on existing frameworks.  There are exceptions, but generally a CMS includes its own framework.

Listening to Chris and Ed got me thinking about this, and about another pet peeve of mine with PHP frameworks.  They don’t tend to make good use of class interfaces, depending instead on concrete classes.  If they worked with interfaces then it would be easier for frameworks to share common code, and for CMS’s to build on common code.  I have a modest proposal to address this problem…

Read more…


SOLID PHP & Code Smells – Part 1: Single Responsibility Principle

Update: Now on github

These are the slides from my presentation to the GTA PHP Meetup Group last night. Thanks to everyone who attended for your questions, and for hanging on with me while I debugged some unexpected issues while refactoring. I will post again when I have the source up on git if you want to try your own hand the same changes, or your own changes.


Traits in PHP 5.4

Traits in my opinion are the greatest thing to happen to PHP since PHP 5.  They provide a way to re-use code between otherwise unrelated classes.  I’m giving a talk on traits at tomorrow night’s GTA-PHP Meetup with just a few slides:

The bulk of the talk will be actually trying some demos I’ve prepared. You can get them from my github. I’ve included README.txt files which describe what each demo is about in case you can’t make it out to the meetup, or you’ve found this after the fact.


Introduction to MySQL

On top of my Cloud track to TEC 20ii I’m doing two of the LAMP track sessions.  Here are the slides for my introduction to MySQL:

Introduction to MySQL

If you’re new to SQL this might be useful to you.  My other LAMP track session is on PHP security.  I should have those slides up tomorrow.