Archive for the ‘PHP’ Category

I’m Taking This UC Berkeley SaaS Course

Wednesday, May 16th, 2012

Software Engineering for SaaS | Coursera.

I’m enrolled in this UC Berkeley SaaS course. The cool thing is that some of my Ruby and PHP students will be in the course too. The course starts May 18, so you’d better get with it if you want to hang with us.

I’ll post about my experiences as I go along. This will be all new to me, and I’m looking forward learning the cool stuff that the cool kids are doing.

The Singleton Design Pattern in PHP

Thursday, May 3rd, 2012

The Singleton design pattern creates a class that can only have one instance. This is useful for tasks such as creating a globally available database connection for your script.

The prototype for the singleton class, in PHP, goes like this:

Singleton Pattern

class ClassName {
    static $instance = NULL;
    private function __construct() {}
    private function __clone() {}
    static function getInstance() {
        if(self::$instance === NULL) self::$instance = new ClassName();
        return self::$instance;
    }
}

$obj = ClassName::getInstance();

It’s All About Scope

PHP variables have scope restrictions that prevent them from being visible in all parts of your program. We often need these variables inside classes and functions. One way to provide globally accessible variables is to pass them into classes or functions as parameters. This method makes it clear that the function of class method is dependent on an external variable or object. Here’s an example:

(more…)

Heads Up

Monday, February 20th, 2012

This site is in transition while I migrate my PHP and Ruby courses over from CCSF and CSM. Though the California Community Colleges are sinking (ever so slowly and painfully), I do have time to move my courses and ensure that they will be available to anyone who’s interested in getting into Web programming.

Courses
My introductory PHP and Ruby courses will be available June 1, 2012. Eventually my Python and HTML5 courses will make it over. My college courses run for 18-weeks, but I will be rewriting my WiseBison courses to be self-paced, modular, month-long classes.

Besides putting my the courses here, I’ll have my blog, code tips, PDFs, free stuff, and reviews. If you’re  interested in updates while I’m getting set up, sign on to the RSS feed.

Keep hacking…

Relaunching Wisebison.com

Wednesday, January 18th, 2012

Welcome to WiseBison.com. This web site will be the home of my CCSF and CSM Ruby, Python, and HTML5 courses. The courses will cover the content of in my college classes, with the same reading, coding assignments, and quizzes. The courses will all be self-administered and self-paced. I will eventually create some short-term instructor-led (by me) courses around these topics. The first courses will become available June 1, 2012.

This will also be my blog, replacing my HackingtheValley.com blog. Check back now and then to see what’s going on, or sign up for the RSS feed to stay up to date.

Keep hacking…

Learning PHP by osmosis

Wednesday, May 11th, 2011

Kids say the darndest things. I’m talking about 25-year old guys who end up in my PHP class. One student—I’ll call him Werner—was having a hard time understanding the concept of True and False.

“So, tell me what programming languages you know,” I said.

“None,” he said. “But it’s not a problem. I can learn anything.”

“How’s that?” I asked.

“I have a special knack for learning. I can just absorb knowledge. I can walk into a room where people are speaking a foreign language and an hour later I can carry on a fluent conversation.”

“That’s a gift,” I said. “What languages have you learned?”

“Farsi, Greek, Mandarin, German, and Italian, all in one summer when I was traveling through Europe.”

“Say something in Mandarin,” I said. I happen to know a little Mandarin.

“Oh, that’s not necessary,” Werner said. “It’s something I can do in the moment, when I’m in the flow of the conversation. But I’m having trouble with this PHP. It’s not coming to me yet and it’s bothering me. Really, I should be on top of it. I have so many great ideas for making money, if this PHP would cooperate. Maybe it’s something you’re not doing.”

“I don’t get it.”

“I learn by osmosis, like I said. If I’m in the room with you, I’ll absorb everything in your head. My roommate works at Yahoo and he’s always hacking on PHP at home. That’s how I learned PHP, by being there when he’s hacking. I think you must be blocking the osmosis.”

“Got it,” I said.

He dropped the course after a month of waiting for the osmosis to kick in. I saw him a couple of years later. He was taking an intro Java course.

“I figured out that it wasn’t you. Osmosis doesn’t work for programming languages,” he said. “So I’m doing it the easy way, just taking courses. Anyone could do it.”