Friday, September 30, 2011

Functional programming pays off

I've been using the "immutable objects" technique from functional programming. This technique starts with object-oriented programming and constrains objects to immutables, objects that cannot change once constructed. This is quite different from the traditional object-oriented programming approach, in which objects can change their state.

With the immutable object style, objects can be constructed but not modified. This is constraining, yet it is also freeing. Once we have an object, I know that I can re-arrange code and not affect the object -- it is immutable, after all. Re-arranging code lets us simplify the higher-level functions and make the code more readable.

The new technique was not "natural" -- no change in programming techniques ever is -- and it took some effort to change. I started at the bottom of the object hierarchy, which let me modify objects with no dependencies. This approach was important. I could change the bottom-most objects and not affect the other (high-level) objects. It let me introduce the concept gradually, and with minimal ripples.

Over the past few weeks, I have extended the immutable style upwards, and now most classes are immutable. This change has already yielded results; we can debug problems faster and change the system design quickly, and each time we know that we are introducing no new defects. (A comprehensive set of tests helps, too.)

We now have code that can be read by our (non-programming) subject matter experts, code that works, and code that can be easily changed. This is a win for all of us.

I expect immutable object programming to become popular, and soon.

Monday, September 26, 2011

The end of the word processor?

Do word processors have a future?

Desktop PCs (and laptop PCs) were built for composers, people who assembled information. The earliest applications for PCs were word processors (Wordstar, Wordperfect, and others), spreadsheets (Visicalc, Supercalc, Lotus 1-2-3), databases (dBase II), and development tools (BASIC, assembly language, Pascal, C, and others).

Cell phones and tablets are built for consumers, people who view information but do not create information. The early apps were games, instant messaging, music players, cameras, Twitter, and perhaps the New York Times.

One does not compose documents on a cell phone. Nor does one compose spreadsheets, or presentations. It is a platform for consuming content, not creating it.

Which leads to the question: in the new world of phones and tablets, how do we create content?

I think that the answer is: we create it on a different platform.

Perhaps we create it on servers. Or perhaps we create it on the few desktops that still exist. (I suspect that desktop PCs will not go away, but like mainframes will exist in small numbers.)

But not everyone will be composing. I expect that only a small percentage of computer users will be creating content. The typical home user will not need Microsoft Word. One does not need a word processor to run a household today -- and I suspect one never really needed one.

This shrinks the market for word processors and spreadsheets. More specifically, this shrinks the market for Microsoft Office. And I think Microsoft knows this. It knows that the home market for Microsoft Office is evaporating. (The business side is a different case. More on that in another post.)

Word processors replaced typewriters. They were a convenient way of collecting text for printing on paper. With the advent of the internet and e-mail, we eliminated the step of printing text on paper. That leaves us with the idea of collecting text and sharing it with people -- and one does not need a word processor for that.

Sunday, September 25, 2011

Does Windows 8 make Windows our new legacy?

Windows 8 is a big change from all previous versions of Windows. Not only is the user interface significantly different (tiled Windows are a thing of the past), the underlying APIs are different. The Win32 and Win APIs that we have used for years (decades?) have been replaced by WinRT.

Windows 8 does not completely drop support for WinAPI and tiled windows. They are supported in the Desktop app, an app available under Metro and WinAPI.

But the position of WinAPI has moved from premiere to second. It is now "the old thing". And by extension, applications that use WinAPI are now "the old thing". In other words, legacy applications.

If the platform on which we build our application becomes obsolete, so do our applications. It matters not what we think of our applications. We may love them or despise them, respect them for their profitability or fear them for the maintenance headaches. But the ability to support them rests on the platform; without it, our applications vanish.

Microsoft has signalled that they are removing the WinAPI platform. To live, our applications must move to the new platform.

Monday, September 19, 2011

Microsoft closes the door to Windows

Microsoft's primer for Metro yields lots of interesting information. What I find most interesting is that Microsoft is "closing the door" for Windows development. And by that, I mean that Microsoft is exerting more control over the market. I see two limitations:

  • Microsoft becomes a gatekeeper, evaluating and approving those apps that become available in the Windows App Store
  • Microsoft limits the languages for development

