Panasonic G9. Close? Yes. Cigar? No.

Beware, bears! Russian strongman and former commando Mikhail Shivlyakov “psychs up” friend and fellow competitor Konstantina Janashia from Georgia, ready for a successful 480kg deadlift.
Camera: Panasonic DC-G9 | Date: 31-05-2018 15:07 | Resolution: 5017 x 3763 | ISO: 640 | Exp. bias: 0 EV | Exp. Time: 1/250s | Aperture: 5.6 | Focal Length: 300.0mm | Lens: LUMIX G VARIO 100-300/F4.0-5.6

This article was also published as a guest article on "The Online Photographer".

My Panasonic GX8 arrived pretty much on the day of official availability and has been my primary camera for almost three years, including two major photographic trips, and innumerable other opportunities in between. It improved on the already good GX7 with "just right" sizing, a better sensor and higher speeds. Like many other owners and fans I was looking forward to a fairly straight replacement – all Panasonic had to do was fix the awkward exposure compensation control and improve the action autofocus and it would be pretty much perfect. Fat chance.

Instead, and not for the first time, Panasonic have shaken up the Lumix G range, with the GX9 effectively moving down the range, and all the new goodness going into a new "stills flagship" the G9, which sits at the top alongside the video-centric GH5 and its variants.

After a bit of prevarication, I decided that I was due an upgrade, and plumped for the G9. My new camera arrived a few days ago. This review is based on the first few days’ moderately heavy use. It’s not meant to be a comprehensive, or dispassionate blow-by-blow review, but a set of personal impressions from a long-standing Panasonic user and fan.

Body Style and Size

At first the G9 looks like quite a different camera, larger and more expensive, and more of a "DSLR ethos" than the rangefinder-style GX8. I’ll come back to cost, but the size issue is deceptive: put the two cameras side by side and it’s clear that the only real difference is the G9’s DSLR "hump", and a slightly deeper grip, which is academic unless you use a very small pancake lens. Given that similarity it’s surprising that the G9 is a significant 171g (about 6oz) heavier. The camera offers better weatherproofing and a bigger battery, and does feel a bit more rugged, so that’s acceptable. Unlike its predecessor, but like my old Canon 7D, it feels like it might take the odd knock without problems. In practice, you get used to the weight quite quickly.

Like every new flagship camera the G9 is initially priced high, but this gives Panasonic and their dealers some room for manoeuvre with discounts, trade-ins and freebies. Depending on how you look at it my G9 cost me only about 2/3 of the advertised price, or the 5 year lifetime cost of my old GX7 net of trade-in was about £250. I can live with that.

Controls and Ergonomics

Back in early 2016 I wrote an open letter to Panasonic regarding the GX8, acknowledging its good points, but identifying opportunities to improve the ergonomics and usefully extend its stills capability. They clearly ignored the letter for the GX9, but either great minds think alike, or it did influence the G9.

Ergonomically, I am a fan of "electronic" control, by which I mean the ability to set camera functions fluidly between on-camera buttons and wheels including your choice of programmable controls, the menu system, and stored custom values. By contrast "fixed switches" break this free control model and cannot be included in stored settings for custom shooting modes. In addition, I am short sighted and wearing my "distance" glasses the tiny markings on such controls are effectively invisible.

The GX8’s exposure compensation control is a good (or should that be bad?) example of the latter. Apart from breaking my preferred control model it is also badly placed – I found that to operate it I either have to take my right hand off the camera and reach in from above, or somehow slide my thumb behind the camera, which usually results in both adjusted exposure and smeared glasses! No such problem with the G9 – you can quickly set up the camera so that the rear wheel, under the right thumb, controls the primary exposure value (aperture or shutter speed as appropriate), while the front wheel, easily in reach of the shutter finger, controls compensation. Vice-versa if you prefer. Perfect.

Unfortunately, however, Panasonic have perpetuated, and even aggravated one of the GX8’s other ergonomic failings, and arguably introduced a new one! The perpetual horror is focus mode. The G9, like most of the G series, has four main modes: manual focus (’nuff said), autofocus "single" (half press the shutter button to focus, then full press to expose with that focus), "follow" (another single shot mode, but if the primary subject moves while the shutter button is half pressed, the camera refocuses), and "continuous" (aligned to the high-speed shooting modes, refocuses for each exposure). The ideal solution would be a button which toggles between the modes. That’s good enough for a lot of very good cameras. However the G9 has a switch.

If you must have a switch, then surely it should have four modes? Nope. You select manual, continuous or single/follow on a three position switch, then have to dive into the menus to choose between single and follow, or the several variants of continuous. To add insult to injury, at least in the GX8 you could set the button in the middle of the focus switch to toggle between single and follow. Not on the G9, at least not with its initial firmware – this is set to AE/AF lock (which I personally never, ever use) and not programmable. The obvious fix is to make that button programmable so that when in the single/follow position it toggles between the two, when in the continuous position it toggles between the various variants of that mode, and when in the manual position it does something equivalently useful like turning focus peaking (highlighting) on and off. This could be fixed in a firmware update – I will just have to write to Panasonic and cross my fingers.

The other fixed switch on the G9 is for the drive mode (single, high speed, timer etc.) On the GX8 this is on a button, which is much better as you can include infrequent or situation-specific settings (like high speed mode) in appropriate custom shooting modes, and just leave the main aperture-priority settings or equivalent on single-shot, with a much reduced risk of going to take a shot and being in the wrong mode. The G9 arrangement seems like a retrograde step, but liveable.

Strengths


Krzysztof Radzikowski sets a new world record with a 150kg dumbell lift

That brings us from some arguable weaknesses of the G9 onto its real strengths. It’s fast – so fast it has three high-speed modes: high (about 5FPS), super-high 1 (about 15FPS) and super-high 2 (about 20FPS). The two super-high modes also have a very useful feature for sports and wildlife photography: hold the shutter half pressed and they will continuously store a few frames (about 0.4s worth) in the buffer, and write these to the card when you press the shutter, so if you are fractionally late clicking, you don’t lose the event. The downside is that you need to use the super-high settings with caution: if you are saving RAW + large JPEG files super-high 2 will chew up your memory cards at roughly 1GByte every 1.5 seconds. Another reason why I’d prefer to lock this to a custom mode!

Autofocus is much improved over the GX8, although I have to admit that my first sporting event with the new camera didn’t give it that much of a workout: in absolute terms, strongmen don’t move fast. it’s impressive to see a 150kg (330lb) man jogging with the same weight in each hand, but it’s not the harshest test of autofocus! However I can report that the G9 seems to adjust focus very quickly in continuous mode and seems to have missed relatively few shots. If there’s any pattern to the misses they tend to be the first shots of longer sequences, when I may have been moving the camera into position on the action. I’ll have to try and find something involving horses or fast cars for a better check.

Sensor readout also appears to have been improved, with a bit less banding on pictures of LED displays, and no obvious rolling shutter effects so far, although a higher-speed subject will really be required to confirm that.

The other area where Panasonic seem to have listened to my prior pleas is in support for bracketed and multi-shot images. In addition to the established support for exposure bracketing (for HDR), the new camera now does focus bracketing/scanning, as well as bracketing for aperture and white balance. Intelligently, even in single-shot drive mode you can choose to have the bracket shot at high speed to minimise the effect of subject or camera movement. The focus bracketing capability is something I have been seeking for a long time, and records full RAW files, a completely separate capability from the camera’s other ability to do in-camera focus stacking or post-shot focus selection from within a 6K movie file. Bracketed photos are clearly marked in their metadata, which makes it quite easy to build a script to sort them out from the rest of a day’s shooting.

Battery life is excellent – at the aforementioned strongman competition the camera was on for most of the five hours of competition and took about 600 shots. It used one battery and was about 30% into the second, much better than the GX8 would manage. I can also confirm that the two card slot arrangement works fine, effectively doubling the memory capacity, so I wasn’t fiddling with cards.

Two other ergonomic points are worth making. The rear display can be manually set to a nice bright setting for outdoors, but it’s automatic setting is far too dim. The EVF is large, detailed and bright, but as adjusted for my glasses has an odd pincushion distortion, with noticeably curved edges. This is nothing to do with the lens, which the camera corrects as required, but the way the EVF display is presented to the eyepiece. It’s not a major problem, but annoying to an inveterate picture-straightener like myself, especially as I haven’t had that problem with any of the predecessors.

