Skip navigation
Help

Web development

warning: Creating default object from empty value in /var/www/vhosts/sayforward.com/subdomains/recorder/httpdocs/modules/taxonomy/taxonomy.pages.inc on line 33.
Original author: 
Scott Gilbertson

Hybrids. Image: Screenshot/Webmonkey.

The advent of hybrid laptops that double as tablets or offer some sort of touch input has greatly complicated the life of web developers.

A big part of developing for today’s myriad screens is knowing when to adjust the interface, based not just on screen size, but other details like input device. Fingers are far less precise than a mouse, which means bigger buttons, form fields and other input areas.

But with hybrid devices like touch screen Windows 8 laptops or dockable Android tablets with keyboards, how do you know whether the user is browsing with a mouse or a finger?

Over on the Mozilla Hacks blog Patrick Lauke tackles that question in an article on detecting touch-capable devices. Lauke covers the relatively simple case of touch-only, like iOS devices, before diving into the far more complex problem of hybrid devices.

Lauke’s answer? If developing for the web hasn’t already taught you this lesson, perhaps hybrid devices will — learn to live with uncertainty and accept that you can’t control everything.

What’s the solution to this new conundrum of touch-capable devices that may also have other input methods? While some developers have started to look at complementing a touch feature detection with additional user agent sniffing, I believe that the answer – as in so many other cases in web development – is to accept that we can’t fully detect or control how our users will interact with our web sites and applications, and to be input-agnostic. Instead of making assumptions, our code should cater for all eventualities.

While learning to live with uncertainty and providing interfaces that work with any input sounds nice in theory, developers are bound to want something a bit more concrete. There’s some hope on the horizon. Microsoft has proposed the Pointer Events spec (and created a build of Webkit that supports it). And the CSS Media Queries Level 4 spec will offer a pointer query to see what sort of input device is being used (mouse, finger, stylus etc).

Unfortunately, neither Pointer Events nor Media Queries Level 4 are supported in today’s browsers. Eventually there probably will be some way to easily detect and know for certain which input device is being used, but for the time being you’re going to have to live with some level of uncertainty. Be sure to read through Lauke’s post for more details and some sample code.

0
Your rating: None

A few people have asked me whether I think programming is a necessary skill for entrepreneurs (or anyone) to have in the future.

When I was 14 years old, taking guitar lessons from Tom Pecora, he gave me that this-is-important-so-listen-well look, and told me something that stuck with me for life:

“You need to learn to sing. Because if you don’t, you’re always going to be at the mercy of some asshole singer.”

His point of view was from a rock guitarist in the Chicago music scene, trying to put together a band, and all that. I really took it to heart, and learned to sing.

But ever since then I’ve applied that point to other areas.

When I first started CD Baby, I didn’t know any programming, only basic HTML, and quickly had to cry for someone to help me. Davor Cengija in Croatia was a big help, but one day he disappeared. (Turned out he broke his foot skiing.) For weeks I was helpless, as my site had problems, and I didn’t know how to fix them. That pain got me motivated to learn this stuff myself. (Necessity is the best motivator.) I’ve loved programming ever since.

Later, when I needed a new computer, my friend Tony Benjamin taught me how to build my own from parts. This was so empowering because this box that I depended on so much was no longer a mystery. As CD Baby grew, I loved building all the computers for the employees, and even the webservers that ran the site.

In the independent musician scene, the DIY ethic is strong, by necessity. When it comes to doing all those non-musical things like booking gigs, promoting, publishing, and all of the organizational things, the norm is to do it yourself until it makes more sense to get someone better to help you. (And even then, maybe choosing to do it yourself just because you want to.)

The benefit of doing this yourself at first is that you learn enough about it so when you can afford to hire someone, you’re in a much better position to know if they’re good or not. Also it gives you the confidence to know that if anyone else flakes, you can step in and do enough to keep going. The deep joy of self-reliance.

So... back to programming:

The most common thing I hear from aspiring entrepreneurs is, “I have this idea for an app or site. But I’m not technical, so I need to find someone who can make it for me.”

I point them to my advice about how to hire a programmer, but as most of the good ones are already booked solid, it’s a pretty helpless position to be in.

If you heard someone say, “I have this idea for a song. But I’m not musical, so I need to find someone who will write, perform, and record it for me.” - you’d probably advise them to just take some time to sit down with a guitar or piano and learn enough to turn their ideas into reality.

And so comes my advice:

Yes, learn some programming basics. Just some HTML, CSS, and JavaScript should be enough to start.

I recommend Head First HTML and CSS first, then Head First HTML5 Programming.

Get those basics under your belt. Make an HTML site respond to things the user is doing. Save some information in a database, and use it to generate a web page.

You could go through those books in a couple weeks of evenings, and you’d already know as much as 50% of the people out there calling themselves webdesigners or web programmers!

It’s a REALLY amazing feeling. The mystery is lifted. You’ll look at all websites in a new way. You’ll understand what’s going on behind the scenes. You’ll know how to do it yourself. It’s really empowering.

Once you’ve done that, you’ll know enough to know what you need next. Maybe you want to get deeper into web development with Ruby, JavaScript, Python, Rails, or Node.js. But don’t get overwhelmed. When you’re ready, look at the book reviews on Amazon to see which books people are raving about. Go to Stack Overflow to ask questions or recommendations.

This will give you a good foundation if you want to go on to make iPhone or Android apps, or just know enough to hire someone better.

You don’t need to become an expert, just know the basics, so you’re not helpless. You can do all of this in less hours than it takes to watch “The Wire”, and it’s much more rewarding.

(It’s definitely been the most rewarding thing I’ve ever learned.)

NOW READ: Why I Always Assume I'm Below Average

Please follow War Room on Twitter and Facebook.

Join the conversation about this story »

0
Your rating: None