Why I don’t like the “Cloud”

This question comes up a lot with my customers… “should I put my data in the cloud?”  When it does, I recount the following story:

Years ago when I started working with computers, all the local school districts had software from the same company.  We’ll call them OldCo (obviously not their real name) for the purposes of this discussion.  OldCo also sold software targeted at city governments, and I had a few city customers using some of those products.

OldCo’s software was all DOS based.  They started a project to convert their school accounting and student records programs to Windows.  Just as they were about to begin beta testing of their Windows accounting software, the database vendor they were using went out of business.

So they couldn’t buy the necessary licenses to resell to their customers.

They started all over at that point, essentially scrapping the entire project, and switched to an entirely Microsoft-oriented codebase, using SQL server as their backend.  This put them way behind their planned deployment schedule, not to mention costing them a bunch of money.

Along came another company, which we’ll call OSC (Other Software Company).  They were another major player in the school software business, and their software supported Windows already.  OSC bought out OldCo to get their customer base (a sound strategy I’m sure), and pushed all those schools into switching to their student records software.  They didn’t have a school accounting program, but that was okay with them… they kept the OldCo staffers who understood that program and continued to maintain and sell it.

Who’s missing here?  The city government customers.  OSC notified them that they would not be supporting or selling OldCo city government software any more, and no, they wouldn’t really help anyone extract their data from it either.

Those city government customers were cut off from support, but at least they could keep using the programs.  If their data was stored in someone else’s cloud, and that someone else closed their service for any reason, where would they be then?

This is why I don’t like the Cloud.

I am a Rockstar Programmer?

There has been a lot of talk lately about the “rockstar programmer” (aka the “10x” programmer); specifically, whether or not such a creature exists.  For instance, on Hacker News today I saw Scott Hanselman’s article The Myth of the Rockstar Programmer, which is very critical of the idea.

I think it’s more complicated than that.  You see, I am a “10x programmer.”

Sometimes.

I run a one-man programming operation as a sort of side-business; I’ve been writing application software for vertical (mostly local government) customers for many years, in a variety of languages.  Most recently I’ve been focusing on web-based apps in Python (and of course, Javascript).  I’ve spent many an hour working on these programs, and I can tell you that most of the time I’d call my productivity average.

But a couple of years ago, near the beginning of my love affair with Python, I wrote an application for handling city property taxes for a small town.  My understanding when they contracted the work was that they just wanted help with some Excel files… but it was more than that.  They really needed a program similar to the ones I had written for several county-level customers.

So in the course of about five hours of wild-eyed hacking, I wrote it.  I repurposed a few small components from a personal project, but even so most of the code was new, and surprisingly it works pretty well.  Since then, two other small towns have acquired versions of the program, largely cloned from that original program, and in each case it took me more time to customize the program for them than it did to write it in the first place.

I still don’t know how I did that.  Zero testing.  Solving problems I was uncertain about not by research, but by going around, over, or under them.  But it worked great for the original customer for the entire first year, and has required only another hour here or there in maintenance, mostly adding features.

It’s not the only time I ever did that.  I have other programs, or parts of programs, written in the same way, usually under time pressure but sometimes just because I felt like it.  If I worked more consistently in software development (full time, as opposed to basically part time now), I might do that sort of production more often… but I really don’t know.

It’s a mystery to me.

Worst Time Ever to Buy a Computer

This is the worst time in many, many years to buy a new computer at retail, and it’s all Microsoft’s fault.  Windows 8 is, in my opinion, the worst new version of Windows ever.

There are many ways to define “worst” so let me start by explaining what I mean by it.  I sell computers mainly to people who know that they will need professional assistance.  They trust me to sell them what they need to do their work, and to fix their computers when they go wrong.  So my definition of a “good” operating system is one that generates fewer unhappy phone calls.

