Arnolyzer: adding clean-code static analysis to C# in VS2015

arnolyzer-logoArnolyzer is a Roslyn-based analyzer for Visual Studio 2015 that provides a set of compiler rules that encourage modern, functional-orientated, coding standards in C# 6. Pure functions; no inheritance; no global state; immutable data classes and variables; and short, concise sections of code.
Continue reading “Arnolyzer: adding clean-code static analysis to C# in VS2015”

The slow death of agile

skullRecently, I heard of a job interview in which the applicant claimed on their CV that they worked for a “strict agile” company. At the time, I thought of this as a good thing. However, reflecting upon it, it strikes me as yet another example of a worrying trend around agile practices, namely treating only specific ways of working as being agile. “Strict agile” is really an oxymoron: it’s another sign that we are witnessing the death of agile through “processification”, or the setting in stone as to what “agile” can be. Continue reading “The slow death of agile”

Is Flash open or not? Please Adobe, make up your minds!

Open @ AdobeI have recently been working on a reflection and mocking framework for ActionScript 3 (AS3) libraries (SWCs). It works by loading the SWC into memory and decoding the SWF contents. It then generates an XML representation of the contents for reflection and new – mocked – versions of the classes for mocking purposes. Whilst the as3commons project has been invaluable in making this easier than it could have been, so has Adobe’s open specification of the ActionScript Virtual Machine (AVM2). Continue reading “Is Flash open or not? Please Adobe, make up your minds!”

Why the “private” keyword is the modern day “goto”

evil-privateMost developers these days will tell you that one aspect of object-orientated (OO) best practice is to make member variables private. I contest that they are wrong and that not only is it bad practice, it can force others to have to implement nasty hacks to get around the use of the private keyword. Continue reading “Why the “private” keyword is the modern day “goto””

FOTB 2009 Day 2

FLash on the Beach 09Elevator Pitch
The first session of the day was a new – and it turns out, highly successful – experiment. We had 20 speakers, each given just three minutes for their talk. As one person spoke, so the next person’s laptop was plugged in to the projector switch box in readiness, so there was almost no delay between talks.

The topics covered included rotoscoping using flash, games creation, SQLite, generative art, applications for phones and RestfulX. Most were really good. Of special note was a hilarious presentation by Conrad Winchester on the topic of ASAXB, which appears to be a great framework for automatic serialization/ deserialization of AS3 objects to XML and vice versa.

Flash Catalyst in Action
Mike Anders gave us another tour of Flash Catalyst. It was similar to last year’s talk, but used the Flash Catalyst beta, rather than the Thermo pre-release he had last year. As ever, his talk was good. He demonstrated creating a aquarium information application, which included layered graphics, embedded video, test fading in and out etc. What was really great about it was the fact that absolutely no nasty, evil .fla’s were involved, the whole thing (excluding the graphic and video resources of course) was 100% editable FXG/ MXML. The spark component set, along with FXG, is really shaping up to be an excellent development toolset.

Leaving The Sandbox
I had been looking forward to Joa Ebert’s session. As a hard-core nerdy developer, my main criticism of FOTB is that it contains too many “arty farty” designer and/ or inspirational sessions and the developer sessions tend to be a bit on the basic side. A session on a code validation tools sounded just the sort of thing I’d been wanting. Boy were we in for a treat.

It started well with a quick run through compiler theory (as someone who’s developed compilers using lex and yacc in my distant past, this was just my sort of thing). Then he moved straight on to AS3V, by announcing he’d abandoned the project. Turns out that Adobe have been working on a similar code validator called FlexPMD.

At this point I was concerned I’d wondered into yet another “use ++i rather than i++ to shave milliseconds off your execution times” type optimisation talk. How wrong I was, for we were in for a roller-coaster ride of SWF compiler/ decompiler projects:

  • Apparat.  This is Joa’s basic SWF/ SWC optimization framework, from which he has built a rich set of tools.
  • Dump. This tool can be used to generate such things as UML and inheritance diagrams of the classes in a SWF/ SWC.
  • Reducer – This tool squashes the data for PNGs inside SWFs/SWCs to make them significantly smaller. It does this by converting the PNGs to JPEGs. By adjusting the JPEG compression level one can vary the amount by which the resultant SWF/ SWC in reduced in size.
  • TAAS – this is an automatic optimizer tool that let’s the developer write clean, easy to read, code and then inlines functions, converts power of two multiplications/ divisions into bitshifts, changes i++’s into ++i’s etc.