Otherwise it’s pretty much business as usual. Image quality appears to be just the same as the GX8, much as expected given the common sensor, and the camera has a nicely familiar feel even if some of the controls are different and it’s definitely a bit heavier. Stabilisation is at least as good as the predecessor, with no noticeable penalty from the increased weight, but it’s clear that the full multi-second goodness of "dual IS 2" will have to wait until I can afford to start replacing my lenses with the new Mark II versions.

Conclusion

Would I recommend it? If you’re a committed Panasonic user, or have no existing mirrorless camera affiliation, and you want a very high capability, stills-centric camera, then absolutely. However if video is your thing, the GH5 may be better, and if you really don’t need the high speed or new advanced stills features, then a GX-series camera will save you weight and money. This is a very good camera, but not perfect. Panasonic still have room for improvement…

View featured image in Album
Posted in Micro Four Thirds, Photography, Thoughts on the World | Leave a comment

OK Google, Here’s Another One…

Having established that there’s a real, valuable use case for Google’s phone-call-making AI (making outgoing calls which have to be routed via complex menus, lengthy queues, or security gatekeepers) I got thinking.

When I was in my early 20s and worked in a real office with doors and a bit of peace and quiet, I had access to a much valued colleague who’s function has almost entirely disappeared from modern life, unless you are enormously rich and powerful. She was called "a secretary".

One of the secretary’s functions was handling incoming phone calls: blocking the nuisances, re-routing the misdirected, taking understandable messages if I was not available, or putting the caller through with a clear announcement if I was. Where "a secretary" scored enormously over "a telephonist" was in knowing a bit about my business and me personally and being able to make some decisions on her (it was usually a her) own. She could also recognise regular accepted callers by their voice and deal with them much more quickly than strangers.

I’d like a computer which can do that.

Now this is definitely a step harder than just placing outgoing calls, but only a step. We don’t have to create a full-blown JARVIS (Iron Man’s AI butler) to get a lot of value.

Recognising known contacts by their voiceprint and incoming line details should be pretty straightforward, and it should be easy to make the list manageable, adding rules about how to deal with different people at different times. Taking messages can be a hybrid of two technologies. Because the caller is talking to a computer the call audio can be recorded, but the automated secretary could run through a simple script to get a direct call-back number ("now you are sure that’s direct and he’s not going to have to go through some horrible menu to get back to you"), spell out the caller’s name and company if it’s not recognised, and get an identifying account number or similar so I can verify the call’s veracity and quickly get my case recognised on call back. These could all be popped into an email or text to me, so I can see them written down rather than having to listen to them and write them down myself.

Those capabilities alone would get rid of a lot of nuisance callers. Scammers who want to offer to move my money to their own accounts are not going to want to leave verifiable contact details, or will not be able to provide valid authentication. Sales calls are a bit different. Most "spam" callers don’t waste their time with answering machines, so if we make the AI secretary recognisable as such that will get rid of most. Any who are really persistent can then be recognised by "trigger" words, such as "PPI", or "double glazing", or "the security department of Microsoft Windows" (yeah, right), plus non-verbal cues like the double-ring of a connection from Asia, or the chattering background in an Indian call centre, just like I do it. That would be a really powerful application of machine learning technology. I could choose how my secretary deals with identified nuisance callers: just hang up, choose a random insult from a list and hang up, keep them talking until they get bored, or redirect the call to an 0898 number where I’m sure the young ladies will be happy to listen to them all day, for a fee.

While we’re at it, let’s make the voice and personality programmable. I had Joanna Lumley’s voice (Purdey rather than Patsy) on my satnav for a while, and that would tick a lot of boxes for me, as a 50-something male. But I can also see the charm of recreating some famous fictional assistants: JARVIS, or how about Chris Hemsworth’s character from Ghostbusters 3, ladies?

OK Google. How about this?

Posted in Thoughts on the World | Leave a comment

They’re All Missing the Point

Since Google’s demo of an AI bot making a phone call a few weeks ago, the reaction I have read seems to be completely polarised. About half the reviewers are blown away, believing it to be unleashing AI wonders/horrors which are half a step away from SkyNet going live. The other half are nonplussed, seeing no potential value.

They are all wrong.

Let’s deal with the "this is the advent of true AI" bunch first. Google have demonstrated a realistic sounding voice which can currently deal with a few, very limited scenarios, and I suspect will rapidly fail if the other party goes significantly off track. Sure, it’s a step forward, but just a step. If you want to see a much more convincing demo, catch up with the program "How to Build a Human" from about 18 months ago, in which the makers of the Channel 4 Sci-Fi program "Humans" got a mix of British experts to build a robot Gemma Chan, who (which?) was then interviewed over Skype by a bunch of entertainment journalists. About half the reviewers didn’t realise they weren’t talking to the real Gemma. That’s much closer to a Turing test pass.

At the other end of the scale we’ve got those who don’t see any advance or value to a machine which can help make a phone call. To those, I have a simple question: "how did you get on, the last time you rang your bank / utility / travel company / <insert other large organisation here>?"

I completely agree that it’s a waste, and maybe a bit sinister, to task a robot with making a call to a local restaurant or hairdresser. But when was the last time you rang anything other than a small local business, and got straight through to talk to a human being? We all waste far too much of our time sitting on the phone, trying to navigate endless menus, trying to avoid the dead end where all you can do is hang up and try again, or listening to "Greensleeves" being played on a stylophone with a reminder every 20s that the recipient values your call. Yeah, right.

If I want to deal with a computer, I’ll go onto the website. I’m very happy doing that, and if I can do my business that way I will. The reason I have picked up the phone is one of the following:

  • The website doesn’t support the transaction I want to execute, or the information I need. I need to speak to a human being.
  • The website has a problem. I need to speak to a human being.
  • The website has instructed me to phone and speak to a human being.

Spot the common thread?

So I have the ideal use case for Google’s new technology. It makes the phone call. It navigates the endless menus, referring to a machine learning database of how to get to a human being as quickly as possible, and how to avoid dead ends in that organisation’s phone system. It provides simple responses to authentication prompts if it can, or prompts me for just the required information. If the call drops or dead ends it starts again. And it listens to "Greensleeves" or equivalent, silently in the background, until it’s sure it’s speaking to a human being. At that point, it says, like a good secretary would, "please hold, I have Mr Andrew Johnston for you", gets my attention and I pick up the call.

In the meantime, I get on with my life.

In some ways, this is actually easier than what Google have already done, because most of the interaction is computer-to-computer, and actively doesn’t need a human-like voice or understanding. It’s certainly a better use of the technology than pestering the local hairdresser.

OK Google. Build this, please.

Posted in Thoughts on the World | Leave a comment

How Hard Can It Possibly Be?

I really should have known better. In last week’s piece on random music player algorithms, I made the rather blasé statement "I can live with it for a while and I can probably resolve the issue by downloading another music player app". Yeah, sure.

Now we all know that assumptions are dangerous. One boss of mine was inordinately fond of the quote "assumptions are the mother of all f*** ups", and he wasn’t wrong. However I really did expect that music players were a relatively mature and stable component of the Android app space.

So how did I get on with trying to download a better random music player? So far, I have downloaded somewhere between 10 and 20 apps. I have discovered:

  • Apps which just don’t start, or which crash immediately
  • Apps which can’t see the SD card on which my music is stored, and insist on randomly playing 3 ringtones
  • Apps which can’t play a lot of my music. Come on guys, WMV format is not exactly "edge".
  • Apps which don’t have a random function, despite the words "random" or "shuffle" in the description
  • Apps which don’t display properly on my phone’s screen
  • Apps which display nicely and seem to have all the functions I need, but where the random function is to start with one song chosen at random, and then just play all the other songs on my device in alphabetic order of title (at least 3 instances of this!)
  • Apps which display nicely and have a decent random function, but then 60% of the time no sound comes out of the headphones when you press "play"
  • Apps which display OK, and appear to have a decent random function, but most of the other advertised functions don’t work

Worse case, I can probably live with the last – I can always use the Sony app for other purposes – and late last night I spent another 5 minutes and maybe, just maybe, I have found one app which will work, albeit with a slightly odd user interface.

But honestly, how hard can it possibly be?

 

Addendum – Two Months Later

