2007-03-01

PHP Arrays

Some day I'm going to come back to these posts and laugh at myself for being such a newb. Those of you who already know all this stuff have the pleasure of laughing at me right now.

I finished the HTML/CSS course, and it was about as easy as I expected. Aside from being pissed off for a few hours during the final assignment before discovering the difference between quirks mode and strict mode (which wasn't addressed in the course), it wasn't difficult at all.

It would be less confusing to the student if they gave more robust example code, though. I had a bit of a time trying to get their code for vertical CSS buttons working right until I tried it in IE. Suddenly it worked. When I found the tiny bug and pointed it out, my instructor's response was, "too bad all browsers don't render the same." Yeah. Thanks. I know you require your students to use IE, but how hard would it be to support other browsers? When your target audience is people who want to learn open source languages, you can assume that a larger than normal percentage of them will be using an open source browser. It's not as though what you're teaching is complex enough to require special CSS hacks, it's all pretty basic stuff.

The only HTML I've used in the last couple of years has been in my blog templates, and while I came away from this course with a handful of new tricks, the main thing I got out of it was a chance to hone some rusty skills.

Still, I was happy with it. It's a well-written course.

Introduction to PHP, on the other hand, is not. It was very obviously written by a (messy) coder, not a teacher. The first five lessons consisted of a collection of little tricks buried in an ever-growing spaghetti bowl of ugly code. Each new concept was shoehorned into the same snowballing mess, regardless of whether it made sense to do so.

Teaching a neophyte this stuff is hard enough without tossing ugly and irrelevant code in front of him. The person who wrote the example code is probably proud of some of the little hacks in it, but when those hacks are extraneous to the lesson they're just distracting. It's a bit like trying to teach a kid about baseball and suddenly interrupting yourself to talk about valence levels. Yes, from the right perspective, it's related. But just offer up the most relevant material before going there.

I managed to simplify the examples enough so they made sense, then figure out the small hacks later, but it took a lot of needless slogging.

They finally dropped the tangled ugly mess of snowballing code and started fresh in lesson six, and it suddenly got easier. Which is good, because lesson six was arrays. Clean examples helped tremendously. I can't imagine if they'd tried to shoehorn arrays into that other crap.

I didn't like this section. I "get" arrays just fine, but one of the assignments involved traversing through a nested array, which is a lot easier if you're not using PHP 4 (the version they teach with), which lacks the array_walk_recursive() function. Of course it's doable, and I have to admit that I learned more figuring out how to work around the lack, but it ticked me off having to write twice the code I would have had to if I'd been using the version of PHP I have installed on my own fucking computer.

I'm not old-school enough. I can just hear the old dogs saying, "Son, in my day iterating through an array meant keeping track of the keys' addresses in memory. So you had to use a few ifs. Get over it."

To that, I say "shut the fuck up, old-timer." If I've got access to a post-hole auger I'm not going to be happy about having to spend three hours sweating with a clam-shell digger. Yes, yes, I know. I learned more by hacking around a missing feature than I would have if it had been handed to me. I appreciate that. I just didn't enjoy it.

And that, I see upon re-reading, is a big fat lie. I hated it when I was doing it, but having done it feels pretty good. You old dogs already knew I'd say that, didn't you? I can hear you chuckling to yourselves.

I'm not quite halfway through this course and I already enough to know that, at the end of it, I won't know anything. It'll be like spending two years in art school having learned nothing more than how to hold a pencil. Hopefully I'll know enough to confidently dig myself out of my own holes. (I didn't plan that last sentence when I wrote the bit up there about clam-shell diggers, but it worked out well, didn't it?)

I'd be extremely interested in hearing stories of what it was like for you to learn programming. What language did you start with? Would you have started with something else? What concepts baffled you, and what "aha" moments got you over the humps? What approach did you take? How long did it take for you to feel proficient? What would you have done differently? What did you do exactly right? What was your frustration:fun ratio back then, and what is it now?

Go ahead, get nostalgic.

Labels: , ,

2007-02-23

Another excellent day



I feel like running around in the yard yelling "The new nerd books are here! The new nerd books are here!" Nobody would understand.

Labels:

2007-02-16

Learning stuff, need advice

A timeline for folks who don't read my other blog (don't feel bad, because I don't read it either):
  • Last June I was injured at work.

  • I still hurt.

  • Worker's Compensation (WCB), for obvious reasons, wants me to go away.

  • Their policy is to see me employed at my pre-injury wage before they cut me off.

  • My most recent wage was exceptionally good.

  • I can't earn that same wage doing brainless labour any longer, because of the injury.

  • There aren't many ways to earn that wage doing light-duty work, but there are some.

  • WCB had two choices: Help me find light-duty work, or let me try to convince them that I'm a good candidate for retraining.

  • I convinced them. Yay!
As sucky as it is to have an injury that refuses to go away, this is a golden opportunity. After being Joe Lunchbox for most of my working life, getting the chance to retrain and having them pay for all of it, along with living expenses, is like winning a lottery to me. I liked some of the grunt work I've done over the years, but if I have one regret it's that I didn't go to school before starting a family, when I had the chance.


Because you're reading about it here, at Galootix, you can probably guess what line of work I'm training for. Programming or, more specifically, web programming.

This is so fucking cool.

They said "pick a school."

WCB strongly hinted that they'd be really happy if I chose BCIT because they'd dealt with them a lot in the past. I wanted to go with O'Reilly Learning, mainly because I've never picked up an O'Reilly book that didn't teach me something. I have craploads of respect for them.

Gambling, because I only had one shot to convince them, I proposed O'Reilly.

WCB said, "Well, we really want you to get a diploma or a certificate."

I said, "How about four?"

They said, "Four? You've only got six months before we cut you off. Are you sure? It'll take that long to get one through BCIT."

I said, "Yeah, what else do I have to do but sit on my ass all day? Besides, if you're paying, I'm gonna cram as much into my skull as I can without my eyes bleeding."

They said, "Alright. Want a laptop, too? And cable for half a year?"

Heh. "Yeah! One of those Ferrari laptops?"

"Don't push it."


Oh, hey, I titled this post Learning stuff, need advice, didn't I? You were wondering when I'd get to the point.

Here are the courses I'm taking.
  1. HTML and CSS

  2. Introduction to PHP

  3. PHP/SQL 1: Introduction to Database Programming

  4. CGI with Perl

  5. SQL Databasing

  6. Introduction to XML

  7. JavaScript 1: Introduction to JavaScript

  8. JavaScript 2: AJAX

  9. Learn Object-Oriented Programming using Java

  10. Unix for Web Programming

  11. Linux/Unix System Administration 1: The Unix File System

  12. Linux/Unix System Administration 2: Networking and DNS

  13. Linux/Unix System Administration 3: Unix Services

  14. Linux/Unix System Administration 4: Scripting for Administrators Sed, Awk, and Perl

I'm just finishing the HTML/CSS one (started with the easiest one I could). I'm thinking of taking them in the order listed. My question to you, Internet people, is "do you think this is the right, as in 'easiest and most efficient', order?" Would you rearrange things, or is that about right? Assume I know nothing. It's almost true.

I've listed the Linux/Unix courses last because they're really sort of peripheral to my goals, and I've already picked up dribs and drabs on my own, anyway. I'm not in a hurry to cover the material.

Thoughts?


(Hot diggity, this is exciting!)

Labels: ,