Windows 95 and 98 were prone to lockups and blue screens; Windows XP made those problems better, and added a lot of nice functionality.  It’s no accident that Windows XP right now commands just over 38% of the desktop operating system market, according to netmarketshare.com’s March 2013 statistics; it’s the #2 version of Windows, and the #2 desktop operating system overall.  It was pretty good, obviously.

Windows Vista came along, and we all hated it.  It felt slow and clunky, and had no real advantages over XP for most business and home users.  But Windows 7 appeared and redeemed the name; it had much the same user interface as Vista, but didn’t feel clunky anymore.

Throughout all that, the PC world was dominated by a desktop full of icons (that the savvy user could customize to suit his or her needs), a taskbar (at the bottom, unless you moved it, but always on the screen) and a Start menu with all your application programs on it.  From Windows 95 to Windows 7, you could get your work done the same way.  You didn’t have to learn something all new.

Now we have Windows 8.  The desktop full of icons is hidden, relegated to a sort of backroom like a second-class citizen.  In its proper place we now find a screen full of boxes, many of them animated, like a bunch of billboards screaming for our attention.  Gone is that reassuring Start button with all your programs neatly organized where you can find them.  Sure, experienced users made their own icons, on the Desktop or the top of the Start Menu or even in the Quick Launch area on the taskbar; but sometimes you need that program you rarely use, and you know it’s there, on the Start Menu, when you need it.

My daughter is an experienced computer user.  At school, most of the computers run Windows XP.  At home we run various flavors of Ubuntu Linux.  She also has experience with Windows 7 and Android.  The first time she saw Windows 8 (on a demo computer at a retail store), she couldn’t figure out how to start Microsoft Paint.

Sounds easy, right?  So it’s not on the new Start screen.  You figure out how to scroll the screen sideways, but you still can’t find it.  Then you notice one of the big rectangular buttons says Desktop, so you click it.  For a moment, you think you’re in Windows 7 again… taskbar at the bottom, icons on the screen, some pleasant wallpaper behind it all.  But… there’s no Start button.

Eventually you figure out how to get back to the Start screen (there are several ways, none of them obvious… but the Windows key on the keyboard will do it for you if you get stuck).  Now what?

Move the mouse pointer into the unmarked and unremarkable upper-right corner of the screen and float there a moment, and a bar of icons will slide out from the right side.  One of them is a magnifying glass.  Click that, and type in (yes, type in) the word “Paint.”

Finally, you can draw something.

Now imagine this from my perspective.  Much of the user interface is hidden, or obscure, like that unmarked corner of the screen (I’m told the lower-right corner also works, by the way).  If I sell that to my customers, I’ll get a lot of those unhappy phone calls.

Fortunately, I can still get Windows 7 Professional on new computers, by taking advantage of the “downgrade privilege.”  Any reseller who does business-grade computers can do that.  But just try to walk in to your local electronics superstore and get Windows 7 on a new computer.  If they can do it, it will be at a premium.

You may think, hey, I’m kind of technical, maybe I can buy that discount laptop and then install my old copy of Windows XP on it.  Hold your horses.  Ignoring the legal issues (and I’m not a lawyer so I won’t comment on them), you’re going to have a hard time with that.  Windows 8 uses and requires a new “secure boot” feature which must be built in to your computer; this feature is called UEFI.  Some new computers, including a large number of lower-priced laptops, will only boot a UEFI-enabled operating system, and Windows XP (and Vista) is not able to boot on such a computer. Even if you can turn off the UEFI feature on your new computer, you may find that drivers needed for the computer to run properly are not available for XP (since the manufacturer never intended you to downgrade the operating system).

So what am I saying?

If you’re buying a new computer, and cost is an issue, please, try out a Windows 8 computer before you buy one.  Make sure you’re ready for it, and that it will do the things you need it to do.  If you can afford a little more expense, find a reseller who can set you up with a business-grade computer with Windows 7 Professional; I’m almost certain you’ll like it better than Windows 8.