Back to square one after upgrading to Android 8, which actively suppresses WMA files from the shared media index… (See "That Was Too Easy…") I’ve found some more ways you can make this not work. No Jemima, it doesn’t count playing Atomic Kitten, then CCS, then Led Zeppelin,  then AC/DC, if the songs are "Whole Again", "Whole Lotta Love", "Whole Lotta Love" and "Whole Lotta Rosie"!

Posted in Thoughts on the World | Leave a comment

Inferring Algorithms: How Random is Your Music Player?

“You’re Inferring that I’m stupid.”

“No, I’m implying that you’re stupid. You’re inferring it.”

– Wilt, by Tom Sharpe

My latest contract means spending some time on a bus at each end of the day. The movement of the bus means it’s not comfortable to read, so I treated myself to a nearly new pair of decent BlueTooth headphones, and rediscovered the joys of just listening to music. I set the default music player app to “random” and let it do its stuff.

That’s when the trouble started. I started thinking about the randomisation algorithm used by the music player on the Sony phone. I can’t help it. I’m a software architect – it’s what I do.

One good music randomisation algorithm would look like this:

  1. Assign every song on your device a number from 1 to n
  2. When you want to play a random song, generate a random number between 1 and n, and play the song with that number.

However in my experience no-one ever implements this, as it relies on maintaining an index of all the music on the device, and assigning sequential numbers to it. That’s not actually very difficult, given that every platform indexes the music anyway and a developer can usually access that data, but it’s not the path of least resistance.

Let’s also say a word about generating random numbers. In reality these are always pseudo-random, and depending on how you seed the generator the values may be predictable. That may be the case with Microsoft’s software for picking desktop backgrounds, which seems to pick the same picture simultaneously on my laptop and desktop more often than I’d expect, but that’s a topic for another blog, so for now let’s assume that we can generate an acceptably random spread of pseudo-random numbers in a given integer range.

Here’s another algorithm:

  1. Start in the top directory for the music files
  2. Pick an item from that directory at random. Depending on the type:
    • If it’s a music file, play it. When finished, start again at step 1
    • If it’s a directory, make it your target and redo step 2
    • If it’s anything else, just repeat step 2

This is easy to implement, runs quickly and plays nicely with independently changing media files. I’ve written something similar for displaying random pictures on a website. It doesn’t require maintaining any sort of index. It generates a good spread of chosen files, but will play albums which are alone under the first level root (usually the artist) much more than those which have multiple siblings.

My old VW Eos had a neat but very different system. Like most players it could work through the entire catalogue in order, spidering up and down the directory structure as required. In “random” mode it simply calculated a number from 1 to approximately 30 after each song, and used that as the number of songs to skip forwards in the sequence.

This was actually quite a good algorithm. As well as being easy to implement it had the side-effect of being at least partially predictable, usually playing a couple of songs by the same artist before moving on, and allowing a bit of “what’s next” guesswork which could be entertaining on a long drive.

So what about the Sony music app on my phone? At first it felt like it was doing the job well, providing a good mix of genres, but after a while I started to become suspicious. As it holds the playlist in a readable form, I could check that suspicion. These are key highlights from the playlist after about 40 songs:

  • 1 from ZZ top
  • 1 from “Zumba”
  • 3 from Yazoo!
  • 1 from Wild Cherry
  • 1 from Wet Wet Wet
  • Several from “Various Artists” with album titles like “The Very Best…”
  • 0 from any artist filed under A-S!

I wasn’t absolutely sure about the last point. What about Acker Bilk and Louis Armstrong? Turns out they are both on an album entitled “The Very Best of Smooth Jazz”…

I can also look ahead at the list, and it doesn’t get much better. Van Morrison, Walter Trout, The Walker Brothers, and more Wet Wet Wet 🙁

So how does this algorithm work (apart from “badly”)? I have a couple of hypotheses:

  • It implements a form of the “give every track a number” algorithm, but the index only remembers a fixed number of tracks numbering a few hundreds (maybe ~1000), and anything it read earlier in the indexing process is discarded.
  • It implements the “give every track a number algorithm”, but the random number generator is heavily biased towards the end of the number range.
  • It’s attempting a “random walk”, skipping a random number of steps forwards or backwards through the list at each play (a bit like the VW algorithm, but bidirectional). If this is correct it’s odd that it has never gone into “positive” territory (artists beginning with A-S), but that could be down to chance and not impossible. The problem is that without a definite bias a random walk tends to stay in the same place, so it’s a very poor way of scanning your music collection.

Otherwise I’m at a loss. It’s not like I have a massive number of songs and could have run into an integer size limit or similar (there are only around 11,000 files, including directories and artwork).

Ultimately it doesn’t matter that much. I can live with it for a while and I can probably resolve the issue by downloading another music player app. However you can’t help feeling that a giant of entertainment technology like Sony should probably manage better.

Regardless of that, it’s an interesting exercise in analysis, and also potentially in design. Having identified some poor models, what constitutes a “good ” random music player? I’ve seen some good concepts around grouping songs by “mood”, or machine learning from previous playlists, and I’ve got an idea forming in my head about an app being more like a radio DJ, looking for “links” between the songs in terms of their artist names, titles or genres. Maybe that’s the next development concept. Watch this space.

Posted in Code & Development, Thoughts on the World | Leave a comment

Why REST Doesn’t Make Life More Rest-full

Really Rest-full (Cuba 2010)
Camera: Canon EOS 7D | Lens: EF-S15-85mm f/3.5-5.6 IS USM | Date: 20-11-2010 15:41 | ISO: 200 | Exp. bias: -1/3 EV | Exp. Time: 1/250s | Aperture: 9.0 | Focal Length: 53.0mm (~85.9mm) | Lens: Canon EF-S 15-85mm f3.5-5.6 IS USM

As I have observed before, IT as a field is highly driven by both fashion and received wisdom, and it can be difficult to challenge the commonly accepted position.

In the current world it is barely more politically acceptable to criticise the currently-dominant model of REST, Javascript and microservices than it is to audibly assess the figure of a female co-worker. I was seriously starting to think that I was in some age-defined Luddite minority of one in not being 100% convinced about the universal goodness of that model, but then I discovered an encouraging article by Pascal Chambon “REST is the new SOAP“, and realised that it’s not just me. I am not alone.

I don’t want to re-create that excellent article, and I recommend it to you, but it is maybe instructive to provide some additional examples of the failings Chambon calls out. I have certainly fallen foul of the quasi-religious belief that REST is somehow “better because it uses the right HTTP verbs”, and that as a result the “right verbs must be used”. On my last contract there was a lengthy argument because someone became convinced I was using the wrong ones. “You’re using POST to do a DELETE. That’s wrong.”

“No, we’re submitting a request to do a delete, if approved. At some later point, after the request has been reviewed and processed, this may or may not result in a low-level delete action, but the API is about the request submission. And anyway, you can’t submit a proper payload with a DELETE.”

“But you’re using a POST to do a DELETE…”

In the end I mollified him slightly by changing the URL of the API so that the tip wasn’t …/host, but …/host/request, but that did feel like the tail wagging the dog.

Generally REST promotes a fairly inflexible CRUD model, and by default without the ability to specify exactly which items are retrieved or updated. In a good design we may need a much richer set of operations. In either an RPC approach (as outlined in Chambon’s article), or a “remote object access” approach, such as one based on SOAP, we can flexibly tailor the operations precisely to the needs of the solution.

Here’s a good example. I need to “rename” an object, effectively changing its primary key. In the REST model, I have to choose one of the following:

  • Add extra fields to the PUT payload to carry the “new” and “old” keys, and write both client- and server-side conditional code around their values, or an additional “operation” value
  • Do a DELETE (with the old key) followed by a POST (with the new one), making sure that all the other data required to recreate the record is passed back for the POST, and write a host of additional code to handle cases like the DELETE succeeding but the POST failing, or the POST being treated as a new item, not just an update (because it’s not a PUT).
  • Have a dedicated endpoint (e.g. …/object/rename) which accepts a POST operation with just the required data for the rename. That would probably be my favourite, but I can hear the REST purists screaming in the wind…

In a SOAP model, I can just have an explicit Rename(oldkey, newkey) operation on a service named for the underlying business object. Simples.

So Is SOAP The Old REST?

I’m comfortable with Chambon’s casting of REST as the supposed handsome hero who turns out to be a useless, treacherous bastard. I’m less comfortable with the casting of SOAP as the pantomime villain (boo hiss).

