Thursday, January 05, 2017

SOLID Principles for Dummies

As a OO programmer one of the things you're meant to practise is good OO design, and the SOLID principles embody that.

If you've read the SOLID wikipedia article it's a little long winded, so here's the SOLID principles simplified and written as negative reinforcement to help curb bad practices!

S - Single Responsibility Principle

Don't have classes do many things - a class should have a single purpose, I would go so far as to say a method should also have a single purpose. For example a DatabaseService class only interacts with a database, a save method only persists a value (as opposed to a method such as validateValueAndSave)

O - Open Closed Principle

Don't write decision logic based on sub class or sub class properties in the parent class - i.e. have sub classes make the sub type specific decisions.

L - Liskov SubstitutionPprinciple

Don't return an incompatible type in sub classes (or anything that suggests the sub class cannot support the operation as exactly defined by the parent class). For example in a Java method don't throw not supported exceptions in sub classes, in other languages, don't return types incompatible with the base type return value. By doing this it ensures any method (or iterator etc.) that takes a subclass argument and has no specific subclass feature usage, is able to have its argument substituted for the parent class without modification.

I - Interface Segregation Principle

Don't lump all functionality into one interface and thus have implementing classes provide functionality they can't support, instead create fine grained interfaces.

D - Dependency Inversion Principle

Don't use concrete types if there's an interface available for dependencies (in general coding to an interface is best practice anywhere). For example use List myDataList = createList(), not ArrayList myDataList = createList(), where List is an interface on ArrayList. This allows easy substitution of the dependency implementation later to another list type without breaking the code receiving the dependency. In short, a high level class should not depend on a low level class.

Saturday, December 24, 2016

Image To ZX Spec 2.0.0 Released!

Santa comes early with an Image To ZX Spec 2.0.0 release!

This will be the last major revision of Image To ZX Spec as I'm moving on to other projects. The two major features of this release are high speed native video decoding (requiring separate platform builds) and some critical bug fixes for MacOS, the full changelog is below.


MacOS: (sha1: d76b6507f8f8a16e2e03b58d7b8c7ffb)
Windows: (sha1: b3269054d40fc1a09ae92aebcc4c31a6)
Linux: (sha1: bd8e3a1a569d630f9aa7701a42eaae7a)

Changelog for 2.0.0:
  • Updated for Java 8.
  • Squashed MacOS directory bug causing files not to be saved (Java bug).
  • Integrated native video decoding via HumbleVideo.
  • Massive performance improvement for processing video.
  • Improved code quality with tests, logging and Java 8 features.
  • Fixed Gigascreen original scale conversion crash bug.
  • Fixed original scale conversion converted edge pixels bug.
  • Fixed black threshold scaling range.
  • Added warnings for poor options combinations.
  • Changed text output behaviour for multiple images - many files now instead of one.
  • Modified About to show free memory.
  • Fixed small graphics memory leak.
  • Added turbo mode.

Thursday, December 15, 2016

Re-igniting the blog

Over the last few years my professional and home life has meant this blog dropped off to a mere trickle, as did the audience.

Today this changes - the site has a new design, the downloads, most of which are out of date have gone and the site will be getting back to it's roots of random new tech product rants, tech hacks and custom free software and code.

Image to ZX Spec, an old app, will be getting it's final 2.0.0 build soon before being released to an open source platform (hosting all my open source here is so passé) and I'm happy to say it will be off my hands so I can start on newer more exciting projects which I'm looking forward to sharing here.

Aerofoil will also remain available simply because it is still popular.

If you would like any of the older software; FollowMe, FreeKicker, Gesture Magic, Optimizer or anything else, leave me a message below, alternatively they may still be on the mirror or can be got via wayback machine.