Having left the audience stunned, Joa then showed Steve Jobs how to do a real “one more thing moment” (we even had a Steve Jobs parody slide) by demonstrating two projects he’s working on that compile C# and Java code to SWFs. He even coped with the fact that – being a dinosaur language who’s spec is controlled by dullards – Java cannot cope with closures and neatly mapped Flex’s closure-based event handlers to Java’s class-based bodge-event handlers.

Joa earned himself a well-deserved standing ovation.

Application Frameworks: The good, the bad, and the ugly
After lunch, we attempted to get into Richard Lord’s session on frameworks. Sadly due to the session times being skewed all morning, lunch had been shortened (and we hadn’t been told), so the hall was full when we arrived. Hopefully it was therefore a really rubbish session 🙂

More than Bending Pixels
Paul Burnett’s session on pixel bender was pretty good. Pixel bender is a programatically-simple language, but clever maths-orientated people can use it to do some really stunning effects with graphics and audio. Of more interest to me though is the fact that it can manipulate any data and runs on a separate thread to the main flash player. So it has potential to be of use in encryption and geo-spatial calculations for example, without affecting the player performance.

Unconventional Web Applications
The day wrapped up with a very nice presentation on design conventions by an Irish company, Contrast. They explored why we have conventions, why it’s sometimes bad to break them and sometimes it’s essential to do so. It contained some really good advice. Take a look at their website to get an idea of their conventions-breaking design approach.

And so the day ended for me at least. It was a brilliant day, in fact I’d even go so far as to say it was the best FOTB day I’ve ever attended (this is my third year, so 2006 may have had a better one that I missed). Can’t wait for tomorrow…

Stack Overflow isn’t just a software Q & A site

Back in the days when Commodore were able to advertise 64K of memory as being synonymous with the large memory of an elephant, stack overflow errors were common. With limited memory, only a small amount could be spared for the stack, and a series of function calls could easily fill it up.

These days, when computers have 5-6 orders of magnitude more memory, the concept of a stack overflow has been relegated to an in-joke name for an excellent developer Q & A site. I was therefore more than a little surprised when a Flex app produced the following stack trace:

Scrolling down through the stack trace, everything that came after what I’ve copied above was just many references to the one method. I’d written a recursive method who’s test for the end of the recurse would always fail, so it had gone into an “infinite loop”. It just goes to show, no matter how much memory you have, a run-away recursive method will always run out of stack space. Stack overflow errors still exist, they are simply hidden away from all but sloopy recursion junkies… 🙂

Why I won’t be upgrading to IE8

no-to-ieI am what is commonly termed an “early adopter”. I readily install beta versions of software of my machine and tend to pro-actively track new versions of the software I use, and obtain and install them as quickly as possible. Most of the time I’m happy with this, but very occasionally, my “new feature greed” comes back to bite me. IE8 is one such case.

When IE8 beta came out, I installed it, had a play around with it and then pretty much lost interest, as my main browser is Firefox. I uninstalled it as part of experimenting with removing it from Vista (its an update, so it’s not immediately apparent how to remove it) and forgot all about it. When RC1 came along recently, my interest was piqued once more and I installed that, but all was not well.

These days I’m an Eclipse user, who spends a fair bit of his time writing and debugging Flex. Flex Builder in Eclipse can be configured to use one’s preferred browser. However it is highly unreliable with Firefox, so IE has finally found a use on my machine: it is the browser that runs the debug-enabled flash player that I test my Flex code against. Whereas Firefox often fails to start, or properly end,  a debug session, IE7 just works. However IE8 was a wholly different experience.

After stopping and starting debug sessions a few times, I first noticed that my machine was slowing up, then the code that handles cookies started behaving oddly and would report that other instances of the application were already running, despite no other occurrences of IE appearing in the taskbar. A peek at the Task Manager revealed the problem: there were around 15 non-terminated IE processes running on my machine. Investigating further, I realised this was a consequence of Microsoft copying Chrome’s 1 tab = 1 process model. Even with tabbed browsing disabled, IE8 starts two processes: one for the window “frame”, and the other for the tab’s renderer. When the Flex debugger quits, it kills the frame process, but leaves the renderer process – with its instance of Flash player – still running.