Now your mileage may vary, and Chambon obviously had some bad experiences, but in my own experience SOAP is a very strong and reliable technology which a lot of the time “just works”. I’ve worked in environments where systems developed in .Net, Oracle, Enterprise Java, a LAMP stack and Python cheerfully exchanged with each other using SOAP, across multiple physical locations, with relatively few complexities and usually just a couple of lines of code to access a full object model with formal schema and policy support.

In contrast, even if you navigate through the various different ways a REST service may work, inter-platform operation is by no means as simple as claimed. In just the past week I wasted about half a day trying to pass a body parameter between a Python client and a REST API presented by .Net. It should have worked. It didn’t. I converted the service to SOAP, and it worked almost first time. (Almost. It would have been even quicker if I’d remembered to RTFM…)

Notwithstanding the laudable attempts to fill the gap for REST, SOAP is still the only integration technology where every service has full machine and human readable documentation built in, and usually in a standard fashion. Get a copy of the WSDL (Web Service Definition Language) either from the service itself, or separately, and you know what it does, with what data, and, where it’s relevant to the client, how.

To extend the theatrical metaphor, in my world SOAP is the elderly retired hero who’s a bit pedantic and old-fashioned, maybe a bit slow on his feet, but actually saves the day.

It’s About the Architecture, Stupid

Ultimately it doesn’t actually matter whether your solution uses REST, SOAP, messages, distributed objects or CSV file transfers. Any can be made to work with sufficient attention to the architecture. All will fail in the presence of common antipatterns such as complex mixed data models, massive functional decomposition to too fine a level, or trying to make high-frequency chatty exchanges over higher-latency links.

Modern technologies attempt to hide a lot of technical complexity behind simple abstraction layers. While that’s an excellent approach overall, it does raise a risk that developers are unaware of how a poor design may cause underlying technical problems which will cause failure. For example while some low-level protocols are more tolerant than others, the naïve expectation that REST will work over any network regardless “because it is based on HTTP” is quite wrong. REST, SOAP and plain old web pages can all make good, efficient use of HTTP. REST, SOAP and plain old web pages will all fail if you insist on a unit of work being composed of vast numbers of separate small exchanges rather than a few larger ones. They will all fail if you insist on transferring large amounts of unfiltered data to the client, when that data should be pre-processed and filtered on the server. They will all fail if you insist on making every low-level exchange a network service when many of these should be direct in-process operations.

Likewise if you have a load of services, whether your own microservices or third party endpoints, and each service defines its own data structure which may be subject to change, and you try and directly consume and produce those proprietary data structures everywhere you need them, you are building yourself a world of pain. A core common data model with adapters for each format will serve you much better in the long run.

So Does Technology Choice Matter?

Ultimately no. For example, I have built an architecture with an underlying canonical data and adapter model but using REST for every exchange we controlled and it worked fine. Also in the real world whatever your primary choice you’ll probably have to deal with all the others as well. That shouldn’t scare you, but I have seen REST-obsessed developers run screaming from the room at the thought of having to use SOAP as well…

However, a good base choice will definitely make things easier. It’s instructive to think about a layered model of the things you have to define in a complex integration:

  • Documentation
  • Functionality
  • Data structure and format
  • Data encoding and transport
  • Policies
  • Service location and routing

SOAP is unique among the options in always providing built-in documentation for the service’s functions, data structures and policies. This is a major omission in the REST world, which is progressively being addressed by the Swagger / OpenAPI initiative and variants, but they will always be optional add-ons with variable coverage rather than a fundamental part of the model. For all other options, documentation is necessarily external to the service itself, and it may or may not be up to date and available to whoever needs it.

Functionality is discussed above and in Chambon’s article. Basically REST maps naturally to CRUD operations, and anything else is a bit of a bodge. SOAP and other RPC or distributed object models provide direct, explicit support for whatever functions are required by the business problem.

SOAP provides built-in definition and documentation of data structures and formatting, using XML Schema which means that the definition is machine and human readable, standardised, and uses namespaces and references to manage, for example, items with the same name but different uses and formats. Complexities such as optionality and alternative structures are readily defined. In addition a payload can be easily verified against the defined schema. Swagger optionally adds similar capabilities to the REST model, although without some discipline it’s easy for the implemented service to differ from the documented one, and it’s less easy to confirm that a given payload conforms. Both approaches focus on syntactic definition with semantic guidance optional and mainly through comments and examples.

In terms of encoding the data, the fashionable approach is JSON. The major benefits are that it’s simple, payloads are a bit smaller than the equivalent XML, and that it’s easy to parse into and generate from equivalent data structures in languages like Python.

However, I’m not a great follower of fashion. XML may be less trendy, but it offers a host of industrial-strength features which may be important in more complex use cases. It’s easy to unambiguously indicate the schema for each document and validate against it. If you have non-ASCII or binary data then their encoding is unambiguously defined. It’s easy to work separately with fragments of a larger document if you need to. Personally I also find XML easier to read and manually edit if I have to, but I accept that’s a bit subjective. One argument is that JSON is easier to render into a HTML page, but I’ve achieved much the same without any procedural code at all using XML with XSLT.

Of course, there’s no real need to have to choose. The best REST APIs I have worked with have the ability to generate equivalent JSON and XML from the same queries, and you choose which works best in a given context. Sadly this is again a bit too much for the REST purists, but a good solution when it works.

Beyond the functional definition of a service and its data, we also have to consider the non-functional behaviours, what are often referred to as “policies” in this context. How is the service secured? What encryption is applied to payloads and headers? What is the SLA, and what action should you take if it is exceeded? Is asynchronous or callback behaviour defined? How do I confirm I have all the required items in a set of exchanges, and what do I do about missing ones? What happens if a service fails, or raises an error?

In the early 2000s, when web services were a new concept, a lot of effort was invested in trying to establish standard ways to define these policies. The result was a set of extensions to SOAP known as the WS-* specifications: a set of rules to enable direct and potentially automated negotiation of all these aspects based on standardised information in the service WSDL and SOAP headers. The problem was that the standards quickly proliferated, and created the risk of making genuinely simple cases more complex than necessary. REST emerged as a simpler alternative, but with a KISS ethic which means ignoring the genuinely complex.

Chambon’s article touched on this in his discussion of error coding, but there are many other similar aspects. REST is a great solution for simple cases, but should not blind the developer to SOAP’s menu of standard, stronger solutions to more difficult problems.

A similar choice applies at the final level, that of locating and connecting service endpoints at runtime. For many cases we simply rely on network infrastructure and services like DNS and load balancing. However when this doesn’t meet more complex requirements then the alternatives are to construct or adopt a complex proprietary solution, or to embrace the extended standards in the WS-* space.

One technology choice is important. A professional modern Integrated Development Environment such as Visual Studio or Intellij Idea will do much of the “heavy lifting” of development, and does make work much quicker and less error-prone. I completely fail to understand why in 2018 some developers are still trying to do everything with vi and a Unix command line. When I was a schoolboy in the 1970s there was a saying “shouldn’t you have handed that in at the end of the war?”, referring to people still using or hoarding equipment issued in WW2. Anyone who is trying to do software development in the late 2010s with the software equivalent deserve what they get… It is a mistake to drive a solution from the constraints of your toolset.

Conclusions

The old chestnut that “to the man who only has a hammer, every problem looks like a nail” is nowhere more true than in software development. We seem to spend a great deal of effort trying to make every new software technique the complete solution to life, the universe, and everything, rather than accepting that it’s just another tool in the toolbox.

REST is a valid addition to the toolbox. Like it’s predecessors it has strengths and weaknesses. It’s a great way to solve a whole class of relatively simple web service requirements, but there are definite boundaries to that capability. When you reach those boundaries, be prepared to embrace some older, less-fashionable but ultimately more capable technologies. A religious approach will fail, whereas one based on an architectural viewpoint and an open assessment of all the valid options has a much greater chance of success.

View featured image in Album
Posted in Agile & Architecture, Code & Development | Leave a comment

The Architect’s USP

Standing out in the marketplace (Morocco 2013)
Camera: Panasonic DMC-GX7 | Date: 11-11-2013 17:09 | Resolution: 3064 x 3064 | ISO: 1600 | Exp. bias: -33/100 EV | Exp. Time: 1/500s | Aperture: 8.0 | Focal Length: 300.0mm | Location: Djemaa el Fna | State/Province: Marrakech-Tensift-Al Haouz | See map | Lens: LUMIX G VARIO 100-300/F4.0-5.6