Gating apps for distribution is possibly a mistake. The great strength of Windows was its open market. Anyone could develop and sell (or give away) a Windows application. The entry price was not free (one needed the tools and the knowledge) but the market was open to all comers. Microsoft made some attempt to ensure quality, with such things as "Ready for Win95" requirements, but always let anyone develop and distribute software.

The approval process is limited to the Metro side of Windows 8; I believe that classic Windows apps which run under the Desktop app will follow the old model. Yet I believe that the Desktop app is a transition device, akin to the "DOS box" that was in Windows 95 and later versions. The Desktop becomes the place for "legacy" apps, apps with a limited life span. Metro is the future, and Microsoft will build tools and support for the brave new Metro world.

Enterprises and developers will be able to create and install their own apps without going through the Windows App Store. I'm guessing that Microsoft will limit this capability, requiring developers to sign their apps and allowing them to install only their own apps -- they won't be able to install an app from a different developer. (I'm guessing the same will hold for enterprises, too.)

So as a Windows developer, I can build and test my app on my hardware -- but I cannot give it (or sell it) to you, unless I go through the Windows App Store.

And I'm guessing that the ability to install self-signed apps will come for a price: a developer license, or maybe a signing license. (Probably multiple levels of license, from developer to enterprise, with different price tags.)

Microsoft also limits the languages for Metro apps to a few: C++, C#, Visual Basic, and Javascript. This is an interesting development, given the genesis of .NET. The announcement of .NET emphasized the plurality of languages (some from Microsoft and some from third parties) which contrasted .NET against Java's "one language for everyone" design.

With these two changes, it becomes clear that Linux is the only open platform, allowing choice for development languages and an open market. Microsoft joins Apple and Google/Android in the closed and controlled market for apps.

If we define the beginning of the PC revolution as the IMSAI 8800 (from 1977) with its totally open architecture, we can mark today as another step towards the end of that revolution.

Thursday, September 15, 2011

Business must be simple enough for a cell phone

Is your business simple enough to serve customers on a cell phone? If not, you may want to think about changing your business.

In the "good old days", companies had large mainframe computers and those computers allowed for complex businesses. Computers allowed banks to pay interest based on the day of deposit and the day of withdrawal. they allowed telephone companies to set rates beyond the simple commercial and residential categories. The best example is airlines, with their complex systems for reservations and fares.

Personal computers, despite their name, were never simple. The applications ranged from simple to complex, and even the set-up of the equipment required some expertise. The typical PC application is a complex beast. Even the simple Windows applications of Notepad and Calculator have nooks and crannies, little features that are unobvious.

The World Wide Web changed the idea of complexity. Web pages can be simple or complicated, but a business on web pages can afford only so much complexity. When customers use "self-service" web sites, complexity is your enemy. A customer will accept only so much complexity; after that they call your help desk.

Cell phones and tablet computers have set a new bar for simplicity in applications. An app on a cell phone must be simple; the size of the display constrains the complexity. Tablet computers are following the cell phone model, not the desktop PC model.

I''m convinced that Microsoft recognizes this; their new Windows 8 and its "Metro" interface is geared for simpler applications.

Consumers have come to expect a simple experience. Most Microsoft applications are complicated, from their file formats to the installation routines to their "average" use. This complexity is a failure of the operating system that was going to make computers "easy to use" and "intuitive". If you are following the Microsoft model of applications (multiple windows, lots of dialogs), you will have a difficult time living in the brave new world of cell phone and tablet apps.

But it's not just your software. If your software is complicated, it probably means that your business is complicated. (For example, airline reservations.) Complex businesses require complex software, and complex software does not fit in the cell phone interface.

Smart phones have been out for several years. If you cannot offer your business to customers on a cell phone (because it's too complicated), you may want to think about your business. The cell phone and the tablet are the new location for business. If you cannot fit there, you will be unable to survive.

Tuesday, September 13, 2011

Microsoft Metro is not their PS/2 -- its worse

Microsoft is releasing more information about Windows 8 and its "Metro" interface. Metro is very different from the "traditional" Windows interface. It is more like a cell phone or tablet interface, displaying one application at a time (no tiled windows) and built to handle touch screen gestures.

IBM introduced the PS/2 (and OS/2) in 1987, six years after the introduction of the original IBM PC. The PS/2 was a step up from the PC/XT/AT product line, addressing multiple problems with that line. The PS/2 had a different floppy drive, a smarter buss, better video, a smaller keyboard connector, and a built-in mouse port, to name the big improvements.

The problem was, no one followed IBM. This was in part due to IBM's licensing arrangements. The original PC was "open", at least to hardware. It took a while for Compaq and other manufacturers to develop a compatible BIOS which allowed them to build computers with sufficient compatible behavior to run popular software.

Instead of following IBM, people followed Compaq, which introduced their "Deskpro" line. The Deskpros were fast PCs that used the traditional connectors and busses, with faster processors and more memory. Compaq also beat IBM with the first 80386-based PC, the "Deskpro 386".

IBM found that it was not the market leader. (You're not a leader when you say, "Let's go this way" and no one follows.)

Now Microsoft is introducing Windows 8 and Metro. Are they pulling a "PS/2"? The answer seems to be "no".

Metro is a big change. Metro is certainly different from the Windows interface introduced in Windows 1.0 and enhanced in Windows 95. The shift from tiled windows to single-app visibility is a large one. This change is as big as the PC-to-PS/2 change.

Microsoft is committing to Metro. Windows 8 and Metro include a "Legacy Windows" app, in which one can run old-style Windows applications. The Microsoft propaganda says that legacy apps will be supported in Windows 8, and I am sure that they will. But let's not fool ourselves: The new stuff will be in Metro.

Metro is not a bold new paradigm. Microsoft is shifting to the new paradigm introduced by iOS and Android. In this way, Microsoft is not leading the market, but following it.

The Microsoft App Store is not a bold new paradigm. An app store is, again, following the market. Yet it also alienates the software distribution channel. When software is sold on-line and not in boxes, the retailers (Best Buy, etc.) have nothing to sell.

The market will not revert to older designs. The market rejected IBM's PS/2 and selected Compaq (with its old-style designs) as their new leader. With Windows 8 and Metro, Microsoft is validating the existing markets for iOS and Android apps. The only old-style provider would be Linux, which offers multi-tiled desktop applications, and I see few people (and even fewer companies) abandoning Windows for Linux.

The PC did, eventually, mutate to something quite similar to the PS/2 design. The new keyboard and mouse connectors were adopted. The PS/2 Micro-channel bus was not adopted, but the PCI bus was. The VGA standard was adopted and quickly surpassed with Super VGA, WVGA, XVGA, and UVGA and a host of others. Everyone used the new 1.44MB 3.5" floppy disk standard. The only thing lacking from the PS/2 was the orange switch for power.

Will something similar happen with operating systems and software? I think that the answer is "yes". Will Microsoft be the company to lead us? I'm not so sure. Apple and Android have a commanding presence.

So I don't know that "Metro" is Microsoft's "PS/2 event". But I do think that it is a significant change.

Monday, September 12, 2011

Ugly business makes for ugly code

A number of associates bemoan the state of their code. More specifically, they complain of the complexity of the code, and of the time and effort required to implement changes and new features.

The complexity of code is the sum of two elements: the complexity of the business and the complexity of the source code. Complexity of the business is decided by the management of the business; complexity of the code is a bit more subtle.

A program can be written in multiple ways; some simple and some complex. In my experience, non-trivial programs can be complicated or simple (some might use the word "elegant"), but the time for solutions is different. Complicated solutions can be written quickly; elegant solutions require more time. A "quick and dirty" solution is just what is sounds like: hastily assembled code that gets the job done but is a jumble of logic.

Simple code, code that is easy to maintain, is harder to write than jumbled code. Simple code is the result of jumbled code that is refined and improved through multiple iterations of design. I know of no programmers that write simple, elegant code from the get-go. They all start with messy code, confirm that they have the correct behavior, and then refactor the code. Those refinements take time and skill.

The one truth about simple code is this:

If you want simple code, you have to pay for it.

But there is a limit to the simplicity of your code. That limit is defined by your business. Your business has operational requirements; your programs must meet those requirements.

The one truth about complexity is this:

No amount of programming will simplify complex business rules. If you have a complex business, you will have complex programs.

How you choose to run your business is, well, your business. But consider this: complex programs cost more to maintain than simple programs. The business benefit of complex rules must yield enough additional revenue to cover the cost of the additional maintenance; if not, you are spending money for a net negative return on investment.

Monday, September 5, 2011

Simple is the new black

If you haven't noticed, we've had a paradigm shift.

We've changed our expectations of computer programs, from comprehensive and complex to simple and east-to-use.

In the old model, we had large, complicated programs that were accompanied by manuals (installation manuals, reference manuals, operations manuals) and how-to books ("Learn Microsoft Word in 21 Days!"). Recent versions of software had no printed manual but large help files and comprehensive web pages.

The value of the software was based on the weight of the box and accompanying materials. Small, light packages were valued less than heavy packages. An application with lots of documentation was worth more than an application with little documentation. Enterprise applications were worth even more, since they required not only manuals but dedicated administrators and specialists to teach the regular users.

Smartphones and tablets changed that model. They defined and validated a different method to evaluate software.

In the new model, we use software without referring to manuals. In the new model, we expect software to work for us. In the new model, we value results.

This bodes ill for programs such as Microsoft Word and Microsoft Excel. These programs are complex. They offer many features, and lots of control over the document (or spreadsheet), but they require a "ramp-up" time. We're no longer willing to pay that time. Software has been swallowed into the age of "immediate self-gratification".

It also bodes ill for enterprise software. Well, enterprise software that provides no value to the enterprise. Large corporations may put up with complicated software, but it must prove itself. We no longer send people to week-long classes for the use of software. The software has to work immediately, and people have to be productive immediately.

Complex and comprehensive is not sufficient. Software has to offer value, and it must be immediate and recognized. It must provide value to users (and the enterprise). And it must do it from "minute one", from when we start using the software. Forcing people to learn the habits and quirks of the software is "out"; making people effective immediately is "in".

Thursday, September 1, 2011

Microsoft's big opportunity

Apple has had lots of success with iPhones, iPods, and iPads. They have redefined the computer for the consumer market. Microsoft has not kept up with Apple, and one can say that Apple has surpassed Microsoft with its products.

They key word in that paragraph is "consumer". Apple has excellent products for consumers, people who use computers and digital goods. But Apple is not so good at infrastructure (consider the XServer) and composition tools. Apple has had to go to outside companies for tools to create digital media: Adobe for PDF and Photoshop, Microsoft for its Office suite.

Microsoft has a long history of products that let people create stuff. The earliest was their BASIC interpreter, followed quickly by compilers for COBOL, FORTRAN, and C. Some were developed in-house, others were acquired, but Microsoft was there and ready to supply the builders. Microsoft also has Visual Studio, one of the best environments for developing programs. Beyond programming tools, Microsoft offers its Office suite that allows people to create documents, spreadsheets, presentations, databases, and project plans.

Apple's products are clearly for consumers. The iPad is a wonderful device, but it is not meant for the creator of goods. It's on-screen keyboard is insufficient for true development work. (Yes, you can get a bluetooth keyboard. But at that point, why not a laptop?)

Apple has shown that it is not interested in the market for builders (at least not beyond OSX and iOS platforms). This is Microsoft's opportunity: They can be the supplier of premier development tools for Windows and OSX.

They need not stop at Apple platforms. The Linux tools for development are good, but they are not as good as Microsoft's tools. Here too, Microsoft has the opportunity to become the leader in composition/creation tools. (I'm including compilers in this list, not simply documents and spreadsheets.)

To win these markets, Microsoft must move away from the "Windows and only Windows" mindset. It is an attitude that forces them to build everything: the operating system, the composition tools, and the consumer products. And they haven't done such a great job at all of that.

There is more to it that simply building tools for other platforms. Microsoft has alienated the users of those other platforms, and must reconcile those bad feelings. Microsoft also has licensing issues to work out -- the Linux crowd expects software for free -- but I think their recent "Express" products may lead the way. The solution is within Microsoft's reach.