Stats

A Coder Interview With Dave Ward

Welcome to our continuing series of Code Project interviews in which we talk to developers about their backgrounds, projects, interests and pet peeves. In this installment we talk to Dave Ward, better known to many of his readers and followers as Encosia.

Welcome to our continuing series of Code Project interviews in which we talk to developers about their backgrounds, projects, interests and pet peeves. In this installment we talk to Dave Ward, better known to many of his readers and followers as Encosia.

Who are you?

My name is Dave Ward. I’m based in Roswell, Georgia, which is a suburb about 20 miles north of Atlanta. I usually joke that I’m the Janitor at Encosia, LLC, but I do also manage to get a bit of writing and consulting done on the side.

What projects have you worked on?

The project that I’m most proud of is Encosia.com. I’ve spent countless hours writing, revising, and maintaining the content there, answering questions that show up in comments, and responding to emails from the site. Millions of visitors later, I’m both humbled and gratified by how successful Encosia has been in its niche.

Another of my projects that I think has turned out well is Mastering jQuery on TekPub. Most of the jQuery video tutorials that I’ve seen are flashier than what James and I put together, but they don’t provide much that the jQuery documentation doesn’t already. In Mastering jQuery, we put a lot of effort into providing more advanced guidance about topics like using jQuery with ASP.NET WebForms/MVC, using custom events (i.e. pub/sub) to decouple your code, and how to use jQuery’s Deferred to take some of the pain out of async programming.

My day-to-day work varies widely. I split my time between client work, working on my own sites, writing, and fielding questions on Stack Overflow, the ASP.NET forums, comments on my posts, and in the emails I receive. For my clients, I do anything from heads-down development on entire projects to the quick in-and-out Batman. Typically, my work is in ASP.NET (taming WebForms or enjoying MVC) and JavaScript/jQuery. jQuery Mobile, PhoneGap, and Node.js work has been on the rise lately, but some days still see me working on Java applets or maintaining ASP classic sites.

In between all of that, I try to spend as much time as possible experimenting with new languages, platforms, and frameworks. One of my greatest fears is stagnating as I get older, which we’ve probably all seen happen to friends and colleagues. It can be challenging to stay relevant in such a fast-paced industry, but I prefer to think of it as never being bored.

What is your development environment?

The overwhelming majority of my development work happens on a Windows 7 machine with 24GB RAM and an SSD. If you’re serious about development, I strongly recommend both of those upgrades. Their monetary cost is an absolute bargain these days, compared to the productivity they afford you.

I’ve also upgraded to dual 30" displays very recently, which are magnificent. It’s harder to justify their cost than the RAM and SSD, but I don’t regret a penny that I spent on them.

I also use a MacBook Air for light/emergency development tasks when I’m away from my primary machine and for compiling the iOS builds of PhoneGap apps. It’s not popular to like Windows these days, but I very much prefer it to OS X.

What I use the MacBook for primarily is most of my writing, dealing with emails, and replying to blog comments. Even though I’m not a big fan of OS X, the quality of Apple hardware makes it a pleasure to wander around town and work from different locations, without lugging a heavy and/or fragile machine around and without worrying about battery life. With more and more research coming out about the health consequences of sitting in one place and staring at a computer screen all day, I try to move around and be nomadic when I’m working on tasks that don’t require my full development machine.

Due to straddling both platforms, I’ve come to appreciate tools that work well on both Windows and OS X. Dropbox, Evernote, PhpStorm, and Sublime Text 2 have become invaluable, for example.

Of course, I do still use Visual Studio when I’m working on ASP.NET projects, and I have no choice but to use Xcode (which has made me thankful for Visual Studio) when I’m building the iOS version of PhoneGap apps.

Beyond Compare is one glaring exception to my preference for cross-platform software. When I ask for recommendations for an OS X Beyond Compare replacement, it’s obvious that the Mac-only crowd has no idea what they’re missing out on when it comes to Beyond Compare.

What new tools, languages or frameworks interest you?

First, Node.js. I believe the future of web development lies with full-stack JavaScript. It won’t happen overnight, but it’s eventually going to be a difficult proposition to sell new web developers on a stack that requires them to learn n + 1 languages. At some point, I think using a different server-side language for UI-related code will make no more sense than using a Java applet for rollovers does today.

Frankly, I’m surprised that it’s taken this long for a server-side JavaScript implementation to gain a critical mass of adoption, but it’s clear that Node has done so. I’m particular happy to see Joyent and Microsoft both working diligently to make sure that Node development on Windows is as solid as it is on other platforms.

Second, PhoneGap is another exciting project right now. Being able to wrap a jQuery Mobile project up in PhoneGap and deploy native apps to several platforms is something that almost any business can benefit from. Both of those projects still have a few rough edges and there are some OS-specific issues remaining (I’m looking at you, Android), but smoothing these problems out is just a matter of time and persistence.

Deploying a unified UI code base that works across several mobile platforms (and Chrome on the desktop) finally fulfills that old promise of “write once, run anywhere.” More and more, I think we’ll see companies use PhoneGap to quickly offer a basic native-lite experience across most mobile platforms simultaneously and then develop richer native apps for the platforms that warrant the extra development effort in their individual scenarios. In other words: breadth-first instead of depth-first.