Very early on in any course in marketing or economics you will encounter the concept of the "Unique Selling Proposition", the USP, that factor which differentiates a given product or service from its competitors. It’s "what you have that competitors don’t", a key reason to buy this one rather than an alternative.

With the current trend away from development specialisms such as architect towards relatively homogenous development teams, it is perhaps instructive to ask "What is the architect’s USP?" Why should I employ someone who claims that specialism, and give him or her design responsibility, rather than just expecting my developers to cover it?

I have written elsewhere about why I don’t buy into the ultra-agile concept of "architecture emerging from the code", any more than I would bet money on the script for Hamlet "emerging" from a finite group of randomly typing monkeys. (Of course, if you have an infinite number of monkeys then it’s more achievable, but that’s infinity for you…) However that argument is about process, and I believe that almost irrespective of process a good architect’s skills and perspectives can have a significant beneficial effect on the result. That’s what I want to explore here.

The Architect’s Perspective

One key distinction between the manager, the architect and the developer is that of perspective. As an architect I spend a lot of time understanding and analysing the different forces on a problem. These design forces may be technical, or human: financial, commercial or political. The challenge is to find a solution which best balances all the design forces, which if possible satisfies the requirements of all stakeholders. It is usually wrong and ultimately counter-productive to simply ignore some of the stakeholders or requirements as "less important" – any stakeholder (and by stakeholders I mean all those involved, not just senior managers) can derail a project if not happy.

Where design forces are either aligned or orthogonal, there is usually a "sweet spot" which strikes an acceptable balance. The problem effectively becomes one of performing a multi-dimensional linear analysis, and then articulating the solution.

However, sometimes the forces act in direct opposition. A good example is system security, where requirements for broad, easy access directly conflict with those for high security. In these cases the architect has to invest heavily in diplomacy skills – to invest a lot of time understanding and addressing different stakeholder positions. One common problem is "requirements" expressed as solutions, which usually hide an underlying concern that can be met many ways, once understood and articulated.

In cases of diametrically opposed requirements, there are usually three options:

  • Compromise – find an intermediate position acceptable to both. This may work, but it may be unacceptable to both, or it may fatally compromise the architecture.
  • Allow one requirement to dominate. This has to be a senior level business decision, but the architect must be sensitive to whether the outcome is genuinely accepted and viable, or whether suppressing the other requirements will cause the solution to fail.
  • Reformulate the problem to remove or reduce the conflict. In the security example the architect might come up with a cunning partitioning of the system which allows access to different elements under different security rules.

Of course, you can’t resolve all the problems at once – that way lies madness. An architect uses techniques like layered or modular structures, and multiple views of the architecture to "separate concerns". These are powerful tools to manage the problem’s complexity.

The architect must look at the big picture, balance the needs of multiple stakeholders, and bring to bear an understanding of the business, of strategy, of technology and of development project work at the same time. If these responsibilities are split among too many heads and isolated within separate organisational confines then you lose the ability to see how it all fits together, and increase the danger of things "falling through the cracks".

The Architect’s Responsibilities

The architecture, and its resolution of the various design forces (i.e. how it meets various stakeholder needs) have to be communicated to many who are not technical experts. The architect acting as technical leader must take much of this responsibility. The messages may have to be reformulated separately for different audiences: I have had great success with single-topic briefing papers, which describe aspects like security in business terms, and which are short and focused enough to encourage the readers to also consider their concerns separately.

The architect must listen to the voice inside, and carry decisions through with integrity. For an architect, the question is whether the architecture is elegant, and will deliver an adequately efficient, reliable and flexible solution. If the internal answer to this is not an honest "yes", it is important to understand why not, and decide whether all the various stakeholders can live with the compromises.

The architect must protect the integrity of the solution against the slings and arrows of outrageous projects. (Hamlet again?) Monitor in particular those design aspects which reflect compromises between design forces, because they will inevitably come under renewed pressure over time. The architect must not only do the right thing, but ensure it is done right.

While every person on the project should be doing these things, there is a natural tendency for most to allow delivery priorities to take precedence. A developer’s documentation, for example, must be adequate to communicate the solution to other developers and maintainers, but does not have to be comprehensible to other stakeholders. However for the architect integrity, fit and communication of the solution are primary responsibilities, not optional. In addition the architect should have sufficient independence to call out and challenge conflicts of interest when they do occur.

The Architect’s Skills

The architect should be equipped with a distinct set of skills in support of these responsibilities. These will include:

  • Design patterns and knowledge of how to apply them
  • Tools and techniques to formally document both detail designs and wider portfolios
  • Methods to ensure that requirements, especially non-functional ones, are documented unambiguously
  • Methods to review a solution design, model its behaviour and confirm the solution’s ability to meet requirements
  • The ability to clearly communicate solutions, issues and potential resolutions to a wide variety of stakeholders
  • The ability to support the project and programme managers in handling the impact of issues and related decisions

Now it’s perfectly possible (and highly desirable) that others on the project will have many of these skills between them. However their combination in the architect is key to the delivery of the architect’s value, and a solution with a good chance of meeting its various objectives.

The Architect’s Position

A good architect should be able to operate in various organisational positions or roles and still deliver the above. Irrespective of the official organisation chart I often end up working between two or more groups, and I suspect this is a common position for many architects. It may actually be a natural result of adopting the architect’s unique perspectives.

The architect’s role may to some extent overlap with that of developers, analysts or product owners, and in smaller organisations or projects the architect may also take on one of these roles. In that case the architect must be able to "wear the appropriate hat" when focusing on a specific project issue or taking a wider view. The architect must then ensure that his or her ability to look at the wider picture is not compromised by the project relationship.

Conversely, a central architecture group may become accused of being in an ivory tower, separate from the realities of the business and the developers at the coal face. An architect in such a position must actively display an interest in and willingness to help with practical project issues.

A good architect will reconcile the need for a broad perspective and the specific responsibilities of a given position, thereby delivering distinct value compared with someone who has a more specific scope. I may on occasion be challenged for taking a wider interpretation of scope than others, but the insights which accrue from that perspective are almost always seen as valuable.

Conclusions

These are generalisations, and in practice there are as many variants on the architect’s role, skills and delivery as there are individuals who take the title. However it is generally true that an architect’s involvement increases the chance that a solution’s behaviour will be predictable, understood, and a good fit to its objectives. That’s the fundamental USP of the architect.

View featured image in Album
Posted in Agile & Architecture | Leave a comment

To BD or Not to BD

Should I buy the Blu-Ray?

So you have a collection of several hundred DVDs, you’ve finally managed to remove almost every VHS tape from the house, and you’ve bought a shiny new TV and disk player. Which, if any, of you existing disks should you replace with new versions, and which versions should you buy?

We have a large video collection, and we’ve already owned several versions of some titles, maybe a couple of different tapes or different DVD releases. Replacing some of our existing disks might make sense, but we really don’t want to do it wholesale when we’ve already got "good" copies of a lot of stuff. Our experience is that there are cases where the cost of replacement is fully justified, and others where it is just a waste of money. I thought it might be useful to try and distil that experience into some guidelines for others in the same predicament.

This does assume that you like "big" films, or the best output of National Geographic and the BBC Wildlife Unit. If fluffy romantic comedies are your thing, or you like budget arthouse movies, then this may not apply. That’s also the case if you don’t like 3D, or your system doesn’t support it (ditto 4K). Please modify this advice accordingly.

Newer Films

The first thing to say is that if you have a "good" DVD of a film or TV series made after about 1995, and it’s not covered by one of the following special cases, then there’s limited benefit to replacing your DVD with the equivalent Blu-Ray. If your disk player does a good job of "upscaling" to HD, or even 4K, then the change will be marginal and you will wonder why you spent that money. If your disk player does not play recent high-quality DVDs well, then your money is better spent on getting a better one.

Crude DVD Transfers

A lot of my DVDs, even for big blockbuster films, are fine based on the previous advice, and aren’t going anywhere. However there are exceptions. These tend to be films from the 1980s and 1990s which were released on VHS and then pushed to DVD using the same digital version, and while the quality was adequate for viewing in the early 2000s, it shows up really badly on newer kit. Grainy/noisy video and inaudible sound are common problems. The dead give-away is when your DVD player produces a half-sized picture in the middle of the screen, suggesting that the video isn’t even full DVD resolution.

