Safe guarding your code investment

There have been a couple of questions that a few developers asked me over email, apart from one about the *sudden changes* and If I knew about it. The other burning question that many have asked and including myself have asked is what happens if... Because it does happen.

Let me rewind to the early 90's, Microsoft has established itself from DOS onto a new GUI based OS called Windows 3.1, Charles Petzolt was the king who's book was the bible for developing for windows and using the Windows API. Microsoft had also started a new program called MSDN namely Microsoft Developers Network and it came of a couple of CD's that had utilities, tools, code samples, and documentation. I recollect having purchased 5 huge volumes of the Windows 3.1 API and went through them to understand how the windows OS worked, how a message was passed and received, how events were handled, etc.

At this time, generally enterprises used applications build on dBase and Clipper as they were much easier to use. dBase was losing ground with FoxPro which was Microsoft's offering into the database contenders. With the GUI environment catching on and Windows 95 launched, FoxPro just beat dBase and Clipper out of the waters. It was clearly a Microsoft win.

However, there were a couple of other developer tools that were there Visual Basic 3.0, Delphi 1.0 and Visual C++ 1.0 apart from Visual FoxPro. I still recollect I was in a meeting with the Management deciding what should we use, Delphi for the sheer native power like C and the ease of use of a GUI Builder or upgrade our existing software from FoxPro to Visual Foxpro (which was open and the service techs would access the database directly rather than use it from the front end, that's why I was there, to create a front end GUI) I was strongly in favour of Delphi, as I had just fallen in love with it, it was just an amazing platform, but it was Borland. One of the Directors/Share Holders worked for a largish organisation in the US in the field of IT, so it was ultimately his decision that would make all the difference. His point of view was that Microsoft is a large organisation and any product that it has will be more stable or long term than a company like Borland. I might have differed in my opinion then and even now on this, but long story short, he is now working for Microsoft.

So, we decided to go ahead with Visual Basic, and by then VB4 was released and our internal software was running on VB4 and VB5. There was a lot of hassle with the 16-bit and 32-bit compilation and binaries, but it seems like a thing of the past, only to find that now we have the 32-bit and 64-bit issue and no VB. VB6 was perhaps the most promising and popular software ever created by Microsoft, that was the framework to create apps on in the mid to late 90's.

Then in 2003/2004 Microsoft released the dotNet Framework, this was marketed as the silver bullet that would allow for amazing compatibility between the Hardware, System and the software, so one could simply say System.Network.IPAddress to get the IP Address of the system, no more allocating memory, and calling a couple of API's just to get the IP Address. This was great, but what happened following that wasn't. dotNet meant that VB6 had to go, it did not fit in the schema of things and Microsoft replaced it with Visual Basic.net and for those that have been working with Basic (right from the ZX Spectrum - Sinclair Basic to VB6) that VisualBasic.net is NOT Basic, it is a form of C# with a Basic like syntax.

The point, in case you missed it, a Microsoft tool and a tool that was used by millions could not just be taken away. Well in reality it was taken away, there were on-line petitions, a lot of protests, etc... but who cares about a few million developers? A company's gotta do what a company's gotta do. So can it happen with just about any tool or organisation? Well, you should be able to answer this yourself. If you need a few more case studies, the ZX Spectrums and the Commodore C=64s were hot, they were like the iPods of the times, every kid wanted one of them, there were the Android versions too, that came in the form of Amstrad, Tandy TRS-80, BBC Micro etc. With the Spectrums, Sir Clive Sinclair made a fortune, companies that made games made a fortune and the games sucked, some of them really did and they still sold for about £9.99 to £19.99 on cassette tapes. The hardware companies disappeared and so did the software ones. There was Ocean, Imagine, US Gold, SilverBird, Micropose, Psion Software to name a few that made it big but then disappeared as quickly as they formed.

So, the point of all this, is that no matter the size of the company, it can fold or change products overnight. So the advice is irrespective of the size and budgetary power of a company, look at safe guarding yourself right from the start, because the organisations might not have an issue folding or changing circumstances, but it will be a bit harsh for you.

I must share that around October 2011, when my subscription for one of the frameworks that I work with was due for renewal, it just stopped working on me, I could not do anything. OK, I need to renew my subscription, at least drop me back to the trial version, NO, nothing of that sort. It was then when I felt that it was time not to place all my eggs in this beer basket. Today I got an email stating that my subscription has expired. Where as a couple of weeks ago, despite it being valid till October was discontinued by the organisation. So, what if you were in a situation similar to that? What are your options?

1. I was evaluating other frameworks that could offer similar features, if you have been reading my blog, you have heard about the other options. Some fanboys were offended that anything other than Beer exists, (that story for another blog)
2. Admitted that not all frameworks can do everything on the face of it, after all every framework develops as more and more people use it. These grow organically, but then some frameworks just stop growing and offer no more stuff, which leads developers to start looking for other options.
3. Always build a library for your app or common use. This is most important as this will help you abstract the framework away from your code, and what you work with is your library that can sit on the framework/s. Think of the MVC paradigm, where you have a Model, a View and a controller. The model is the code that you write, the View is the library that you have created which works with the code and the Controller is what can be changed to work with a different framework if required. If you have been an Enterprise developer, think of ODBC, you can use any database engine, what you focus on is the query and data, not the database engine.

Now, is that easy, no it is not, there are a lot of differences between the functionality offered between different frameworks and the level of access that you get, even if all that we look at are Lua based frameworks, they can range from low level API to High Level API. Secondly, not all frameworks offer a structured, class orientated method to work with.

Lastly, the thing to look out for is when the framework organisation starts to compete with you for customers. One of the reasons that Apple employees are not involved in making apps is that they do not want a conflict of interest, those that think that they have a wonderful idea on hand, quit and start their own company. Microsoft recruits or rather builds relationships with their Partners at different levels. Imagine if Apple and Microsoft started to vie for that small pie that you were looking at with their Enterprise option, where would you go? What could you do? When Windows XP was released, there were a whole new set of controls that were used by Microsoft, but these were not offered for use, like the Ribbon interface was not offered as part of the system. This let their partners and other developers release activeX and MFC controls/libraries to use these features. You can imagine how things would be if you were charged for software, then not offered half the things that you want and had the same on offer to the clients that were willing to pay top bucks and be able to integrate the functionality that they kept from you for these clients. Why in the sane world would these clients ever want to approach you for anything? You cannot offer them anything, would you do it Pro-Bono? NO and would you be able to offer them the functionality that they need? NO Can they get that functionality? YES
If you are intelligent you know where this is headed, you need to buy a good lock to shut down your shop. So, when the tool maker competes with you in your marketplace than assisting you, things will never be good, as they say in the desert, a storm is brewing or in politically unstable situations, a revolution is coming.

So how do you safe guard your code investment? A summary of the points
1. Do not use the base framework
2. Write your own abstraction layer
3. Build/buy tools that allow you to move sideways
4. Always have a good fall back plan
5. Read Who moved my cheese, to realise that do not hang up your shoes and be complacent, always be on the look out for more cheese.
6. If you spot the organisation competing with you, there can only be two situations
a. Financial pressures
b. They do not value/respect you as a partner, you are a sucker that purchased a license.

To give you an example, this is not a guide of how it should be done, but a sample of one way that could be employed.
local a = require ("enzyme")

a.newBoard(16)
local board = a.getBoard()

local i,j
for j=0, board.visRows do
        for i=0,board.visCols do
                a.newSquare(i,j,{color={255,255,255}})
        end
end

a.board.on_TouchBegan=function(event) 
        local t = a.getSquareProperty(event.row, event.col, "bit")
        a.setSquareProperty(event.row,event.col, "bit", not t)
        if t == true then
                a.changeSquareColor(event.row,event.col,{255,255,255})
        else
                a.changeSquareColor(event.row,event.col,{0,0,0})
        end
end

a.drawBoardGrid()

Note that this is lua code and is not based on any of the lua based frameworks, be it CoronaSDK, Moai, Gideros, Codea, LÖVE or others. The first line require loads the library that talks to the underlying framework and to adapt this for any of the frameworks, it just needs changes to the library as referred to in require.

The code shown above is powerful enough to make a pixel editor and here is a video of that code compiled and running in a simulator.


Had we decided to choose Delphi at the time and not VB, things for Microsoft wouldn't have changed. Would it have made a difference for us? Delphi still exists and supports dotNet, infact there are Kylix and Lazarus, the *nix and OSX ports of Delphi. As for the organisation, would it have made a difference if we had gone Delphi? (I have seen the Systems change in one organisation from System36 based DLC terminals to Windows 3.1 5350 emulation, then to Windows 95/98 based 5350 terminals, with Windows ME (worked best with Arabic) AS/400 based 5350 emulation on windows 2000 and Windows XP in just a matter of 5 years). When I left this organisation, they could not get a person to manage the same, the team that worked for me quit and disbanded. In fact of the small team of 6, 4/5 of them are in US and pursuing their IT careers for over a decade now. For a very strange turn of events, they went open source with *nix, in one way it was also to do with one principal dealer using *nix for terminal emulation and having their enterprise systems working on Unix. So it would not have mattered to them what we would have used, however it was good for the young team that worked for me, they learned VB and a lot about DMS which helped them be in the careers that they are in today.

Things will change it is upto you as the developer or the individual to keep up, when you are in the water, you will drown unless you learn to move your hands and feet and keep yourself afloat and then start to move finding a shore or land. The onus is on you and the methodology too.

Comments

Popular Posts