An honorable mention goes to [Windows 8], WinRT, and WinJS. Since I didn’t manage to snag one of the development machines from BUILD (any generous Microsoft employees reading this?) and running Windows 8 in a VM is tedious, I haven’t spent much time with WinJS yet. I think Windows 8 may dramatically change the app store dynamic, though. Why deal with the clunky Android SDK or jump through all the hoops that iOS development demands when you could use Visual Studio instead? Similarly, why fight for table scraps in the fickle iOS app store or the notoriously frugal Android marketplace when you can market your apps to what will become hundreds of millions of potential customers in the Windows 8 store instead?

I think Windows 8 is a compelling opportunity. I definitely intend to start exploring Windows 8 development, particularly using WinJS and JavaScript, more thoroughly this year.

What is your coding pet peeve?

My pet peeve is not using source control. From directories littered with files named like index-new.1–4–2012.USETHISONE.html to blocks of code that are fearfully commented out instead of deleted, the consequences of working in that kind of turmoil are a constant drag on productivity at every stage of development and maintenance.

For naming convention i prefer camelCase in JavaScript and PHP. PascalCase in C#. whatever_this_style_is_called in Python and Ruby. I avoid hungarian notation, except I that I do like to prefix jQuery wrapped set variables with a dollar sign (e.g. var $foo = $(‘#foo’);).

Indentation: 2 spaces. Tabs make more sense in theory, but I’ve drifted away from them in recent years. In practice, multi-line fluent method calls and object literals are common in my work, and they end up horribly misaligned when changing between editors that use a different tab size than the one in which they were written.

Braces: K&R. It’s useful to standardize on K&R in JavaScript to avoid a particular edge case. In Razor views, the formatting works out much cleaner if you keep the opening brace of a loop or conditional on the same line. So, even though I used Allman in C# for years, I’ve standardized on K&R to keep things simple. After a short acclimation period, I’ve come to prefer K&R anyway. Vertical space is almost always at a higher premium than horizontal. I’ve found that fitting one more line per control block on the screen is well worth the time and effort I initially spent getting used to K&R.

How did you get started programming?

I got my start in programming when my parents bought a TRS–80 Color Computer for the family back in the early 80s. It sported a whopping 16Kb of RAM and came with the Microsoft BASIC interpreter on a ROM. So, as soon as you turned the computer on, you could type BASIC statements and get instant feedback. I’m sure that immediacy was an instrumental part of what made programming accessible to me, and it’s probably why I still prefer using REPL environments like Firebug and LINQPad to learn and experiment.

At the time, one of the primary means of software distribution was printed code listings in magazines. Through the course of typing (and re-typing; I didn’t have any way to save my work between power cycles) the games I wanted to play and correcting typo errors when an error occurred, I began to learn what the code meant through brute-force mitosis.

Soon, I decided to try my hand at writing my own game. My first “real” program consisted of a bolded title, a paragraph of instructions, and a functioning “Press any key” prompt to begin the game. Unfortunately, I didn’t understand how much of even simple programs are under the surface. After pressing the any key, my program promptly exited back to the BASIC prompt because that’s all of it that I had written.

How has the developer community influenced your coding?

The developer community has had profound impact on my coding. The most exciting innovations happen when you explore the edges of the adjacent possible, and keeping in touch with the pulse of the community is an important part of understanding where that area lies.

Twitter, RSS feeds of other blogs, and aggregators like Hacker News are all useful ways to drink from the fire hose. At the same time, it’s very easy to spend too much time consuming content and no time experimenting on your own or producing your own content. Just reading passively about something is nothing like opening up an editor and seeing how something works for yourself. Finding a balance between consumption and production is something I constantly struggle to find, but I guess knowing is half the battle?

On the other side of the equation, I’ve found that answering questions on Q&A sites like Stack Overflow and the ASP.NET forums is a valuable part of the community too. Understanding what issues real developers are struggling with and the language they use to describe their problems has led to some of my most popular blog posts. By the same token, being exposed to a wide range of messy, real-world implementation details and hurdles helps add data points that validate good solutions and expose bad approaches sooner.

What advice would you offer to an up-and-coming programmer?

Write about programming. Start a blog, answer questions on The Code Project or Stack Overflow, or whatever else suits you, but find some way to write about programming.

I can’t count how many times I began writing about something I thought I knew thoroughly, only to find that I had to fill in several important gaps in my knowledge to write about it competently. Just as important, you have to learn topics more comprehensively to distill and teach them in simple terms. The combination of writing about programming and making that writing as clear and simple as you can is a powerful exercise.

Maybe more compelling, I’ve seen research claiming that effectively teaching left-brained, technical concepts (like programming) forces you to engage both your left and right brain. Supposedly, that helps to deepen your own grasp of a subject and offer you new perspective that you wouldn’t normally encounter.

We’ve probably all heard the old saying, those who can’t do teach. Trying to teach topics that I “do” on a regular basis was eye-opening and I couldn’t disagree more with that old saying now.

I happened to be talking with my friend Nick about this recently and he reminded me of that other saying: you don’t know something if you can’t teach it. That one’s better.

We share a pet peeve... Fearfully commented out code. If code was to scary to completely delete then there can only be two reasons: Either the person that initially wrote the code couldn't write clean, understandable and maintainable code or the person that commented it out wasn't able to understand what the code did because he was incapable. One doesn't rule out the other and the latter is almost always true (although with source control there are no excuses to NOT simply delete it!).

Writing about code is certainly a good tip! It has helped me greatly here on CP (both by writing my articles and tips and answering in QA). Of course reading others' articles and answers greatly helped too, not to mention inspire!