This neatly highlights what I dislike about Chrome’s process model and why I’m saddened by the lind rush by other browser makers to jump on the many process browser model. I like my apps to adopt the one process/ many threads model, for I want the whole application to get its backside off my system when I kill it and multiple processes are near-guaranteed to spoil that simple desire.

Perhaps this is just an RC1 bug and IE8 will die gracefully when its fully released. However, I rarely use IE, IE7 meets my needs, and so I’m likely to follow my own instructions and block the upgrade to IE8. I do so with a heavy heart, for I fear I’m taking the first step down the road to becoming like those weird luddites who still use VS6 over 10 years after it was replaced with a newer version, or those even weirder folk who can’t cope with leaving the antiquated Windows 95-2000 look behind and run XP or Vista with that last-millennium look. I think I’ve made the right decision on this occasion though…

Warning: deactivate “lighter menus” plugin before upgrading to WordPress 2.7

I have just upgraded to WordPress 2.7 and had a bit of a shock when I visited the admin area of my blog. The old drop-down menus supplied by the Lighter Menus plugin had gone, but the new funky menu down the left hand side didn’t appear. So I had no way of navigating around the admin area.

Luckily the solution was straight forward. I simply visited the URL wp-admin/plugins.php and disabled the lighter menus plugin and the 2.7 menus sprung into life.

I’m really glad therefore that WordPress uses nice simple URLs to navigate around the admin area, rather than fancy cookie-based navigation that some systems use. Anyway, if you use WordPress and are considering upgrading to 2.7, make sure you turn off the lighter menus plugin (assuming you have it installed) before upgrading and you’ll save yourself a bit of hassle.

ReMix 2008 Day 1

Last year, at Mix UK, the keynote was a truly dull affair, focusing on telling us about things that had been public knowledge for weeks, if not months. Scott Guthery’s part of this year’s keynote was unfortunately more of the same. It was all about .NET related technologies that were released weeks ago, with some vague “coming soon”, “next few weeks” etc comments regarding the release of Silverlight 2. Interestingly though, Scott did later on in the day imply – and its completely my fault if this is wrong – that a release candidate is due out this month, with the release to follow in October.

Bill Buxton’s half of the Key Note was a real breath of fresh air. Whilst I’m not completely convinced by the case he put forward, he came across as a man who was passionate about things because they were great, not because they were the latest Microsoft thing. When the head of R&D at Microsoft tells you that he loves the iPod, Google and the Wii, you really do need to sit up and listen. He basically argued that to survive, companies these days need to heavily invest in design and that they need to design for the experience, not just design the product.

With my sceptic’s hat on, I have to say that Bill’s speech did at times sound a bit like design is this year’s innovation. In recent years, companies have jumped on the innovation bandwagon, creating Innovation Manager posts, claiming they are innovative companies etc. This year, it seems that suddenly we all now need directors of design/ chief design officers.

With my sceptic’s hat removed, I have to confess that I bought a copy of Bill’s book, Sketching User Experiences, and fully plan to shove it under the noses of Enigma’s management when I’ve read it.

UPDATE: it turns out that even with my sceptics hat on, my views on Bill were good compared with others. Take a read of this very well written counterpoint to my take on the keynote. Thanks to Jon Paul Davies for linking to this article and so drawing my attention to his piece.

Of today’s sessions, the one that really stood out was on Virtual Earth. As the latest version has been delayed, those of us that attended the session had to sign a non-disclosure agreement regarding what we were shown. I obviously can’t say what was in it therefore, but I will say that the release – when it comes – contains some really nice new features.

One “what a small world” occurence for me today was discovering that a good friend and close neighbour, Matt Tompsett, was working at ReMix doing the radio trunking (which basically means he programmed up some weird looking hardware that controls fancy multi-channel walk talkies). Also, I need to give a shout out to Adeniyi Ibironke. He occasionally reads my blog and sought me out to introduce himself. Whilst many of the folk that read this blog and current and former colleagues, there are a few strangers that read it too. It was therefore really great to meet one of those strangers in “real life” therefore.

The highlight of the day for me though was definitely the Ready Steady Talk event. I as expecting to talk to a fe dozen people in a small room. Instead I as on stage in the main hall at lunchtime, with hundreds of people around, doing my five minute talk. I messed up bits of it, but did well enough to get through to the final tomorrow.