Or of course, you can do what I do.  I sell Windows-based computers, but I run Linux on my personal and business machines; I have just one computer running Windows XP on which we do our accounting.  There are still issues with finding a computer that is not so crippled by UEFI as to prevent installing Linux, but hey, you get to save the price of the operating system (since Linux is free).

The PC industry is in a decline, they tell me, with sales down from last year 14% (according to IDC as reported by the Wall Street Journal).  While many blame the rise of tablets and smartphones, I believe the real culprit is Windows 8.  Flashy TV ads don’t make up for the fact Windows 8 is harder to learn and harder to use for the average person.

Orphaned Header Bands “Mostly” Fixed

Today I added a handful of lines of code to calculate the average detail band height (so far) and use that average to reduce the number of times group header bands are “orphaned” at the bottom of a page.  I’ll admit, I’m thinking strongly that I really need to use a figure between the average and maximum, but for now I’m going with just the average.  Of course, if all detail bands in a given report are the same height, it won’t matter anyway.

I’m using PollyReports in a production system currently; in fact, that’s how I came to realize this was needed.  After a bit of live testing, I may modify the algorithm a bit more.  Right now I just want to see how much difference it makes.

PollyReports vs. Geraldo Reports — A Correction

Some time back I made a post about the development of PollyReports, and I gave code line counts based on Robin Parmar’s lines-of-code counter which ascribed a truly huge number of lines to Geraldo.  While I knew it was more complex than PollyReports, I began to feel that there had to be some mistake… it just couldn’t be THAT big.

So I took Robin’s program apart and rewrote it, keeping his (or is it her?) line counting mechanism intact but altering the traversal scheme so that only *.py files would be counted, and so that they would be listed in a fashion similar to the Unix/Linux du command.  Using the current 1.5.1 version of PollyReports, the module itself weighs in at 262 actual code lines, 388 total lines (including comments and doc strings).  Using the version of Geraldo that I have downloaded, the total count for source files (excepting the effectively empty tests folder) is 1,785 actual lines of code, 4885 total lines including comments and doc strings.  I’m pretty sure that the code I abstracted from Robin’s script is not good in all cases; the docstring detector will not detect all docstrings, and may be confused by some literal string assignments (basically if you put three double quotes on a line by themselves, you’ll confuse it).  However, these counts do seem more reasonable.

Geraldo is almost 7 times the size of PollyReports, still pretty big, but not over 340 times as I originally reported it.  I think Robin’s code may have been tallying the documentation files as well as the actual Python code.

Putting Your Foot Down

I was going down the highway on my motorcycle the other day, thinking about a project I’m doing for a customer.  We just went live with it, and one of the first things I did (after transferring data from their old program to the new one) was to disable the data reload script.  I wrote the script for my convenience; it clears the tables, then loads them again from the export files I was using to provide sample data.  Obviously this would be bad, applied to the production database.

Then I found myself thinking about how often we visit the edge of disaster.  After all, here I was, going down a two-lane road on a motorcycle at 55 MPH.  Everything was going quite well… but what would happen if I put a foot down?

Well, it would hurt, that’s what.  More than likely I’d break or tear something I might need later… it’s even conceivable that I might wreck my bike and kill myself.

So sure, I could be driving a car, and putting my foot down wouldn’t be a problem.  Doesn’t mean I couldn’t kill myself just as effectively by doing something insanely stupid but very easy to do.  Like run off the road into a light pole.

At least, on the computer, I could disable the reload script.  This wouldn’t prevent me from accidentally typing “delete from important_table” in the MySQL user interface.  MySQL does have a “safe mode” where it needs a WHERE clause before it will run such a query.  But you have to remember to invoke it with the right option.

Do I have a point?  I’m not sure.  It’s just that we skate so close to various sorts of disasters all the time, and rarely think about the consequences until it’s too late.

Like the man in the uniform used to say, be careful out there.

Offensive Programming