This is true of my DVDs of some quite major films, including Robin Hood Prince of Thieves and Tremors. Buy the Blu-Ray, but look for some evidence like the word "remastered" which suggests that they went back to the film and re-processed it (and didn’t just push the same awful video onto a Blu-Ray). For some favourites the improvement will blow you away, but even in more marginal cases you will be at least less frustrated.

There is an obvious consideration about the quality of the source material. If it was recorded on 1980s videotape there’s a limit to what can be achieved. Sadly, the DVD of Edge of Darkness (the TV masterpiece) is about as good as that’s going to get, but I will be very happy and first in the queue if someone can prove me wrong.

Remastered Classics

Where the source material does support it, which is true of a lot of classic films made in the 1960s and 1970s (and some earlier ones), there’s the option of a frame-by-frame restoration to the highest possible modern video and sound standard. The British Film Institute has done this for favourites such as The Italian Job, Zulu and most of David Lean’s films. MGM/Eon has done it for all the Bond films.

The results, on Blu-Ray, can be absolutely stunning. It’s like a 2010s film crew was transported back and filmed the same performances on modern kit.

In Zulu you can see every barb of every feather on the Zulus’ clothing, and you can see that because Chard and Bromhead were from different regiments, there’s a little piece of dark green trim on one tunic which is dark blue on the other. In The Italian Job you can read the badges on the cars and motorbikes. The night-time scenes in From Russia with Love are no longer muddy brown, but sharp blacks in Istanbul, and with a lovely pre-dawn blue glow on the Yugoslavian border. You can admire the couture workmanship on the Bond girls’ dresses. I could go on.

It’s literally like watching a new film. You’ll see so much you didn’t before.

In fairness, it’s the remastering which makes the difference as much as the disk format. Before we bought the Bond Blu-Ray collection we had a DVD of Goldfinger which was based on the remastered version, and that delivered much of the same benefit, but if you haven’t invested in those intermediate versions then the Blu-Ray is even better.

Films Released in 3D

We love 3D, even if sadly the entertainment industry has fallen out of love with it again, and the availability of support in new kit and new film releases is reducing. If you like it, and your system supports it, and there’s a 3D Blu Ray of a film you have on DVD, get the 3D disk. The video and sound quality will be better, and you’ll enjoy the literal extra dimension to the work.

3D Remasters

A small and select but wonderful set of films have been subject to the best of both worlds, remastering the video, but also retrospectively putting them into 3D. The primary examples are Titanic, Jurassic Park, Predator and Terminator 2: Judgement Day, but there are a few others. Like the remastered 60s films, it’s a whole new level of enjoyment. Highly recommended, even if like me, you have probably purchased each of these films in about 4 different previous versions. While industry trends and costs mean there may not be too many more films given this treatment, the fact that the 3D version of T2 was released just before Christmas 2017 does mean that we shouldn’t give up hope.

4K Remasters

As part of the shift away from 3D, the industry is pushing 4K / UltraHD. (This has twice the resolution of normal Blu-Rays and HD TV, at 2160 pixels vertically.) In addition to 4K versions of new blockbusters, there are some "4K remasters" of big films from the last 20 years. However I’m much less convinced about these.

First, if you have normal eyes, ears and equipment, 4K really isn’t the vast improvement over standard HD Blu-Ray that the hype claims. Part of this is just simple diminishing returns as the picture resolution increases beyond what we can easily distinguish. There’s a very good chart on this at http://carltonbale.com/1080p-does-matter/, reproduced below:

What this boils down to is that unless you are viewing 4K on a 60" screen from about 5′ (1.5m), you’re not going to notice much difference from HD, and in practice, that’s far too close to view a screen of that size. We view our 58" screen from about 8′, which is probably still a bit too close, and I can just about see a difference in normal viewing. Obviously if you’re a 20 year old bird spotter things might be different… 4K is great for a cinema, limited value for a telly.

However, there are also a couple of more insidious problems. Some of the conversions are significantly "overdone" – pushing the contrast to extremes which don’t match the material. The Mummy (the 1999 Stephen Sommers film) is a good example, where the 4K version is a riot of shiny highlights and pitch black shadows, while the Blu-Ray retains the beautiful look of the original film. In addition, many 4K remasters end up with a grainy look which the BD version avoids.

While some of this might be down to my eyes, or my kit, I’ve heard similar complaints elsewhere, including from a couple of guys who run a TV/HiFi shop and whose job is to set up high quality demo systems.

Personally I’m probably going to keep 4K for new blockbusters without a 3D version. If a favourite gets an anniversary 4K makeover I may buy the 4K/BD combo, but I could easily end up watching the Blu-Ray.

What About Streaming?

What about it? It’s a great way to get instant access to material you won’t want to view over and over, and where picture quality is not the key requirement: catching up on box sets is a great example. However if you want quality then streaming is currently still inferior to broadcast HD, which is in turn inferior to a disk, even a good DVD (your mileage may vary…). Don’t throw your disks away yet!

Conclusions

For new purchases, buy at least a Blu-Ray version, and consider the 3D or 4K version if there is one. If the old DVD version isn’t great, and there’s a remastered version on Blu-Ray, then it’s worth an upgrade. However if your existing DVD version is a good one, save your money and buy yourself some new films and shows instead.

Posted in Thoughts on the World | Leave a comment

An Odd Omission

Let’s start with a common use case…

"I have a television / hi-fi / home cinema system which has several components from different manufacturers. I would like to control all of them with a single remote control. I would like that remote control to be configurable, so that I can decide which functions are prioritised, and so that I can control multiple devices without having to switch "modes". (For example, the primary channel controls should change the TV channel, but at the same time and without changing modes the volume controls should change the amplifier volume.) As not all of my devices are controllable via Wi-Fi, Infrared is the required primary carrier/protocol. The ideal solution would be a remote control with a configurable touch screen, probably about 6" x 3" which would suit one-handed operation."

I can’t believe I’m the first person to articulate such a use case. In fact I know I’m not, for two reasons. When I set up the first iteration of my home cinema system in about 2004, I read a lot of magazines and they said similar things.

And then I managed to buy a dedicated device which actually did this job remarkably well. It was called a Sunwave Universal Remote, and had a programmable LCD touchscreen. It had the ability to choose which device functions appeared where, and to record commands from existing remotes or define macros (sequences of commands). This provided some, limited, "mixed device" capability, although the primary approach was modal (select the target device, and then use controls for that device). A set of batteries lasted about a year.

There were only two problems. First, as successive TVs became smarter than in 2004 it became an increasing challenge to find appropriate buttons for all the functions from within the fixed option list. Then, after 13 or so years of sterling service the LCD started to die. I still own the control, but it’s now effectively unusable.

My first approach was to try and get a direct replacement. However it’s clear that these devices haven’t been manufactured for years. The few similar items on eBay are either later poor copies, with very limited functionality, or high-end solutions based on old PDAs at ridiculous prices.

But hang on. "a configurable touch screen, probably about 6" x 3"". Didn’t I see such a device quite recently? I think someone was using one to make a phone call, or surf the internet, or check Facebook, or play Angry Birds, or some such. In fact we all use smartphones for much of our technology interaction, so why not this use case?

Achtung! Rabbit hole! Dive! Dive! 🙂

Why not, indeed? Actually I knew it was theoretically possible, because my old Samsung 10" tablet which was about to go on eBay had some software called "Peel Remote" installed as standard, and I’d played with controlling hotel TVs with it. I rescued it from the eBay pile and had an experiment. The first discovery was that while there’s a lot of "universal remote" software on Google Play, most is rubbish, either with very limited functionality, or crippled by stupid amounts of highly-invasive advertising. There are a few honourable exceptions, and after a couple of false starts I settled on AnyMote developed by Color Tiger. This has good "lookup" support to get you started, a nice editing function within the app, and decent ways to backup and share remote definitions between devices. A bit of fiddling got me set up with a screen which controlled our system much better than before, and it got us through all our Christmas watching.

However picking up a 10" tablet and turning it on every time you want to pause a video is a bit clumsy, so back to the idea of using a phone…

