Category Archives: Programming

Ownership: Artist or Engineer?

There are varying ways that a client / service relationship can work, and this view can be the cause of harmony or discord in projects. It’s something I’ve understood for a while, but had trouble explaining at times. What follows is an attempt to explain my view of something that knowledge workers need to understand to have a successful and fulfilling career.

The Artist

When an artist does work, we typically think of them as having complete control of the work. This is certainly true in the case where the eventual owner is not yet determined. Meaning an artist creates, and then sells directly or via a gallery to the public. Even commissioned artwork has only varying levels of control. A commissioned portrait certainly falls into the realm of work that would come with constraints. After everyone involved is dead and gone, people tend to remember the artist, not the owner.

The Engineer

When work is not sponsored, but contracted, it begins to fall into a completely different classification. Though you may refer to it as “artwork”, a visual painting done for advertising is really more “creative” work for hire. Certainly work that is more functional (like a bridge) comes with rigid requirements. This is the attitude of the engineer. That work is asked to meet certain goals, and ultimately subject to the approval of the buyer. While the engineer is an expert who expects to provide guidance, but does so at the behest of the client. In terms of credit, this world is muddled. Sometimes it is the architect, other times it is the owner or visionary that is remembered.

What does any of this have to do with consulting, software development, functional work, or any other type of service industry? Don’t get caught up in the work medium (paint, steel, code), or left brain / right brain aspect of the work, but just consider the metaphor in terms of relationship to the client and ownership of responsibility. In my world (consulting in the areas of software development, creative, marketing, etc) this distinction makes a big difference. All of these types of work have a right-brained aspect to them. People think of software development as a very regimented thing, but there is a lot of freedom to work in your own styles and patterns. Languages are fairly abstract these days, and they are high level enough to provide nearly infinite ways to solve complex problems. Certainly I don’t need to discuss how easy it is for a graphic designer to relate to an abstract artist.

Here’s where the risk is of confusing yourself with having the control an artist does, when you do not. The consultant works in a world where the client owns the final product. And the project would never even exist but for the idea and financial commitment of the client. Deadlines, requirements and other constraints are all part of the context. “Ownership” of the direction is a privilege that goes to the person that takes the risk. While an artist that is producing works for sale is bearing the risk that the piece will not sell, the bridge builder is not. It was sold before the project started. Sure, many contracts include shared risk clauses, but for all intents and purposes, the risk is on the client.

It is arrogant and unproductive for a paid consultant to believe they have the final say in work. They have the right to turn down work. And some clients may choose to give control over to the consultant, but that is their choice, not a right of the consultant.

When a consultant is doing work for hire and thinks they have the privilege that come with the artist mentality, it easy to develop a disdain for the client. Whereas in the engineering mindset, it is understood that one can recommend to the client, but ultimately the idea must sell itself. There is no expectation that the consultant wins because they are the subject matter expert. They are expected to be able to convey their idea and it’s merits in plain English and at a level understood by someone outside the field. In short, they must sell the idea.

Am I saying that workers should not have principals? Not at all. Take the story of Howard Roark, the principal’ed architect of Ayn Rand’s The Fountainhead. Roark suffered while turning down business as he would only work on buildings where his style of architecture was called for and he had the free hand to build modern and innovative buildings. He turned down others with work that would not satisfy him, but he did so respectfully. In this fictional work Roark has many enemies, but not the clients he turns down. A read sympathizing with Roark may agree with those clients, but it’s hard to see them as malicious.

The problem is that so many give away the right to have those principles for the sake of expediency without realizing they gave up that control. So they still expect the control. As an example, coming to work for a consulting company, you give up that right. Why? I’ve already made the point that the client has control, so you can only control work by selecting projects that meet your criteria, or working with clients who are ceding control. But as an employee of the company, you are giving up the client selection privilege in order to minimize your risk and investment. The consulting company provides you with a salary, book of work, etc, in return for your work. You do not get to control what work the company takes or not. It is your choice to leave if their client base does not suit you.

Too easily do I see people in the business blame owners and clients for work they do not like. But owners and clients anted up. They paid for the right to call the shots. If you want them to call the shots differently, it is your obligation to sell them on those ideas. Not your right to complain if the idea is not sold.

So what should someone who believes in the artist mentality do? There are people that believe so strongly in the control of their output. Folks like this tend to idolize people they view as uncompromising, like a Steve Jobs. (It’s worth noting that there are a lot of signs that he compromised more than the public perceived).