Way back in the good ole days when I went to college to learn programming, one of the things I was taught was to program defensively.  I was to check for error returns (remember, this was before exception handling became the rule, not the, um, exception) and try to deal with them appropriately.  When your code is full of error checking, it is, naturally, longer; it’s also harder to read, in my opinion.

But like I said, it was a long time ago.  I learned on BASIC when you had to use line numbers, and then I learned Pascal and FORTRAN and PL/1 (the first on Apple IIe hardware, the other two on an IBM mainframe running MUSIC of all things).  Meanwhile, I took a part-time job programming a Xenix system, and while the main work was in a proprietary system called Profile 16, I took the opportunity to learn K&R C.

Perhaps it was C where I learned my bad habits.  You see sample code in books bereft of error handling (since it’s much clearer to leave it out if it’s not actually needed for the example) and you start writing code like that.  At least, I did.  I mostly checked for error returns on file opening, since that’s when it seemed most likely to be needed.  But my code worked, at least, after I got the obvious bugs out.  Fortunately for me, very little of that code is still in service anywhere… maintaining it would be a bear.

I kind of fell out of programming for a while, as I started a business selling and servicing computers (yes, I’m a programmer AND a technician).  When I finally accepted some work, it was in Visual Basic (well, VBA actually), and I fell back into my old bad habits.

But it was different, this time.  VBA gave me useful error messages when my program failed, even going so far as to drop me into the debugger.  I trained my users to make appropriate notes if an error message came up, and then I went back and either fixed the code or added the appropriate error handling.  Later I had the joy (that’s not sarcasm, it really was joy) of learning Python, and again, useful error messages; in Python, it turned out to be very easy to log the errors for later review, which is wonderful.

Lately, I’ve noticed how much more productive this “bad” habit has turned out to be.  My users are all pretty happy, as far as I can tell anyway, and in two cases I’ve had nice compliments from outsiders who have experienced these programs.  Oh, they aren’t sexy or anything… just programs that do work that needs doing.

I’m calling my method offensive programming.  I charge into the code and create, well, whatever is needed, and except for the most obvious cases, I don’t bother trying to figure out what might go wrong in advance.  Instead, I deal with the problems when they arise.

More to the point, I’ve come to the conclusion that, unless you’re designing really critical things (air traffic control software, medical software, etc.), defensive programming is insane.  Your goal is to figure out what might go wrong before it ever does, and then deal with it in advance.  But programs (and the computers they run on) have more failure modes than anything else humanity has ever created.  Trying to anticipate them all is a waste of time, as far as I’m concerned, unless of course your software holds human lives in its virtual hands.

Useful git alias

I found this on Hacker News and I love it.  Since I used this blog as my project notebook, I thought I should perhaps document it here (lest I forget where I got it later).

Here’s the alias:

git config –global alias.lg “log –color –graph –pretty=format:’%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset’ –abbrev-commit”

More updates to PollyReports

Made my first backwards-incompatible change today; instead of a right = … value in the Element initializer, I’m using align = … for a more general solution.  Before, your choices were right = 0 (the default) for left-aligned text, and right = 1 for right-aligned text.  But I needed something centered, and so I looked into the Reportlab docs and found drawCentredString(); to use it, I had to change the parameter, obviously.  While I was in there, I discovered drawAlignedString(), which is really cool, so I went ahead and added it to PollyReports also.

align may be set to “left” (the default), “right”, “center” (or “centre”, I’m not picky), or “align” to get any of these modes of alignment.

I guess that’s the only “real” change in version 1.4; it’s uploaded to PyPI and github, as usual.

http://pypi.python.org/pypi/PollyReports

https://github.com/Solomoriah/PollyReports

Minor PollyReports update

I found an issue with the ordering and printing of group headers and footers, and I fixed that; the current release 1.3 is now correct, as far as I know.  Also, I’ve revised the code to act intelligently when no detail band is defined, since every once in a while, it makes sense to omit it.

The documentation on PyPI has been updated to reflect these changes:

http://packages.python.org/PollyReports/

Hm.  Guess that’s all I had to say.