And here’s the problem. Most phones have no infrared support. While I haven’t done any sort of scientific analysis, I’d guess that 70-80% (by model) just don’t have what’s known as an "infrared blaster", the element which actually emits the infrared signals. Given that this is very simple technology, not much more than an infrared LED in the phone’s top edge, it’s an odd omission. We build devices stuffed with every sort of wireless and radio interface, but omit this common one used by much of our other technology.

Fortunately it’s not universal, and there are some viable options. A bit of googling suggested that the LG G2 does have an IR blaster, and I tracked down one for about £50 on eBay. It turns up, the software installs…, and it just doesn’t work. That’s when I find the next problem: several of the phone manufacturers who make both TVs and phones (LG and Sony are the most obvious offenders) lock down their IR capabilities, so they are not accessible to third party software. You can use your LG phone to control your LG TV, but that’s it, and f*** all use to me.

Back on Google and eBay. The HTC One M7 and M8 do have IR and do seem to support third-party software. The M8 is a bit bigger, probably better for my use case, and there’s one on eBay in nice condition for a good price. It turns up, the software installs…, and then refuses to run properly. It can’t access the IR blaster. Back on Google and confirm the next problem. Most phones which have been upgraded from Android 5 or earlier to Android 6 have a changed software interface to the infrared which doesn’t work for a lot of third-party software. Thanks a billon, Google. 🙁

OK, last roll of the dice. The HTC One M7 still runs Android 5. I find a nice blue one, a bit more money than the M8 ironically, but still within budget. It turns up, the software installs…, and it works! I have to do a few minor adjustments on the settings copied from my tablet, but otherwise straightforward. I had to install some software to make the phone turn on automatically when it’s picked up, and I may still have to do a bit of fiddling to optimise battery life, but for now it’s looking good…

Third time lucky, but it really didn’t have to be that difficult. For reasons which are impossible to fathom, both Google and most phone manufacturers seem to somewhere between ignoring and actively obstructing this valid and common use case. Ironically, given their usual insularity, things are a bit easier in the Apple world, with good support for third party IR blasters which plug into an iPhone’s headphone socket, but that wouldn’t be a good solution given the rest of my tech portfolio. For now I have a solution, but I’m not impressed.

Posted in Android, Thoughts on the World | Leave a comment

The Decisive Moment

My old mum has recently moved from her house to a smaller retirement flat, and is still in the process of sorting out some of the accumulated lifetime’s possessions. On this visit, I was presented with a large carrier bag of old cameras.

I have to say, I wasn’t expecting miracles. Mum and Dad never spent a vast amount on photographic equipment, usually buying a mid-range "point and click", using it till it stopped working and then buying another.

First out, an ancient Canon Powershot, for 35mm film. It probably works, but I tried explaining to Mum that there’s no longer any real market for such items.

"No-one really wants the bother of getting films developed. You don’t – you have a digital camera yourself now, you were using it last night."

"But surely there are people who love old cameras."

"Yes there are, but they have to be a bit special. If this was a Leica, with a little red dot on it, it would probably be worth some money, but not an ancient cheap Canon."

To settle it, I opened up my laptop and had a look on eBay. There were a couple, for about £15 and about £12, both with no bids.

Next up, a similar Panasonic. This still had a film in it, which was suspicious as it probably meant that the camera had died mid-holiday and been abandoned. eBay suggested an asking price somewhere in the range £8 to £11.99. Getting worse.

"I could offer it to the charity shop" said Mum, hopefully.

"Well you could, but don’t be surprised if they are underwhelmed." I told her about my recent experience of having a perfectly good 32" flatscreen TV rejected by our local charity shop, which didn’t encourage her.

"But surely if things still work?"

"I keep on saying, Mum, things have to be a bit special. You know, a Leica or something, with a nice red dot."

Next out of the bag was a Konica. This was a slightly different shape and had the rather ominous indicator "110" in the model number. That’s definitely not a good sign, I mean can you actually still get and process 110 film? (That’s assuming that you can see any point in shooting a format which is distinctly inferior to 35mm in the first place.) Amazingly enough there is one on eBay. £2.99, no bids…

"OK", says Mum, deciding that there’s no point in arguing that one. "There’s one box left in the bag."

What? Hoist by my own petard! I mean, what were the chances??

Sadly it’s actually only a slide box, and eBay suggests that it’s going to get £20 at best, but I am now honour-bound to do my best to find it a good home.

Be careful what you wish for…

Posted in Photography, Thoughts on the World | Leave a comment

Testing vs Modelling, Detection vs Prediction, Hope vs Knowledge

The Challenge

I often hear a statement which worries me, especially but not exclusively in agile projects, along the lines of “we’ll make sure it works when we test it later”.

Now you may think this is an odd view coming from a man who has written testing courses, presented conference papers on testing and developed testing tools, but let me explain myself.

First up, there’s the old chestnut that the objective of testing is not to prove something works, but to find errors. All you can actually do by testing is locate problems to be fixed, although obviously if problems are hard to find, that increases confidence in your product. However the much deeper issue is that testing is commonly viewed as an alternative to properly understanding and documenting the expected behaviour of a system, and reviewing in advance whether a proposed design will deliver that behaviour. That can be a recipe for failure.

Obviously in some areas this is an acknowledged and viable trade-off. If we are exploring functional alternatives, or working in a problem space where extracting documented requirements is tricky, then agile development and testing is a powerful solution, and we accept the rework that may result where we get it wrong. Having said that, even in something like UI development it may be better to develop cheap models such as wireframes, and at least attempt to explore solution fit before we commit too much to code.

The problem is that when we come to the more fundamental architectural elements and non-functional behaviour, the dynamics change dramatically. The best way to show this is a variant of the testing “V Model”:

For functional details, the gap between development and testing is small, and they can quickly be reworked and retested. However some of the key architectural and non-functional aspects can only be fully tested late in the delivery process (and frequently only late in the overall programme), if at all. The “testing gap” becomes huge, the impact of any change substantial, and the rework path lengthy.

One challenge is that many non-functional tests require an environment representative of the technology and scale of the production system. If this is provided at all, it is typically late in the project, or testing has to be shoe-horned into a short window on the production system before operations commence. If that uncovers a major issue, it is simply too late.

That’s assuming that the issue is detectable. In an agile development, it may be difficult to understand “what acceptable looks like”, if there is no adequate agreed, documented definition of the expected non-functional behaviour.

The other challenge is that good non-functional testing is hard, and limited in what it can achieve. Simulating a peak load is difficult, especially with the variety of data in a real production peak. You can simulate planned and unplanned equipment failures and restarts, but by definition only predictable events. If a problem only emerges from lengthy running or a “perfect storm” event, then testing is unlikely to uncover it. Basically resilience is testable, performance may be testable, reliability isn’t. Similar considerations also apply to other non-functional aspects like security.

The Solution

The solution is to adopt an analytical and predictive approach: trying to understand, articulate and document the expected behaviour of the solution, before you build it. Importantly this is not just thinking about the solution (although thinking is vital), but thinking with models.

Models in this context take many forms. They can be diagrams, possibly based on UML, but not necessarily: for example reliability block diagrams or fault tree analyses are powerful tools to understand resilience and reliability. They can be spreadsheets, for example profiling expected transaction mixes and their relative resource requirements. They can also be active software, whether simulations of some expected behaviour, or point implementations to quantify some aspect of the solution, but the point is that their purpose is to understand the solution before a major technical commitment, not to deliver functionality. Irrespective of form all models should lend themselves to a quantitative understanding of the solution, not just “what?”, but “how much?” and “how well?”.

For example, here’s a simple redundancy scheme modelled using RelQuest, my own Visio-based fault tree analysis tool, from which we can not only understand the various combinations of failures which lead to loss of service, but the relative probability and impact (e.g. Mean Time to Repair) for each combination.

Models and simulations provide you with an early understanding of the system behaviour, so you can understand whether something should work, or not, and if not where to focus your efforts. They can be detailed, like the example fault tree above, or doing an early first pass on a platform provider’s sizing tool, but a more approximate approach may also provide value.

Numbers are your friends. I am a great fan of Fermi estimates (see the sidebar) – quick “order of magnitude” approximations to see if you have understood the key elements in a problem, and whether the answer looks viable or not.