There are some simple solutions. Being an independent consultant means that you can turn down work that does not fit preferred principles. Owning / building your own consulting firm allows you the control of selecting your projects and clients. The third option is to return to the artists root of non-commissioned work. In other words, start a product company. While your clients have say in the form of sales, you are free to put whatever product you see fit on the market that can be held to only your standards. For all the knowledge workers that idolize Steve Jobs and he uncompromising reputation, it is worth remembering that he started and returned to a product company.

Media is a great analogy. Being an independent musician, filmmaker, or game developer is hard. You have to market for yourself, sell each product, secure distribution, etc. But for that price, you have control of the product. Signing with a publisher makes those tasks easier, but you have to be aware of the conditions you agreed to with the publisher. Like any contract or relationship, you should consider what those terms will mean in good times and in bad.

This is not to say that the rest of us don’t have some control and determination of our own destiny. It’s just that you have to remember you only have one lever to pull, leaving the company. You can negotiate terms based on a company or client’s desire to have you be a part of the team. But to get emotional about it, or think you have a right to control without taking the primary risk is folly.

Why Aren’t You Using PhoneGap?

PhoneGap (now becoming known as the Apache Cordova project) is commonly thought of as a cross-platform mobile development solution. While true, I think it’s best to think of PhoneGap as modernzr for the mobile web.

The W3 is working on standards for web sites to be able to access specific hardware features. These common hardware features were first prominent in mobile, but are coming back to laptops via tablets and hybrids. Feature examples are GPS, Camera, Motion Sensors, Network Sensors. Also, mobile has popularized the idea of system maintained contact lists and other information that is now available (with proper permissions) to all apps.

The runtime in your application is a native app which hosts a native browser control, and that browser control is pointed at a local directory you include in the app with html. And the javascript has access to some os specific features that are exposed to javascript.

When those standards are in place, mobile web sites will be able to fulfill most of the promise of native applications. This is why Steve Jobs didn’t want to build an app store in the beginning, and both RIM and Microsoft have been pushing html/css as 1st class ways for building apps.

In this new world with device access standards, only special circumstances like intense 3d graphics should require native code in a c-like language.

But this isn’t the world. Those standards aren’t in place. So PhoneGap fills that gap (any guesses about the name?). And it has the added benefit of supporting the app store distribution model, where mobile web apps require the user to bookmark the page to their homescreen.

Most cross-platform apps get knocked for performance reasons. Sure PhoneGap apps are html and javascript, but javascript engines are improving a lot these days, and you can always use plugins to push key pieces of your application into the native arena. Plugins in PhoneGap allow you to write native code (ie Objective-C on iOS) that is exposed to the javascript in your application.

Also, cross platform frameworks are usually criticized for their look and feel. In PhoneGap, you’re using html and css, a platform that we’ve been working to style for a very long time (in tech terms). I think this fact explains some of the reasons that companies like facebook and linkedin use html heavily in their frameworks.

If you’re interested in getting started in PhoneGap, I recently reviewed a book I recommend to get started. It’s a couple versions back now, but it covers things conceptually well, and it’s a nice companion to the docs.

Not every application is a fit for PhoneGap. There are reasons to go native. But I think that for basic data goes in / data comes out type of applications, It’s a great way to start. And getting good at writing single page style apps with heavy javascript will push you in the direction the web is already going.

Working With Social Network APIs

Creating Vicinity Buzz naturally involved working with a the APIs of social networks. That information seemed worth sharing for those of you interested in writing any type of application that would integrate with a social network.

Developer Documentation

Any of the social networking sites you probably want to integrate with have developer api’s that are well documented. Here’s the starting points for a variety of services:

Working With JSON

All of these APIs are best used with JSON. If you’re not familiar, you can read up at json.org. It’s the notation for serialization of javascript objects, and object literals.

Where To Make the Call From

If you are working in a standard web page, you could call the api from document.ready (assuming you are using jquery). This is the approach I take on hoolihan.net, my personal homepage. There is a twitter feed on the right side.

If you have a bit more of an application, you may want to look at one of the many javascript frameworks that help you route events to actions. These are frameworks like backbone, knockout, spine, etc. There are also commercial variants like kendo, dojo, and sencha.

jQueryMobile is commonly paired with PhoneGap, and in that scenario, using something like backbone is a bit tricky. You may want to bring in a template binding library, but avoid routing.

