Learning Programming Part 2: Programming Frameworks

A selection of programming language textbooks ...
Image via Wikipedia

(Full disclaimer: I work at Automattic and am a speaker at PHP conferences.)

A couple days ago, Gina Trapani posted an interesting article on learning to program.

This reminds me that some people may take the wrong points away in my last article on the subject, the priority shouldn’t be what language you should learn, but rather, what is going to get you motivated to learn. PHP is a popular language because it naturally invites “immersion” style learning, not because it makes a good teaching language—which it doesn’t. That is, assuming the thing you are immersing in is “building a website”. As I like to say:

PHP is the shortest distance between two points on the web.

In the comments, I wrote:

After [the first] chapter, I’d say [PHP and MySQL Development]offers the most “immersion” gratification (at the least cost) than any other language’s textbook. The chapters are easy and by the end of it you have an eStore written and working from scratch. What do you get at the end of the Learning Python book? And how easy was each subsequent chapter? I’d say much less and much harder.

[Unfortunately,] it’s that first chapter that does the first timer in.

Continue reading about More about learning web programming after the jump.

Social gaming

Image representing Zynga as depicted in CrunchBase
Image via CrunchBase

There was an interesting article in the New York Times about FarmVille. The only major error I have to comment on is that, given my experience at Tagged, saying Zynga is profitable is a massive understatement.

I think it’s instructive how companies like Slide and RockYou could have been so slow to capitalize on game designs that date back to 1980’s bulletin board systems. Perhaps they’ll study that in b-school. With 20-20 hindsight, this model does complete sense—interaction and bandwidth limitations are pretty much the same relative to the existing technology in each time period are strikingly similar in both BBSs and social networks. And just to further emphasize that it was not first mover that defined success, but rather failure to capitalize, I’ll remind the audience that neither FarmVille nor Mafia Wars were original ideas on Facebook—both were swiped from competitor products.

I will give Zynga (and the others) this. They have a far more mature understanding of social virality than the days of Plaxo, Tagged, or even RockYou/Slide. Earlier social gaming (like the first such app, Zombies) used traditional models based on optimizing signups and invites, but the Zynga model is optimizing views and clicks and they’re doing a good job. Remember, FarmVille only launched in June and now is all over the Times.

 

This is Mafia Wars, Zynga’s copy of Mob Wars. Note the use of various promotions to cater to instincts of people to bring their eyeballs here daily — gambling with daily chance, limited time offers and jobs, cross selling their other applications like Farmville, etc.On this screenshot showing a fold and a half of content, you only see one “social” touch point (at the bottom). That’s because the social aspect is only used like e-mail for messaging—and even then, only for notifications because real interaction like in Diplomacy or Chess would need much more brainpower than simply clicking.

 

Clicks are optimized here; social interaction is minimal here.

Trust me, they make a lot of money off of this.

Before any of us start rationalizing, part of learning is admitting when someone does it better than you. Hats off to Zynga.


Reblog this post [with Zemanta]

Lolcats can never be FAIL'd

Last month, my friend and fellow kimchee-eaterM.J., had three books sent to me. FailNation, How to Take over Teh Wurld, and Graph Out Loud. That’s important that I have friends like her because I’m usually the last to know about the latest memes.

Three new books and their respective websites: FailBlog, ICanHasCheezburger, and GraphJam.

I mention this because if you happen to be in San Francisco today at 6:30pm you really need to go to the book launch party. I came to get their last book signed:

I’ll certainly be there in order to get the books signed (and then give them away later, like I did last time).

Ben Huh signing their first book.

See you at the party!

(Full disclaimer, I now work for Automattic—though I didn’t at the time M.J. sent me the books. ICanHasCheezburger, GraphJam, and Failblog are VIP customers of WordPress.com.)

Champagne Starbucks

Shared a morning with two friends who are leaving Facebook after four years. Then I noticed I was the only one with ratty shoes.

I’m the only one without the cool shoes
Starbucks, South of Market, San Francisco, California

Leica M8, Cosina-Voigtländer NOKTON Classic 40mm f1.4 S.C., B+W 486 IR Cut
1/125sec, iso160, 40mm (53mm)

Even Cyan was sporting the Kitteh.

Oh well, one of the nice things about living here is other people have taste.

What’s the deal with short_open_tag?

A friend asked me today:

Why isn’t short_open_tag set to On in php.ini at [servers you set up] or in general?

Basically short_open_tag allows you to use <? and <?= in addition to <?php when formatting code. The latter can be very useful if you are using PHP as a templating language—like with Savant or no templating system at all.

Many people think that there is a security reason for this. For the life of me, I can’t really see the security problem with the setting though I can see the security problem with the coding. That is… if you code using short_open_tags, then you run the risk of running that code on a server where this variable it is off somewhere and suddenly you are dumping PHP code to people’s browsers. But that almost never happens and really if you have a configuration issue, you have bigger problems.

The real reason is simply that it violates valid XML markup to use short tags. Simply put, let’s say you have an example where your PHP page has to generate a valid XML file that needs a XML directive.

<?xml version="1.0" ?>

With short_open_tags, this will generate a fatal error in the PHP engine! The workaround is to do something nasty like

echo '<'.'?xml version="1.0" ?>';

(or some such). As more websites contained XHTML or some weird sort of sacrifice to the Gods of all things XML (SOAP, XMLRPC, REST-XML), it was sooner convenient to admit defeat and just start coding in valid XML markup.

It violates valid xml. It was not recommended for use because it isn’t guaranteed to be on everywhere. Ever since then people have been in the habit of not using short tags just in case they are off. Soon, it became part of the php.ini-recommended and short tags, like asp_tags and the alternative syntax for control structures got relegated to the dustbin of history.

What is the alternative syntax for control structures? Let’s not go there. 😉