You can easily get viable estimates of this type for performance, capacity or reliability. If the answer is “no problem”, like we can easily accommodate millions of transactions per hour on a single server and we expect thousands, then you’re probably fine. If the answer is the other way round, like the developer who proudly presented me a solution which would take 1s CPU time to do a calculation, but we needed to do a thousand a second, then the design needs to change (I got it down to 2ms, which was acceptable). If it’s marginal, then you probably need to do a more accurate model and calculation, or build a greater degree of flexibility into the solution.

Simulations or low-volume experiments may be a valid way to understand CPU, storage and memory usage, network bandwidth requirements, threading, virtualisation, and even failover behaviour. Anything which scales linearly can be measured at low volume and extrapolated, but you need to be wary of areas such as network latency or storage throughput where that may not be valid.

Ultimately anything which builds your understanding and proves that you have thought about the problems in advance is good, even if some detail may only be confirmed at later stages. The key point is that the problems become targets for analytical thinking rather than hope and prayers, and that makes them solvable.

The Conclusion

Testing on its own is absolutely necessary, but very much not sufficient. For tests to be meaningful you have to describe the predicted behaviour in advance, and for the system to have any chance of passing those tests it has to be engineered accordingly. We increasingly seek to drive functional development from written user stories and behaviour specifications. In the same way professional development must be driven by quantitative models which forecast non-functional behaviour for testing to confirm, not discover in surprise.

 

I love Fermi estimates, named for the great Italian-American physicist Enrico Fermi, who was always doing them. These are calculations which you know have a lot of inaccuracies, but which are simple enough to do quickly and get an answer which is “sort of right” to tell you if you have correctly understood the dimensions of the problem, and if something should work, or not.

Let’s do one. This is not about computing, but is an easy example to understand the process. How much does my house weigh?

Well my house is built mainly of brick, and for the purposes of this calculation can be thought of as a rectangular block roughly 8m x 12m, and about 3m high. (I happened to have these figures, but I could always just pace it out and use 1 pace = 1m). Allow for internal walls, and you could think of my house as four slabs of brick 8m long x 3m high, and four slabs 12m long x 3m. Alternatively that’s 4 slabs 20m long, or one slab 80m long. But remember that all the walls are at least two bricks thick, so it’s like one stack of single brick 160m long and 3m high. Now I know this doesn’t take any account of windows and doors, and the open plan bit at the front, but it’s also ignoring the roof and floor slabs, and I think that will balance out quite well. Google “house brick dimensions” gives us 215mm long and 65mm high, and a typical weight of 3.5kg. Divide 160m by 0.2m (this is a Fermi approximation remember) to get 800 bricks long. At 65mm high 3 bricks on top of each other will also be about 0.2m high, so the height of our stack will be 3x3m/0.2m = 45 bricks high, call it 50. That gives us a grand total of 50×800=40,000 bricks. Now 40,000×3.5kg = 140,000kg, or 140 tons. Fermi approximations are good for at best one significant figure, so round it off to 100 tons. Bingo!

So a simple model can get you a useful answer quickly, and you may even be able to do the maths in your head. Now obviously there are a lot of guesses and approximations here, like the density of all key materials is similar, and I haven’t so far accounted for the foundations, which might be needed, and I might want to double-check the typical weight of a brick which is a key value, but I’d be surprised if the “real” answer wasn’t somewhere between 50 and 300 tons.

You can easily do the same thing to get viable “order of magnitude” figures for performance, capacity or reliability.

Posted in Agile & Architecture | Leave a comment

Does Agile Miss The Point About Engineering?

A bicycle-car

A former colleague, Neil Schiller, recently wrote an excellent article, https://www.linkedin.com/pulse/agile-data-programmes-neil-schiller/, on the challenge of using agile approaches in data-centric programmes. In it, he referenced and reviewed a classic cartoon by Henrik Kniberg which is often used to promote the advantages of agile delivery:

Now it’s wholly possible that I am reading more into a limited analogy than appropriate, but I think this same diagram can also be used to explain some of the fundamental issues with agile approaches.

Think about what the bottom line is claiming: that by a set of small incremental deliveries we can somehow achieve the equivalent of transforming a scooter into a bicycle, into a motorbike and then into a car, each a fully working vehicle meeting the user’s requirements. In the real physical world this is laughable: each has a wholly different architecture with no commonality whatsoever between equivalent subsystems at any of the stages. Key properties arise from the fundamental structure – a simple tubular chassis for bike, a more complex frame including complex stressed moving parts like the engine and transmission for the motorbike, typically a monocoque chassis/exoskeleton for the car. These underlying elements form the basis, and you have to get them right as you can’t modify them later: you can’t “add strength” to a car by adding more tubes after the event (unless you are going banger racing!).

In the real physical world you create a complex engineered artefact by understanding its required properties, creating a layered structure which is designed to meet them, and then building up those layers to progressively deliver the required result. This requires that the most fundamental, least readily changed layers have to be right, and stable, early on, and only then can you add the upper more flexible elements. The first version of the process in the diagram is actually wholly correct, the second a joke.

Is it so very different for software? If we’re talking about major systems with real-world complexity and non-functional demands, I’m not convinced. The “ultra-agile” argument that it is always possible to “refactor” code to make changes. This is true up to a point, but it can be difficult and costly to change the underlying structure. If that does not meet requirements for security, or reliability, or performance, then no amount of fiddling will fix it, and if changes amount to a fundamental rewrite then it’s difficult to see where any advantage has been gained.

Obviously there are differences. The vehicle designer seeks to both create and use solutions which once right will be re-used many times (from hundreds to millions of instances), but will be difficult to change once in production. Software development is still largely about one-offs. Software requirements are typically less well-defined than for established hardware products. In vehicle manufacture, the roles of engineer/designer and constructor are distinct, whereas in software the designers often have an ongoing role in construction, and may at least subconsciously seek to extend that role (guilty as charged 🙂 ). On the other hand, the car designer knows that an approved design will be built largely as documented, whereas the software designer has no such assurance.

Fundamentally, however, I believe that software development can benefit from engineering disciplines just as much as the design of physical products. For example, it is much better to attempt to understand and predict up front how a given design will respond against non-functional requirements. Testing is a very good way to confirm that your solution basically works and to refine refinements. It is a very bad way to uncover fundamental deficiencies, especially if this occurs late in the development process.

This doesn’t mean that I don’t believe in agile development. Far from it, I am a great believer in iterative and incremental development, and structures such as Scrum sprints to manage them. However, I really don’t believe in architecture “emerging from the code”, just the same as I would not expect to see a great car design “emerge” from the work of a group of independent fabricators working on small parts of the problem without any overarching design. Cars “designed” in such a way tend to be more Austin Allegro (or AMC Pacer) than Bugatti Veyron.

Instead, Architecture has to be understood as providing the structure within which the code is developed, with that overall structure developed using engineering disciplines: assess the various forces on the design, articulate how these forces will be resolved (including what compromises are required), then document and model the solution to predict its properties.

If the requirement is for a sports car, design a sports car, don’t try and “refactor” a pushbike…

Creation of such designs, documents and models is a distinct discipline from coding. Some of this may be the domain of specialists, some may be performed by those who also have other development roles, but as a separate activity requiring appropriate skills and experience. Ironically I think Tom Gilb got it about right in his 1988 book “Principles of Software Engineering Management”, when he defined “Software Engineer” as someone who “can translate cost and quality requirements into a set of solutions to reach the planned levels”, and who has the skill to change any given quality dimension of a system by a factor of ten if required. The latter challenge would uncover a lot of people who call themselves “architects”.

In addition complex designs need some form of centralised, overall ownership and design control – this again requires specialist skills and cannot just be allocated randomly, but will sit with an Architect and/or a Product Owner.

Within such a framework concepts such as continuous integration and testing still make sense. Development, both functional and non-functional can still be managed via the backlog and sprint plans, epics and stories. However the “minimum viable product” may require completion of much of the underlying architecture as well as major functional capabilities. Major capabilities, both functional and non-functional, have to be analysed and designed up front, not left to stories somewhere in the backlog. The intermediate delivery is a car, albeit incomplete, not a complete bicycle.

Agile development and architecture are not incompatible, but complementary. Successful development of a complex real-world system will inevitably follow the first model in Kniberg’s cartoon, no matter how much the agilists would like it to be the second. At scale, and in the face of more challenging requirements software development needs to be treated as an engineering discipline, with agile structures in service of that discipline, not avoiding it.

View featured image in Album
Posted in Agile & Architecture | Leave a comment