Binding

jQuery.templates was one of the first good javascript template binders that I’m aware of, but there are now many different options. In the jQuery world, most of the momentum seems aimed at jsrender. Recently I’ve considered bring in knockout and only using the binding part, but I’m not far enough in to evaluate that direction.

API Keys

Unless you’re using the most basic parts of the API, you’ll probably need to register your app and get an API key. It’s a token that identifies your application. In the event of API abuse (too many calls, etc), they have information to contact you and analytics around the issue.

Open Authentication

This is a big topic, but if your application wants to use a social network to identify your users, this is possible via open authentication. If you are interested in this, get started here.

What Do You Think?

Are there any particular areas of the APIs that you’d like to see more detail about? Any conceptual parts that would warrant their own post? Let me know what you think below.

The Pendulum of Architecture

If you’re a developer, you’d probably have to have spent the last couple of years in a coma to not notice a trend towards simpler tools, but I want to write a bit about the changing tides in software architecture because I think there is more below the surface.

Around 3-5 years ago was the peak of an era that could be called “the Church of Martin Fowler”. Big software design patterns were in. All of our domains were to be modeled, everything needed a service class, and interface oriented design was all the rage.

Before anyone gets upset that I’m disparaging Martin’s name, let me see the man is a genius. And like any object of worship, terrible things have been done in his name, whether or not he asked for them. In other words, many of these patterns were applied to pieces of software that did not fit the patterns.

But I’m less interested in debating the past and more interesting in discussing where we are now. Rails was one of the first blows against large, complicated software creation. Today, many in the ruby community talk about the bloat of rails, preferring frameworks like padrino, sinatra, etc. Most new languages build super light weight web frameworks first. Look at compojure for clojure, or express for node. Personally, I happen to really like Sinatra, and have used it for a handful of sites that I help with in my personal time.

Does this mean software patterns are dead? Should we all move back to php (which may have been ahead of it’s time)?

I think there is something else going on, namely that tools are addressing a different level of the problem. Pragmatic programmers (literally, not referring to the publisher) often site the adage “use the tool for the job”. Combined with the long cited un*x philosophy that its tools “do one thing well” we can see a pattern emerging. Sites can do one thing well, expose their interactions via http, and build a system of of smaller systems and their interactions.

I don’t think the tools are moving away from complexity for simplicity’s sake, I think they are moving to a new way of dealing with complexity. The tools (sinatra, express, nancy) are designed to create subsystems and you are expected to stitch the subsystems into the complex systems.

It’s like SOA, with http as the service bus, and more explicit dependency bindings.

I think that’s an important distinction. Enterprise architects look at some of these simpler tools and feel that they are toys for smaller sites. But those that embrace them are saying back to that architect “why have tools that provide safety and assimilation across 50 developer product teams, when you can avoid having one big project with 50 developers?” And that’s not a bad question. There are some real analogies to Steve Yegge’s recent software conservatism vs liberalism post.

I’m not taking the position that one side is always right. These are approaches, and any approach tends to have contexts that are it’s sweet spot. But I think this new trend is massively misunderstood. Similar to how many folks think that NOSQL means “No SQL”, instead of “not only sql”.

One question is, can the vendors catch up? Or will this only be an open source trend? Microsoft cleaned up it’s web stack with ASP.Net MVC, but it’s still on the heavy side in comparison to the direction that the open source community is heading. Does Microsoft have the capability to embrace something the size of Nancy? Some would argue web pages (razor) was that answer, but it seems to lack the first class prioritization of routing and http that the open source frameworks do.

Thinking back, it’s easy to wonder why this didn’t happen sooner because of SOA. Maybe this is what the SOA community missed, that better (and simpler) tools were needed to build at the new level that SOA asked the developer to target.

Simple URI Tip for HTML

You may already know this, in which case you ran across it randomly, or are the kind of developer that reads specs. But if you haven’t run across this, prepare for a face-palm moment wondering why you didn’t know this years ago.

Using a uri like the following tells the browser to get the content over whatever protocol the current document was fetched from.

<script src="//platform.twitter.com/widgets.js"></script>

Think of all the little annoying server side script you’ve written to determine the protocol based on the request variables in order to avoid security warnings. Never again. Enjoy.

One warning… don’t do this in phonegap.

More detail, and links to rfcs at stackoverflow.