Archive

Archive for the ‘Quartex Pascal’ Category

Smart Pascal + WebOS = true

April 15, 2017 Leave a comment

LG-WebOSIf you own a television (and who doesn’t) chances are you own an LG model. The LG brand has been on the market since before recorded history (or so it feels) and have been a major player for decades.

What is little known though, is that LG also owns and finance a unique operating system. This is not uncommon these days, most NAS and cloud vendors have their own system (there are roughly 20 cloud based systems on the market that I know of). The only way to make a Smart TV (sigh) is to add a computer to it. And if you buy a television today chances are it contains a small embedded board running some custom-made operating system designed to do just that.

Every vendor has their own system, and those that don’t usually end up forking Android and adapt that to their needs.

Luna WebOS

LG’s system is called WebOS. This may sound like yet another html eye candy front end, but hear me out because this OS is not what it seems.

VirtualBox_Developers LuneOS emulator appliance 20151006131924-stable-038-253_15_04_2017_16_01_43

Except for some font issues (see disk label) Smart loaded fine under WebOS

Remember Palm OS? If you are between 35 and 45 you should remember that before Apple utterly demolished the mobile-phone market with their iPhone, one of the most popular brands was Palm. Their core product being “Palm Pilot”, a kind of digital filo-fax (personal organizer) and mobile phone rolled into one.

WebOS is based on what used to be called Palm-OS, but it has been completely revamped, given a sexy new user interface (looks a lot like android to be honest!) and brought into the present age. And best of all: its 100% free! It runs on a plethora of systems, from x86 to Raspberry PI to Mips. It is used in televisions, terminals and set-top-boxes around the world – and is quite popular amongst engineers.

Check it out their new portal here; there is also plenty of links to pre-built images if you look around there: https://pivotce.com/

JavaScript application stack

One of the coolest features in my view, is that their applications are primarily made by JavaScript. The OS itself is native of course, but they have discovered that JavaScript and HTML5 is an excellent way to build applications. Applications that is easy to control, sandboxed and safe yet incredibly powerful and capable.

VirtualBox_Developers LuneOS emulator appliance 20151006131924-stable-038-253_15_04_2017_16_00_46

Smart Desktop booting Quake 3 in Luna OS

Well, today I sent them an Email requesting their SDK. I know they use Enyo.js as their primary and suggested framework – but that is no problem for Smart Mobile Studio. A better question is: can Luna handle our codebase?

When I loaded up Quake 3 in pure Asm.JS the TV crashed with a spectacular access violation. So they are probably not used to the level of hardcore coding Smart developers represent. But yeah, Quake III is about as advanced as it gets – and it pushes any browser to the outer limits of what is possible.

Once I get the SDK, docs and a few examples – I will begin adding support for it as quickly as possible. Which means you get a new project type especially for the platform + API units (typically stored under $RTL\Apis folder).

Why is this cool?

Because with support for Luna / WebOS, you as a Delphi or Smart developer can offer your services to companies that use WebOS or Luna (the open source version) in their devices. The list of companies is substantial – and they are well established companies. And as you have no doubt noticed, hardware engineers doesn’t always make the best software engineers. So this opens up plenty of opportunities for a good object pascal / Smart developer.

17948597_10154372538120906_1912877833_o

Luna has an Android like quality over it – except its more smooth to use

Remember – other developers will use vanilla JavaScript. You have the onslaught of the VJL and the might of our libraries at your disposal. You can produce in days what others use weeks on achieving.

These are exciting days! I’ll keep you posted on our progress!

Smart Pascal, the next generation

April 15, 2017 1 comment

I want to take the time to talk a bit about the future, because like all production companies we are all working towards lesser and greater goals. If you don’t have a goal then you are in trouble; Thankfully our goals have been very clear from the beginning. Although I must admit that our way there has been.. “colorful” at times.

When we started back in 2010 we didn’t really know what would become of our plans. We only knew that this was important; there was a sense of urgency and “we have to build this” in the air; I think everyone involved felt that this was the case, without any rational explanation as to why. Like all products of passion it can consume you in a way – and you work day and night on turning an idea into something real. From the intangible to the tangible.

transitions_callback

It seems like yesterday, but it was 5 years ago!

By the end of 2011 / early 2012, Eric and myself had pretty much proven that this could be done. At the time there were more than enough nay-sayers and I think both of us got flamed quite often for daring to think different. People would scoff at me and say I was insane to even contemplate that object pascal could ever be implemented for something as insignificant and mediocre as JavaScript. This was my first meeting with a sub-culture of the Delphi and C++ community, a constellation I have gone head-to-head with on many occasions. But they have never managed to shake my resolve as much as inch.

 

 

When we released version 1.0 in 2012 some ideas about what could be possible started to form. Jørn defined plans for a system we later dubbed “Smart net”. In essence it would be something you logged onto from the IDE – allowing you to store your projects in the cloud, compile in the cloud (connected with Adobe build services) and essentially move parts of your eco-system to the cloud. Keep in mind this was when people still associated cloud with “storage”; they had not yet seen things like Uber or Netflix or played Quake 3 at 160 frames per second, courtesy of asm.js in their browser.

The second part would be a website where you could do the same, including a live editor, access to the compiler and also the ability to buy and sell components, solutions and products. But for that we needed a desktop environment (which is where the Quartex Media Desktop came in later).

cool

The first version of the Media Desktop, small but powerful. Here running in touch-screen mode with classical mobile device layout (full screen forms).

Well, we have hit many bumps along the road since then. But I must be honest and say, some of our detours have also been the most valuable. Had it not been for the often absurd (to the person looking in) research and demo escapades I did, the RTL wouldn’t be half as powerful as it is today. It would deliver the basics, perhaps piggyback on Ext.js or some lame, run of the mill framework – and that would be that. Boring, flat and limited.

What we really wanted to deliver was a platform. Not just a website, but a rich environment for creating, delivering and enjoying web and cloud based applications. And without much fanfare – that is ultimately what the Smart Desktop and it’s sexy node.js back-end is all about is all about.

We have many project types in the pipeline, but the Smart Desktop type is by far the most interesting and powerful. And its 100% under your control. You can create both the desktop itself as a project – and also applications that should run on that desktop as separate projects.

This is perfectly suited for NAS design (network active storage devices can usually be accessed through a web portal on the device), embedded boards, intranets and even intranets for that matter.

You get to enjoy all the perks of a multi-user desktop, one capable of both remote desktop access, telnet access, sharing files and media, playing music and video (we even compiled the mp4 codec from C to JavaScript so you can play mp4 movies without the need for a server backend).

The Smart Desktop

The Smart Desktop project is not just for fun and games. We have big plans for it. And once its solid and complete (we are closing in on 46% done), my next side project will not be more emulators or demos – it will be to move our compiler(s) to Amazon, and write the IDE itself from scratch in Smart Pascal.

smart desktop

The Smart Desktop – A full desktop in the true sense of the word

And yeah, we have plans for EmScripten as well – which takes C/C++ and compiles it into asm.js. It will take a herculean effort to merge our RTL with their sandboxed infrastructure – but the benefits are too great to ignore.

As a bonus you get to run native 68k applications (read: Amiga applications) via emulation. While I realize this will be mostly interesting for people that grew up with that machine – it is still a testament to the power of Smart and how much you can do if you really put your mind to it.

Naturally, the native IDE wont vanish. We have a few new directions we are investigating here – but native will absolutely not go anywhere. But cloud, the desktop system we are creating, is starting to become what we set out to make five years ago (has it been half a decade already? Tempus fugit!). As you all know it was initially designed as an example of how you could write full-screen applications for Raspberry PI and similar embedded devices. But now its a full platform in its own right – with a Linux core and node.js heart, there really is very little you cannot do here.

scsc

The Smart Pascal compiler is one of our tools that is ready for cloud-i-fication

Being able to login to the Smart company servers, fire up the IDE and just code – no matter if you are: be it Spain, Italy, Egypt, China or good old USA — is a pretty awesome thing!

Clicking compile and the server does the grunt work and you can test your apps live in a virtual window; switch between device layouts and targets — then hit “publish” and it goes to Cordova (or Delphi) and voila – you get a message back when binaries for 9 mobile devices is ready for deployment. One click to publish your applications on Appstore, Google play and Microsoft marketplace.

Object pascal works

People may have brushed off object pascal (and from experience those people have a very narrow view of what object pascal is all about), but when they see what Smart delivers, which in itself is written in Delphi, powered by Delphi and should be in every Delphi developer’s toolbox — i think it should draw attention to both Delphi as a product, object pascal as a language – and smart as a solution.

With Smart it doesn’t matter what computer you use. You can sit at home with the new A1222 PPC Amiga, or a kick-ass Intel i7 beast that chew virtual machines for breakfast. If your computer can handle a modern website, then you can learn object pascal and work directly in the cloud.

desktop_embedded

The Smart Desktop running on cheap embedded hardware. The results are fantastic and the financial savings of using Smart Pascal on the kiosk client is $400 per unit in this case

Heck you can work off a $60 ODroid XU4, it has more than enough horsepower to drive the latest chrome or Firefox engines. All the compilation takes place on the server anyways. And if you want a Delphi vessel rather than phonegap (so that it’s a Delphi application that opens up a web-view in full-screen and expose features to your smart code) then you will be happy to know that this is being investigated.

More targets

There are a lot of systems out there in the world, some of which did not exist just a couple of years ago. FriendOS is a cloud based operating system we really want to support, so we are eager to get cracking on their SDK when that comes out. Being able to target FriendOS from Smart is valuable, because some of the stuff you can do in SMS with just a bit of code – would take weeks to hand write in JavaScript. So you get a productive edge unlike anything else – which is good to have when a new market opens.

As far as Delphi is concerned there are smaller systems that Embarcadero may not be interested in, for example the many embedded systems that have come out lately. If Embarcadero tried to target them all – it would be a never-ending cat and mouse game. It seems like almost every month there is a new board on the market. So I fully understand why Embarcadero sticks to the most established vendors.

ov-4f-img

Smart technology allows you to cover all your bases regardless of device

But for you, the programmer, these smaller boards can repsent thousands of dollars worth of saving. Perhaps you are building a kiosk system and need to have a good-looking user interface that is not carved in stone, touch capabilities, low-latency full-duplex communication with a server; not much you can do about that if Delphi doesnt target it. And Delphi is a work horse so it demands a lot more cpu than a low-budget ARM SoC can deliver. But web-tech can thrive in these low-end environments. So again we see that Smart can compliment and be a valuable addition to Delphi. It helps you as a Delphi developer to act on opportunities that would otherwise pass you by.

So in the above scenario you can double down. You can use Smart for the user-interface on a low power, low-cost SoC (system on a chip) kiosk — and Delphi on the server.

It all depends on what you are interfacing with. If you have a full Delphi backend (which I presume you have) then writing the interface server in Delphi obviously makes more sense.

If you don’t have any back-end then, depending on your needs or future plans, it could be wise to investigate if node.js is right for you. If it’s not – go with what you know. You can make use of Smart’s capabilities either way to deliver cost-effective, good-looking device front-ends of mobile apps. Its valuable tool in your Delphi toolbox.

Better infrastructure and rooting

So far our support for various systems has been in the form of APIs or “wrapper units”. This is good if you are a low-level coder like myself, but if you are coming directly from Delphi without any background in web technology – you wouldn’t even know where to start.

So starting with the next IDE update each platform we support will not just have low-level wrapper units, but project types and units written and adapted by human beings. This means extra work for us – but that is the way it has to be.

As of writing the following projects can be created:

  • HTML5 mobile applications
  • HTML5 mobile console applications
  • Node.js console applications
  • node.js server applications
  • node.js service applications (requires PM2)
  • Web worker project (deprecated, web-workers can now be created anywhere)

We also have support for the following operating systems:

  • Chrome OS
  • Mozilla OS
  • Samsung Tizen OS

The following API’s have shipped with Smart since version 1.2:

  • Khronos browser extensions
  • Firefox spesific API
  • NodeWebkit
  • Phonegap
    • Phonegap provides native access to roughly 9 operating systems. It is however cumbersome to work with and beta-test if you are unfamiliar with the “tools of the trade” in the JavaScript world.
  • Whatwg
  • WAC Apis

Future goals

The first thing we need to do is to update and re-generate ALL header files (or pascal units that interface with the JavaScript libraries) and make what we already have polished, available, documented and ready for enterprise level use.

kiosk-systems

Why pay $400 to power your kiosk when $99 and Smart can do a better job?

Secondly, project types must be established where they make sense. Not all frameworks are suitable for full project isolation, but act more like utility libraries (like jQuery or similar training-wheels). And as much as possible of the RTL made platform independent and organized following our namespace scheme.

But there are also other operating systems we want to support:

  • Norwegian made Friend OS, which is a business oriented cloud desktop
  • Node.js OS is very exciting
  • LG WebOS, and their Enyo application framework
  • Asustor DLM web operating system is also a highly attractive system to support
  • OpenNAS has a very powerful JavaScript application framework
  • Segate Nas OS 4 likewise use JavaScript for visual, universal applications
  • Microsoft Universal Platform allows you to create truly portable, native speed JavaScript applications
  • QNap QTS web operating system [now at version 4.2]

All of these are separate from our own NAS and embedded device system: Smart Desktop, which uses node.js as a backend and will run on anything as long as node and a modern browser is present.

Final words

I hope you guys have enjoyed my little trip down memory lane, and also the plans we have for the future. Personally I am super excited about moving the IDE to the cloud and making Smart available 24/7 globally – so that everyone can use it to design, implement and build software for the future right now.

Smart Pascal Builder (or whatever nickname we give it) is probably the first of its kind in the world. There are a ton of “write code on the web” pages out there, but so far there is not a single hard-core development studio like I have in mind here.

So hold on, because the future is just around the corner 😉

Smart desktop: Amibian.js past, future and present

April 1, 2017 2 comments

Had someone told me 20 years ago that I would enter my 40’s enjoying JavaScript, my younger self would probably have beaten that someone over the head with a book on hardcore demo coding or something. So yeah, things have changed so much and we are right now in the middle of a paradigm shift that is taking us all to the next level – regardless if we agree or not.

Ask a person what he thinks about “cloud” and you rarely get an answer that resembles what cloud really is. Most will say “its a fancy way of dealing with storage”. Others will say its all about web-services – and others might say it’s about JavaScript.

memyselfandi

Old coders never die, we just get better

They are all right and wrong at the same time. Cloud is first of all the total abstraction of all parts that makes up a networked computer system. Storage, processing capacity, memory, operating system, services, programming language and even instruction set.

Where a programmer today works with libraries and classes to create programs that run on a desktop — dragging visual controls like edit-boxes and buttons into place using a form or window designer; a cloud developer builds whole infrastructures. He drags and drops whole servers into place, connects external and internal services.

Storage? Ok I need Dropbox, amazon, Google drive, Microsoft one disk, local disk – and he just drags that onto a module. Done. All of these services now have a common API that allows them to talk with each other. They become like dll files or classes, all built using the same mold – but with wildly different internals. It doesn’t matter as long as they deliver the functionality according to standard.

Processing power? Setup an Azure or Amazon account and if you got the cash, you can compute enough to pre-cacalculate the human brain if you like. It has all been turned into services — that you can link together like lego pieces.

Forget everything you think you know about web; that is but the visual rendering engine over the proverbial death-star of technology hidden beneath. People have only seen the tip of the ice berg.

Operating systems have been reduced to a preference. There is no longer any reason to pick Windows over Linux on the server. Microsoft knew years ago that this day would come. Back in the late 90s I remember reading an interview with Steve Balmer doing one of his black-ops meetings with Norwegian tech holders in Oslo; and he outlined software as a service when people were on 14.4 modems. He also mentioned that “we need a language that is universal” to make this a reality. You can guess why .net was stolen from Borland, not to mention their failed hostile takover of Java (or J#) which Anders Hejlsberg was hired to spear-head.

Amibian.js

Amibian.js is my, Gunnar and Thomas‘s effort to ensure that the Amiga is made portable and can be enjoyed in this new paradigm. It is not made to compete with anyone (as was suggested earlier), but rather to make sure Amiga gets some life into her again – and that people of this generation and the kids growing up now can get to enjoy the same exciting environment that we had.

Amibian666

From Scandinavia with love

The world is going JavaScript. Hardware now speaks JavaScript (!), your TV now speaks JavaScript – heck your digital watch probably runs JavaScript. And just to add insult to injury – asm.js now compiles JS code side-by-side with C/C++ in terms of speed. I think the browser has seen more man years of development time than any other piece of software out there – with the exception of GCC / Gnu Linux perhaps.

Amibian is also an example of a what you can do with Smart Pascal, which is a programming environment that compiles object pascal to JavaScript. One we (The Smart Company AS) made especially for this new paradigm. I knew this was coming years ago – and have been waiting for it. But that’s another story all together.

Future

Well, naturally the desktop system is written from scratch so it needs to be completed. We are at roughly 40% right now. But there is also work to be done on UAE.js (a mild fork of sae, scriptable Amiga emulator) in terms of speed and IO. We want the emulated Amiga side to interact with the modern web desktop – to be able to load and save files to whatever backend you are using.

 

Amibianstuff

For those about to rock; We salute you!

Well, it’s not that easy. UAE is like an organism, and introducing new organs into an existing creature is not easily done. UAE.js (or SAE) has omitted a huge chunk of the original code – which also includes the modified boot-code that adds support for external or “virtual” UAE drives (thanks to Frode Solheim of Fs-UAE for explaining the details of the parts here).

But, there are hacker ways. The dark side is a pathway to many abilities, some deemed unnatural. So if all else fails, i will kidnap the hardfile API and delegate the IO signals to the virtual filesystem on the server — in short, UAE.JS will think it’s booting from a hardfile in memory – when in reality it will get its data from node.js.

There are some challenges here. UAE (the original) is not async but ordinary, linear C code. JavaScript is async and may not return the data on exit of the method. So i suspect I will have to cache quite a lot. Perhaps as much as 1 megabyte backwards and forwards from the file-position. But getting data in there we will (and out), come hell or high water.

We can also drop a lot of sub code, like parts of the gayle interface. I found out this is the chip that deals with the IDE interface — so it has to be there, but it can also host memory expansions – but who the hell cares in 2017 in JavaScript about that. More than enough fun via standard chip/fast/rtg memory – so the odd bits can be removed.

So we got our work cut out for us. But hey.. there can only be one .. QUARTEX! And we bring you fire.

Ok. Lets do this!

Amibian + Smart pascal = A new beginning

March 25, 2017 Leave a comment

In the Amiga community there is a sub-group of people with an agenda. They hoard and collect every piece of hardware they can get their hand on – then sell them at absurd prices on ebay to enrich themselves. This is not only ruining the community at large, ensuring that ordinary users cannot get their hands on a plain, vanilla Amiga without having to fork out enough dough to buy a good car.

“We also have a working Facebook clone – but we’re not
going into competition with Mark Zuckerberg either”

Thankfully not everyone is like that. There are some very respected, very good people who buy old machines, restore them – and sell them at affordable prices. People that do this as a hobby or to make a little on the side. Nothing wrong with that. No, its people that try to sell you an A2000 for $3000, or that pimp out Vampire accelerator cards at 700€ a piece thats the problem.

As for the price sharks, well – this has to stop. And Gunnar’s Amibian distro has already given the Amiga scalpers a serious uppercut. Why buy an old Amiga when you can get a high-end A4000 experience with 4 times as much power for around $35? This is what Gunnar has made a reality – and he deserves a medal for his work!

And myself, Thomas and the others in our little band of brothers will pick up the fight and stand by Gunnar in his battle. A battle to make the Amiga affordable for ordinary human beings that love the platform.

Amiga as a service

Yesterday I did a little experiment. You know how Citrix and VMWare services work? In short, they are virtualization application servers. That means that they can create as many instances of Windows or Linux as they want – run your applications on it – and you can connect to your instance and use it. This is a big part of how cloud computing works.

While my little experiment is very humble, I am now streaming a WinUAE instance display from my basement server pc, just some old bucket of chips I use for debugging, directly into Amibian.js (!). It worked! I just created the world’s first Amiga application server. And it took me less than 30 minutes in Delphi !

Amibian, Amibian.js, appserver, what gives?

Let’s clear this up so you dont mix them:

Amibian. This is the original Linux distro made by Gunnar Kristjansson. It boots straight into UAE in full-screen. All it needs is a Raspberry PI, the Amiga rom files and your workbench or hard disk image. This is a purely native (machine code) solution.

Amibian.js – this is a JavaScript remake of AmigaOS that I’m building, with the look and feel of OS 4. It uses uae.js (also called SAE) to run 68k software directly in the browser. It is not a commercial product, but one of many demos that ship with Smart Mobile Studio. “Smart” is a compiler, editor and run-time library sold by The Smart Company AS. So Amibian.js is just a demo, just like Amos shipped with a ton of demo’s and Blitzbasic came with a whole disk full of examples.

Amiga application server (what I mentioned above) was just a 30 minute experiment I did yesterday after work. Again, just for fun.

I hope that clears up any confusion. Amibian.js is a purely JavaScript based desktop made in the spirit of the Amiga – it must not be confused with Amibian the Linux distro, which boots into UAE on a Raspberry PI. Nor is it an appserver – but rather, it can connect to an appserver if I want to.

genamiga

Generation Amiga post on Amibian.js earlier when I added some look & feel

With a bit of work, and if everything works as expected (I don’t see why not), I will upload both source and binaries to github together with Amibian.js.

There is only one clause: It cannot be used, recreated, included or distributed by Cloanto. Sorry guys, but the ROMS belong to the people, and until you release those into public domain, you wont get access to anything we make. Nothing personal, but pimping out roms and even having audacity to fork UAE and sell it as your own? You should be ashamed of yourself.

Are you in competition with FriendOS?

This question has popped up a couple of times the past two weeks. So I want to address that head on.

I make a product called Smart Mobile Studio. I do that with a group of well-known developers, and we have done so for many years now. The preliminary ideas were presented on my blog during the winter 2009, early 2010 and we started working (and blogging) after that. Smart Mobile Studio and it’s language, Smart Pascal (see Wikipedia article), takes object pascal (like freepascal or Delphi) and compiles to JavaScript rather than machine code.

smsamiga

The Smart compiler is due for OS4 once i get the A1222 in my hands

One of the examples that has shipped with Smart Mobile Studio, and also been available through a library called QTX, is something called Quartex Media Desktop. Which is an example of a NAS server front-end, a kiosk front-end (ticket ordering, cash machines etc) or just an intranet desktop where you centralize media and files. It is also node.js powered to deal with the back-end filesystem. This is now called amibian.js.

In other words – it has nothing to do with Friend software labs at all. In fact, I didn’t even know Friend existed until they approached me a few weeks ago.

15590846_10154070198815906_4207939673564686511_o

The Quartex Media desktop has been around for ages

Amibian.js is just an update of the Quartex Media Desktop example. It is not a commercial venture at all, but an example of how productive you can be with Smart pascal.

And it’s just one example out of more than a hundred that showcase different aspects of our run-time library. This example has been available since version 1.2 or 1.3 of Smart, so no, this is not me trying to reverse engineer FriendOS. Because I was doing this long before FriendOS even was presented. I have just added a windowing manager and made it look like OS4, which also happened before I had any contact with my buddies over at Friend Software Labs (why do you think they were interested in me).

16805402_1914020898827741_149245853_o

Early 2017 Linux bootloader by Gunnar

So, am I in competition with Friend? NO! I have absolutely no ambition, aspiration or intent for anything of the sorts. And should you be in doubt then let me break it down for you:

  • Hogne, Arne, David, Thomas, Francois and everyone at Friend Software Labs are friends of mine. I talk almost daily with David Pleasence who is a wonderful person and an inspiration for everyone who knows him.
  • Normal people don’t sneak around stabbing friends in the back. Plain and simple. That is not how I was raised, and such behavior is completely unacceptable.
  • Amibian.js is 110% pure Amiga oriented. The core of it has been a part of Smart for years now, and it has been freely available for anyone on google code and github.
  • For every change we have made to the Smart RTL, the media desktop example has been updated to reflect this. But ultimately it’s just one out of countless examples. We also have a working Facebook clone – but we’re not going into competition with Mark Zuckerberg for that matter.
  • People can invent the same things at the same time. Thats how reality works. There is a natural evolution of ideas, and great minds often think alike.

Why did you call it Amibian.js, it’s so confusing?

Well it’s a long story but to make it short. The first “boot into uae” thing was initially outlined by me (with the help of chips, the UAE4Arm maintainer). But I didn’t do it right because Linux has never really been my thing. So I just posted it on my retro-gaming blog and forgot all about it.

Gunnar picked this up and perfected it. He has worked weeks and months making Amibian into what it is today – together with Thomas, our spanish superhero /slash/ part-time dictator /slash/ minister of propaganda 🙂

We then started talking about making a new system. Not a new UAE, but something new and ground breaking. I proposed Smart Pascal, and we wondered how the Raspberry PI would run JavaScript performance wise. I then spent a couple of hours adding the icon layout grid and the windowing manager to our existing media desktop – and then fired up some HTML5 demos. Gunnar tested them under Chrome on the Raspberry PI — and voila, Amibian.js was born.

amidesk

And that is all there is to it. No drama, no hidden agendas – and no conspiracy.

I should also add that I do not work at Friend Software Labs, but we have excellent communication and I’m sure we will combine our forces on more than one software title in the future.

On a personal note I have more than a few titles I would like to port to FriendOS. One of my best sellers of all time is an invoice and credit application – which will be re-written in Smart Pascal (its presently a mix of Delphi and C++ builder code). The same program is also due to Amiga OS 4.1 whenever I get my A1222 (looking at you Trevor *smile*).

Well, I hope that clears up any misunderstanding regarding these very separate but superficially related topics. Amibian.js will remain 100% Amiga focused – that has been and remains our goal.

Ode to our childhood

Amibian is and will always be, an ode to the people who gave us such a great childhood. People like David Pleasence who was the face of Commodore in europe. A man who embody the friendliness of the Amiga with his very being. Probably one of the warmest and kindest people I can think of.

Francois Lionet, author of Amos Basic. The man who made me a programmer and that I cannot thank enough. And I know I’m not alone about learning from him.

Mark Sibly, the author of BlitzBasic, the man who taught me all those assembler tricks. A man that deserves to go down in the history books as one of the best programmers in history.

And above all – the people who made the Amiga itself; giants like Jay Miner, Dave Haynie, Carl Sassenrath, Dave Needle, RJ Michal (forgive me for not listing all of you. Your contributions will never be forgotten).

That is what Amibian.js is all about.

Patents and greed may have killed the actual code. But we are free to implement whatever we like from scratch. And when I’m done – your patents will be worthless..

 

Ghost of xmas past, or better known as the folder where old projects and abandoned ideas end up

December 8, 2016 Leave a comment

I think everyone has a folder where they stuff old units, test projects and well – all those ideas that seemed awesome at the time, but you either discovered that it was crap, not enough time, or just forgot all about it. It happens. What can I say.

Yeah, I have one of those as well. And I also have those duplicate folders. You know, that time when you decided to make backups for everything – but then you got a new PC and now you dont have a clue which version to keep? And when you finally sit down with beyondcompare to get this sorted, you have managed to add to both copies.

Well, needless to say I had a day I just went apeshit about a year ago and sorted everything. And whatever did not fit into my neat new code-folder(s) was mercilessly stuffed into the dark, obscure folder known only as “stuff” or “misc”.

My first basic compiler, awwwww how cute

Well its not all rubbish! I did find a special version of my kitchen-sink research IDE, the IDE I use when trying out new code for DWScript, PaxCompiler and FreePascal. I think it has 4 compilers in it or something, yet its under 30 megabytes in size! Pretty neat 🙂

Visual Basic to Smart Pascal, awww.... just want to snuggle it :)

Visual Basic to Smart Pascal, awww…. just want to snuggle it 🙂

It also features a unified file-system! You can mount packages, FTP folders, network paths or local folders – the IDE could not care less, it is completely abstracted from the actual filesystem and relates only to symbols and identifiers. The actual storage is dealt with by the filesource classes.

Package, ftp, socket, local folder - the IDE could not care less

Package, ftp, socket, local folder – the IDE could not care less

The Basic dialect here is essentially classical Visual Basic. The way you would write classes and deal with instances before dot net came along and forced all languages to look the same. I kinda like old visual basic, it had soul. It was completely useless except for scripting, and Delphi made it look like a joke – but as far as basic dialects go, it’s probably one of the cleanest and easiest to read.

DWScript, QTX Pascal (a custom fork of DWScript with a lot of cool features, some that Eric has added afterwards), Basic - and even freepascal! Thats the mother of all kitchen sinks!

DWScript, QTX Pascal (a custom fork of DWScript with a lot of cool features, some that Eric has added afterwards), Basic – and even freepascal! Thats the mother of all kitchen sinks!

The loss of QTX Pascal is a bit sad. I spent a couple of months doing my own fork of DWScript. Most of the features I added have now been included (although in another form) by Eric. But the codegen produced faster javascript. One of the things I spent some time on was optimization. Like getting rid of “variable = 0” type initialization if an assignment followed. I also added BeforeDestruction() and AfterConstruction() calls. This made an RTL a lot easier to write, but also more overhead. I was about to do conditional testing (so these would only be called if you actually used them) when I had to stop and work on Smart Mobile Studio again.

N++, exotic and functional!

This was one of my favorite language research projects. And dare I say, it is way ahead of it’s time. The idea is simple: with the future of computing being distributed, cloud based and powered by a multitude of computing modules from the US to South Africa — what would a programming language look like if built for 100% asyncronous, distributed execution?

Consider for instance, the execution of a procedure. Simple right? Well, in a truly distributed system – that procedure could execute anywhere. The whole point here is to utilize the combined power of each module (pc); which means a tasks could execute on different computers. A procedure could also be split up by the runtime environment and once again, be executed all over the place – with the dispatcher keeping track of when it’s done and whatever the result was (if any).

Only a spesific and generated on-demand “runtime context” would follow the task. This would contain things like variables it needs to execute, public symbols, basicaly just enough for the code to run successfully. This also includes resource forks (a term i used for accessing resources regardless of where they may be on the network).

The language design was actually done using Smart Mobile Studio (you can read more about the initial ideas here), and the first test modules ran on node.js (so no fancy graphics available sadly).

But it was incredibly fun to play with! But also time consuming to design a language for an execution model that havent really been invented yet. You can read more about some of my ideas for the execution model here.

I dont even think this execution model is out of the MIT labs yet — but it will once quantum compute models become commercially available (click here for a Berkley University published introduction to the basic computational models used in quantum information theory).

An N++ procedure (actually a microservice that consumed a WSDL service and calls it) looks like this:

program("service_test") {

  handshake {

    input {
      /* Consume WSDL Web-Service Endpoint */
      service1 @ service[URI:"http://www.test.com/SOAP/myService/WSDL/",
                 serviceType:SoapService];
    }

    output {
        myProcess @ process("self");
        stdio @ pipe("stdout");
      }
  }

  /* Execute RPC call */
  execute (stdio,service1)  {
    stdio:writeln("Calling webservice");
    execute (*)  {
      var int32 result = 0;
      set result = service1:getUserId("quartex","secret");
      stdio:writelnF("UserID on server={0}", result);
    } fail (e) {
      stdio.writelnF("Calling soap service failed: {0}",e);
      proceed;
    }
  }

  /* Exit code for process */
  set myProcess:exitCode = 0;
}

RML, Reduced markup language parser and runtime

Dont you just hate it when you lose the source-file for a programming language you made in a day, so now you dont have a clue what the syntax really was? I know, I know, but I honestly dont have the syntax or examples. It does with a disk ages ago.

RML was written to simplify generating HTML documents. There are a few things that you can optimize when it comes to HTML. First of all you know that the browser will read the document from top and downwards. This might not mean much at first glance, but it actually means that a language doesnt need the abillity to call emitter-code that has already executed (above). Think of it as being able to omit calls to procedure behind you in the source. That would be a mess for a language like delphi – but it doesnt impact a language that execute linear without any forms of jumps!

I seem to remember it looked something like this:

createobject(TRMLObject)
{
   writestr("testing");
   if(a=12)
   {
       readstr("mer testing");
   }
}
createobject(TRMLHeading)
{
   settitle("testing second object");
   if(a=12)
   {
       writestr("heading object successfully done");
   }
}
createobject(TRMLObject)
{
   writestr("testing third object");
   if(a=12)
   {
       readstr("mer testing from da third object");
   }
}

The idea is ofcourse that you have some pre-defined objects, a bit like custom-controls in Smart Pascal, and you create and populate these in a top-down fashion.
Once defined, generating quite advanced HTML documents can be done extremely fast. Much faster than ASP, DWS or php since no jumps are involved.

Here is how you compile and run a small debug session (drop a memo and button on a form first):

  var
    FContext: TRMLParseContext;
    FText:  String;
  begin
    FText:= 'createobject(TRMLObject)'
    +       '{'
    +       '   writestr("testing");'
    +       '   if(a=12)'
    +       '   {'
    +       '       readstr("mer testing");'
    +       '   }'
    +       '}'
    +       'createobject(TRMLHeading)'
    +       '{'
    +       '   settitle("testing second object");'
    +       '   if(a=12)'
    +       '   {'
    +       '       writestr("heading object successfully done");'
    +       '   }'
    +       '}'
    +       'createobject(TRMLObject)'
    +       '{'
    +       '   writestr("testing third object");'
    +       '   if(a=12)'
    +       '   {'
    +       '       readstr("mer testing from da third object");'
    +       '   }'
    +       '}';

    // double the code, just to get some payload
    FText := FText + FText;

    memo1.text:='';

    If RMLAllocContext(FContext,FText,[TRMLObject,TRMLHeading]) then
    Begin
      try
        if RMLCompile(FContext) then
        Begin
          caption:='Compilation was a success';
          If RMLExecute(FContext) then
          Begin
            Caption:='Executed successfully';
            memo1.text:=FContext.pcOutput;
          end;
        end else
        caption:=Format('compilation failed [%s]',[FContext.pcError]);
      finally
        RMLDisposeContext(FContext);
      end;
    end;

And here is the full code for the parser and runtime (still a few tidbits to work on, but its childs play). If you can make sense of it, knock yourself out 🙂

  unit rml;

  interface

  uses sysutils, classes, dialogs;

  type

  TRMLObject  = Class;

  TRMLClass     = Class of TRMLObject;
  TRMLOperator  = (opLess,opMore,opEquals,opNotEquals);
  TRMLDataType  = (daString,daNumber,daBoolean,daCustom);
  TRMLEntryType = (etAssignment,etMethod,etRepeat,etCreate,etIf);
  TRMLObjProc   = Function (Const EntryData:Pointer):Boolean of Object;

  (* represents a single condition in an IF statement *)
  PRMLCondition = ^TRMLCondition;
  TRMLCondition = Packed Record
    coSource:   String;
    coTarget:   String;
    coOperator: TRMLOperator;
  End;

  (* represents a parsed code declaration *)
  PRMLEntryDeclaration = ^TRMLEntryDeclaration;
  TRMLEntryDeclaration = Packed Record
    cxToken:      String;
    cxCondition:  String;
  End;

  (* represents a compiled parameter *)
  PRMLParameter = ^TRMLParameter;
  TRMLParameter = Packed Record
    prType:   TRMLDataType;
    prValue:  Pointer;
    prSize:   Integer;
  End;

  (* represents a compiled code entry *)
  PRMLEntryData = ^TRMLEntryData;
  TRMLEntryData = Packed Record
    edtype:         TRMLEntryType;
    edDeclaration:  TRMLEntryDeclaration;
    edObject:       TRMLObject;
    edParent:       PRMLEntryData;
    edMethod:       TRMLObjProc;
    edContext:      Pointer;
    edConditions:   Array of PRMLCondition;
    edParameters:   Array of PRMLParameter;
    edSubEntries:   Array of PRMLEntryData;
  End;

  PRMLParseContext = ^TRMLParseContext;
  TRMLParseContext = Packed Record
    pcSignature:  Integer;
    pcCol:        Integer;
    pcRow:        Integer;
    pcPos:        Integer;
    pcLen:        Integer;
    pcData:       String;
    pcError:      String;
    pcOutput:     String;
    pcRoot:       TRMLEntryData;
    pcClasses:    Array of TRMLClass;
  End;

  TRMLReadProc  = Function  (Var OutData;var Bytes:Integer):Boolean of Object;
  TRMLWriteProc = Function  (Var InData;Const Bytes:Integer):Boolean of Object;
  TRMLProcEntry = Function  (Const Entry:PRMLEntryData):Boolean of Object;

  PRMLObjectIndex = ^TRMLObjectIndex;
  TRMLObjectIndex = Packed Record
    oiMethods:    Array of record
                    omName:   String;
                    omSyntax: Array of TRMLDataType;
                    omEntry:  TRMLProcEntry;
                  end;
    oiProperties: Array of record
                    oiName:   String;
                    oiRead:   TRMLReadProc;
                    oiWrite:  TRMLWriteProc;
                    oiType:   TRMLDataType;
                  end;
  End;

  TRMLObject = Class(TObject)
  Private
    FIndexData: TRMLObjectIndex;
    FIndexPTR:  PRMLObjectIndex;
  Private
    Function    DoWriteStr(Const Entry:PRMLEntryData):Boolean;
    Function    DoReadStr(Const Entry:PRMLEntryData):Boolean;
  protected
    Procedure   Output(Const Context:PRMLParseContext;Const Value:String);
    Procedure   RegisterProperty(Const Name:String;Const DataType:TRMLDataType;
                Const _Read:TRMLReadProc;Const _Write:TRMLWriteProc);
    Procedure   RegisterMethod(Const Name:String;
                Const Syntax: Array of TRMLDataType;
                Const Entry: TRMLProcEntry);
  Public
    Property    ObjectIndex:PRMLObjectIndex read FIndexPTR;
    Constructor Create;virtual;
  End;

  TRMLHeading = Class(TRMLObject)
  Private
    FTitle:     String;
    Function    DoSetTitle(Const Entry:PRMLEntryData):Boolean;
    Function    DoReadTitle(Var OutData;var Bytes:Integer):Boolean;
    Function    DoWriteTitle(Var InData;Const Bytes:Integer):Boolean;
  Public
    property    Title:String read FTitle write FTitle;
    Constructor Create;override;
  End;

  Function  RMLAllocContext(var Context:TRMLParseContext;
            Const Source:String;Const ClsBase:Array of TRMLClass):Boolean;
  Function  RMLDisposeContext(Var Context:TRMLParseContext):Boolean;
  Function  RMLCompile(Var Context:TRMLParseContext):Boolean;
  Function  RMLExecute(Const Context:TRMLParseContext):Boolean;
  Function  RMLParseEntry(Value:String;
            var Declaration:TRMLEntryDeclaration;var Error:String):Boolean;

  implementation

  //###########################################################################
  // TRMLHeading
  //###########################################################################

  Constructor TRMLHeading.Create;
  Begin
    inherited;
    RegisterMethod('settitle',[daString],DoSetTitle);
    RegisterProperty('title',daString,DoReadTitle,DoWriteTitle);
  end;

  Function TRMLHeading.DoSetTitle(Const Entry:PRMLEntryData):Boolean;
  var
    FTemp:  String;
  Begin
    result:=length(Entry^.edParameters)>0;
    If result and (Entry^.edParameters[0].prType=daString) then
    DoWriteTitle(Entry^.edParameters[0].prValue^,
    Entry^.edParameters[0].prSize);
  end;

  Function TRMLHeading.DoReadTitle(Var OutData;var Bytes:Integer):Boolean;
  Begin
    Bytes:=Length(FTitle);
    If Bytes>0 then
    move(FTitle[1],outData,Bytes);
  end;

  Function TRMLHeading.DoWriteTitle(Var InData;Const Bytes:Integer):Boolean;
  Begin
    SetLength(FTitle,bytes);
    if Bytes>0 then
    move(inData,FTitle[1],Bytes);
  end;

  //###########################################################################
  // TRMLObject
  //###########################################################################

  Constructor TRMLObject.Create;
  begin
    inherited;
    FIndexPTR:=@FIndexData;
    RegisterMethod('writestr',[daString],DoWriteStr);
    RegisterMethod('readstr',[daString],DoReadStr);
  end;

  Procedure TRMLObject.Output(Const Context:PRMLParseContext;
            Const Value:String);
  Begin
    Context^.pcOutput:=Context^.pcOutput + Value;
  end;

  Function TRMLObject.DoReadStr(Const Entry:PRMLEntryData):Boolean;
  var
    FText:  String;
  Begin
    result:=True;
    With Entry^ do
    Begin
      FText:='Token: ' + edDeclaration.cxToken + #13#10;
      FText:=FText + 'Condition: ' + edDeclaration.cxCondition + #13#10;
      FText:=FText + #13#10;
      Output(edContext,FText);
    end;
  end;

  Function TRMLObject.DoWriteStr(Const Entry:PRMLEntryData):Boolean;
  var
    FText:  String;
  Begin
    result:=True;
    With Entry^ do
    Begin
      FText:='Token: ' + edDeclaration.cxToken + #13#10;
      FText:=FText + 'Condition: ' + edDeclaration.cxCondition + #13#10;
      FText:=FText + #13#10;
      Output(edContext,FText);
    end;
  end;

  Procedure   TRMLObject.RegisterProperty(Const Name:String;
              Const DataType:TRMLDataType;
              Const _Read:TRMLReadProc;Const _Write:TRMLWriteProc);
  var
    FCount: Integer;
  Begin
    //FCount:=high(FIndexData.oiProperties) - Low(FIndexData.oiProperties) + 1;
    FCount:=Length(FIndexData.oiProperties);
    SetLength(FIndexData.oiProperties,FCount+1);
    FIndexData.oiProperties[FCount].oiName:=Name;
    FIndexData.oiProperties[FCount].oiRead:=_Read;
    FIndexData.oiProperties[FCount].oiWrite:=_Write;
    FIndexData.oiProperties[FCount].oiType:=DataType;
  end;

  Procedure   TRMLObject.RegisterMethod(Const Name:String;
              Const Syntax: Array of TRMLDataType;
              Const Entry: TRMLProcEntry);
  var
    FCount: Integer;
    FTemp:  Integer;
  Begin
    //FCount:=high(FIndexData.oiMethods) - Low(FIndexData.oiMethods) + 1;
    FCount:=Length(FIndexData.oiMethods);
    SetLength(FIndexData.oiMethods,FCount+1);
    FIndexData.oiMethods[FCount].omName:=Name;
    FIndexData.oiMethods[FCount].omEntry:=Entry;

    //FTemp:=high(Syntax) - Low(Syntax) + 1;
    FTemp:=Length(Syntax);
    If FTemp>0 then
    Begin
      SetLength(FIndexData.oiMethods[FCount].omSyntax,FTemp);
      for FTemp:=low(syntax) to high(syntax) do
      FIndexData.oiMethods[FCount].omSyntax[FTemp]:=Syntax[FTemp];
    end;
  end;

  //###########################################################################
  // RML util methods
  //###########################################################################

  Function RMLContainChars(Const Value:String;const Chars:String):Boolean;
  var
    x:  Integer;
  Begin
    result:=True;
    for x:=1 to length(chars) do
    Begin
      if pos(chars[x],Value)<1 then
      Begin
        result:=False;
        Break;
      end;
    end;
  end;

  Function  RMLScanFor(const Value:String;Const Target:CHAR;
            Const Breakers:String;var Len:Integer):Boolean;
  var
    xpos: Integer;
  Begin
    result:=False;
    Len:=-1;
    xpos:=1;
    while xpos<=Length(Value) do     Begin       If Value[xpos]=Target then       Begin         Len:=xpos-1;         Result:=True;         Break;       end else       Begin         if pos(Value[xpos],Breakers)>0 then
        Break;
      end;
      inc(xpos);
    end;
  end;

  Function RMLisNumber(Const Value:String):Boolean;
  const
    CHARSET = '0123456789';
  var
    x:  Integer;
  Begin
    Result:=True;
    for x:=1 to length(Value) do
    Begin
      if pos(Value[x],CHARSET)<1 then
      Begin
        result:=False;
        Break;
      end;
    end;
  end;

  Function RMLIsBoolean(Const Value:String):Boolean;
  var
    FTemp:  String;
  Begin
    FTemp:=lowercase(trim(Value));
    result:=(FTemp='false') or (FTemp='true');
  end;

  Function RMLisString(Const Value:String):Boolean;
  var
    x:      Integer;
    FLeft:  Integer;
  Begin
    result:=False;
    FLeft:=0;
    (* check left side *)
    for x:=1 to length(Value) do
    Begin
      if Value[x]='"' then
      Begin
        FLeft:=x;
        Result:=True;
        Break;
      end else
      if Value[x]<>#32 then
      Break;
    end;
    (* check right side *)
    If result then
    Begin
      for x:=Length(Value) downto 1 do
      Begin
        if Value[x]='"' then
        Begin
          If x>FLeft then
          Break else
          Begin
            Result:=False;
            Break;
          end;
        end else
        if Value[x]<>#32 then
        Break;
      end;
    end;
  end;

  Function  RMLParseEntry(Value:String;
            var Declaration:TRMLEntryDeclaration;
            var Error:String):Boolean;
  var
    xpos: Integer;
  Begin
    fillchar(Declaration,SizeOf(Declaration),0);
    Result:=RMLContainChars(value,'()');
    if Result then
    Begin
      Result:=RMLScanFor(value,'(',')',xpos);
      if result then
      Begin
        Declaration.cxToken:=trim(copy(value,1,xpos));
        delete(value,1,xpos+1);
        Result:=RMLScanFor(value,')','(',xpos);
        if result then
        Begin
          Value:=TrimRight(Value);
          Result:=xpos=(length(value)-1);
          if result then
          Declaration.cxCondition:=trim(Copy(Value,1,xpos));
        end;
      end;
    end;
    If not Result then
    Error:='Invalid entry <' + value + '>';
  end;

  Function  RMLAllocContext(var Context:TRMLParseContext;
            Const Source:String;Const ClsBase:Array of TRMLClass):Boolean;
  var
    FCount: Integer;
  Begin
    If Context.pcSignature=SizeOf(Context) then
    RMLDisposeContext(Context);

    fillchar(Context,SizeOf(Context),#0);
    Context.pcSignature:=SizeOf(Context);
    Context.pcLen:=Length(Source);
    Context.pcData:=Source;

    FCount:=High(clsBase) - low(clsBase)+1;
    If FCount>0 then
    Begin
      SetLength(Context.pcClasses,FCount);
      for FCount:=Low(clsBase) to high(clsBase) do
      Context.pcClasses[FCount]:=clsBase[FCount];
    end;

    result:=True;
  end;

  Procedure RMLDisposeEntryData(Const Data:PRMLEntryData);
  var
    FTemp:  Integer;
    x:      Integer;
  Begin
    (* dispose of condition data *)
    FTemp:=length(Data^.edConditions);
    While FTemp>0 do
    Begin
      Dispose(Data^.edConditions[FTemp-1]);
      dec(FTemp);
    end;
    SetLength(Data^.edConditions,0);

    (* dispose of parameter data *)
    FTemp:=length(Data^.edParameters);
    While FTemp>0 do
    Begin
      If length(Data^.edParameters)>0 then
      Begin
        for x:=Low(Data^.edParameters) to high(Data^.edParameters) do
        If Data^.edParameters[x]^.prSize>0 then
        FreeMem(Data^.edParameters[x]^.prValue);
      end;
      Dispose(Data^.edParameters[FTemp-1]);
      dec(FTemp);
    end;
    SetLength(Data^.edParameters,0);

    (* dispose of sub entries *)
    //Ftemp:=High(Data^.edSubEntries)-Low(Data^.edSubEntries)+1;
    FTemp:=Length(Data^.edSubEntries);
    While FTemp>0 do
    Begin
      RMLDisposeEntryData(Data^.edSubEntries[FTemp-1]);
      Dec(FTemp);
    end;
    SetLength(Data^.edSubEntries,0);

    (* dispose of script object *)
    If  not (Data^.edtype in [etIf,etRepeat,etMethod])
    and (Data^.edObject<>NIL) then
    Data^.edObject.free;

    (* dispose of entry *)
    Dispose(Data);
  end;

  Function  RMLDisposeContext(Var Context:TRMLParseContext):Boolean;
  var
    FCount: Integer;
  Begin
    Result:=Context.pcSignature=SizeOf(Context);
    If Result then
    Begin
      Context.pcSignature:=0;
      Context.pcData:='';
      Context.pcError:='';
      FCount:=Length(Context.pcRoot.edSubEntries);
      //FCount:=High(Context.pcRoot.edSubEntries)
      //- Low(Context.pcRoot.edSubEntries) + 1;
      While FCount>0 do
      Begin
        RMLDisposeEntryData(Context.pcRoot.edSubEntries[FCount-1]);
        dec(FCount);
      end;
      SetLength(Context.pcRoot.edSubEntries,0);
    end;
  end;

  //###########################################################################
  // RML core methods
  //###########################################################################

  Function  RMLImplements(Const MethodName:String;
            Const obj:TRMLObject):Boolean;
  var
    FTable: PRMLObjectIndex;
    FCount: Integer;
  Begin
    Result:=Obj<>NIL;
    If result then
    Begin
      (* get object inex *)
      FTable:=Obj.ObjectIndex;
      //FCount:=High(FTable^.oiMethods) - low(FTable^.oiMethods) + 1;
      FCount:=Length(FTable^.oiMethods);
      Result:=FCount>0;
      If Result then
      Begin
        for FCount:=low(FTable^.oiMethods) to high(FTable^.oiMethods) do
        Begin
          Result:=FTable^.oiMethods[FCount].omName=MethodName;
          If Result then
          Break;
        end;
      end;
    end;
  end;

  Function  RMLGetMethodEntry(Const MethodName:String;
            Const obj:TRMLObject;var outEntry:TRMLObjProc):Boolean;
  var
    FTable: PRMLObjectIndex;
    FCount: Integer;
  Begin
    Result:=Obj<>NIL;
    If result then
    Begin
      (* get object inex *)
      FTable:=Obj.ObjectIndex;
      //FCount:=High(FTable^.oiMethods) - low(FTable^.oiMethods) + 1;
      FCount:=Length(FTable^.oiMethods);
      Result:=FCount>0;
      If Result then
      Begin
        for FCount:=low(FTable^.oiMethods) to high(FTable^.oiMethods) do
        Begin
          Result:=FTable^.oiMethods[FCount].omName=MethodName;
          If Result then
          Begin
            outEntry:=TRMLObjProc(FTable^.oiMethods[FCount].omEntry);
            Break;
          end;
        end;
      end;
    end;
  end;

  Function  RMLCreateObject(var Context:TRMLParseContext;
            Const Objname:String;var outObject:TRMLObject;
            var Error:String):Boolean;
  var
    FCount: Integer;
  Begin
    FCount:=High(Context.pcClasses) - Low(Context.pcClasses) + 1;
    Result:=FCount>0;
    if Result then
    Begin
      For FCount:=Low(Context.pcClasses) to high(Context.pcClasses) do
      Begin
        Result:=lowercase(Context.pcClasses[FCount].ClassName)=lowercase(objName);
        If result then
        Begin
          outObject:=Context.pcClasses[FCount].Create;
          Break;
        end;
      end;
    end;
    If not Result then
    Error:='Unknown class <' + Objname + '>';
  end;

  Function  RMLAddEntry(var Context:TRMLParseContext;
            Var Declaration:TRMLEntryDeclaration;
            Root:PRMLEntryData;var NewEntry:PRMLEntryData;
            var Error:String):Boolean;
  var
    FCount: Integer;
    x:      Integer;
    FTemp:  String;
    FLen:   Integer;
    FPar:   PRMLParameter;
  Begin
    Result:=Root<>NIL;
    If result then
    Begin
      (* create new entry *)
      new(NewEntry);

      (* Reset entry record *)
      NewEntry^.edType:=etAssignment;
      NewEntry^.edObject:=NIL;
      NewEntry^.edMethod:=NIL;
      SetLength(NewEntry^.edConditions,0);
      SetLength(NewEntry^.edParameters,0);
      SetLength(NewEntry^.edSubEntries,0);

      (* Set basic values *)
      NewEntry^.edParent:=Root;
      NewEntry^.edContext:=@Context;
      newEntry^.edDeclaration:=Declaration;

      (* insert entry into parent *)
      FCount:=Length(Root^.edSubEntries);
      SetLength(Root^.edSubEntries,FCount+1);
      Root^.edSubEntries[FCount]:=NewEntry;

      (* tokenize *)
      If declaration.cxToken='createobject' then
      Begin
        NewEntry^.edtype:=etCreate;
        Result:=RMLCreateObject
          (
          Context,declaration.cxCondition,
          NewEntry^.edObject,Error
          );
      end else

      if declaration.cxToken='if' then
      Begin
        NewEntry^.edtype:=etIF;
        NewEntry^.edObject:=NewEntry^.edParent.edObject;
      end else

      if declaration.cxToken='repeat' then
      NewEntry^.edtype:=etRepeat else

      Begin
        (* method call? Make sure entry object supports this *)
        Result:=NewEntry^.edParent.edObject<>NIL;
        If Result then
        Begin
          (* check if object supports the method name *)
          Result:=RMLImplements(declaration.cxToken,NewEntry^.edParent.edObject);
          If Result then
          Begin
            (* Query object for method entry *)
            Result:=RMLGetMethodEntry
              (
              declaration.cxToken,
              NewEntry^.edParent.edObject,
              NewEntry^.edMethod
              );

            If result then
            Begin
              NewEntry^.edtype:=etMethod;
              NewEntry^.edObject:=NewEntry^.edParent.edObject;

              (* now parse the parameter conditions *)
              x:=0;
              While x<Length(declaration.cxCondition) do               Begin                 inc(x);                 If (declaration.cxCondition[x]=',')                 or (x=Length(declaration.cxCondition)) then                 Begin                   If x=Length(declaration.cxCondition) then                   FTemp:=FTemp + declaration.cxCondition[x];                   FTemp:=trim(FTemp);                   If length(FTemp)>0 then
                  Begin
                    (* create a new parameter *)
                    FLen:=length(NewEntry^.edParameters);
                    setlength(NewEntry^.edParameters,FLen+1);

                    New(FPar);

                    If RMLIsString(FTemp) then
                    FPar^.prType:=daString else
                    if RMLIsNumber(FTemp) then
                    FPar^.prType:=daNumber else
                    if RMLIsBoolean(FTemp) then
                    FPar^.prType:=daBoolean else
                    FPar^.prType:=daCustom;

                    Case FPar^.prType of
                    daString:
                      Begin
                        Delete(FTemp,1,1);
                        Delete(FTemp,length(FTemp),1);
                        FPar^.prSize:=Length(FTemp);
                        FPar^.prValue:=AllocMem(FPar^.prSize);
                        move(FTemp[1],FPar^.prValue^,FPar^.prSize);
                      end;
                    daNumber:
                      Begin
                        FPar^.prSize:=SizeOf(Integer);
                        FPar^.prValue:=AllocMem(FPar^.prSize);
                        PInteger(FPar^.prValue)^:=StrToInt(FTemp);
                      end;
                    daBoolean:
                      Begin
                      end;
                    daCustom:
                      Begin
                      end;
                    end;

                    NewEntry^.edParameters[FLen]:=FPar;
                    FTemp:='';
                  end else
                  Begin
                    //Invalid parameter error
                  end;
                end else
                FTemp:=FTemp + declaration.cxCondition[x]
              end;

              {
              Validate parameter datatypes here!
              If  (Length(NewEntry^.edParameters)>0) then
              Begin
                for x:=Low(NewEntry^.edParameters) to
                high(NewEntry^.edParameters) do
                Begin
                  newEntry^.edObject.
                end;
              end;  }

            end;

          end else
          Begin
            // property assignment test here
          end;
        end;
      end;

      (* Failed to tokenize? *)
      If not Result then
      Begin
        (* dispose of entry data *)
        Dispose(NewEntry);
        NewEntry:=NIL;
        SetLength(Root^.edSubEntries,FCount);
        Context.pcError:=Format('Invalid token "%s"',[declaration.cxToken]);
      end;

    end else
    Error:='AddEntry failed, root can not be NIL';
  end;

  Function  RMLParseObject(Var Context:TRMLParseContext;
            Const Root:PRMLEntryData):Boolean;
  var
    FChar:        Char;
    FTemp:        String;
    FDeclaration: TRMLEntryDeclaration;
    FNewEntry:    PRMLEntryData;
  Begin
    Result:=Context.pcSignature=SizeOf(Context);
    If result then
    Begin
      (* update cursor *)
      inc(Context.pcPos);
      inc(Context.pcCol);

      while Result and (Context.pcPos<Context.pcLen) do
      Begin
        FChar:=Context.pcData[Context.pcPos];
        Case FCHAR of
        #13:
          Begin
            inc(Context.pcRow);
            inc(Context.pcPos);
            Context.pcCol:=0;
            Continue;
          end;
        ';':
          Begin
            Result:=RMLParseEntry(trim(FTemp),FDeclaration,Context.pcError);
            If result then
            Result:=RMLAddEntry
              (
                Context,
                FDeclaration,
                root,
                FNewEntry,
                Context.pcError
              );

            If Result then
            Begin
              inc(Context.pcPos);
              inc(Context.pcCol);

              If FNewEntry^.edtype=etIF then
              Result:=RMLParseObject(Context,FNewEntry);
            end;
            FTemp:='';
          end;
        '{':
          Begin
            Result:=RMLParseEntry(FTemp,FDeclaration,Context.pcError);
            If Result then
            Begin
              Result:=FDeclaration.cxToken='if';
              If result then
              Begin
                Result:=RMLAddEntry
                  (
                  Context,
                  FDeclaration,
                  Root,
                  FNewEntry,
                  Context.pcError
                  );
                If Result then
                Result:=RMLParseObject(Context,FNewEntry);
              end;
            end;
            FTemp:='';
          end;
        '}':
          Begin
            inc(Context.pcCol);
            inc(Context.pcPos);
            Break;
          end;
        else
          Begin
            FTemp:=FTemp + FChar;
            inc(Context.pcCol);
            inc(Context.pcPos);
          end;
        end;
      end;
    end;
  end;

  Function RMLExecute(Const Context:TRMLParseContext):Boolean;

    Function RunEntry(Const Item:PRMLEntryData):Boolean;
    var
      FSubCount:  Integer;
      x:          Integer;
    Begin
      result:=True;

      Case Item^.edtype of
      etCreate,
      etAssignment:
        Begin

          FSubCount:=Length(Item^.edSubEntries);
          for x:=1 to FSubCount do
          Begin
            result:=RunEntry(Item^.edSubEntries[x-1]);
            If not result then
            break;
          end;

        end;
      etMethod:
        Begin
          {result:=RMLGetMethodEntry(Item^.edDeclaration.cxToken,
          Item^.edObject,FEntry);
          If result then
          result:=FEntry(Item); }
          Result:=TRMLProcEntry(Item^.edMethod)(Item);
        end;
      etRepeat:
        Begin
          //FSubCount:=Length(Item^.edSubEntries);
        end;
      etIf:
        Begin
          FSubCount:=Length(Item^.edSubEntries);
          for x:=1 to FSubCount do
          RunEntry(Item^.edSubEntries[x-1]);
        end;
      end;
    End;

  Begin
    Result:=Context.pcSignature=SizeOf(Context);
    If result then
    Begin
      result:=length(Context.pcError)<1;
      If result then
      result:=RunEntry(@Context.pcRoot);
    end;
  end;

  Function RMLCompile(Var Context:TRMLParseContext):Boolean;
  var
    FChar:        Char;
    FTemp:        String;
    FDeclaration: TRMLEntryDeclaration;
    FNewEntry:    PRMLEntryData;
  Begin
    Result:=Context.pcSignature=SizeOf(Context);
    If result then
    Begin
      Context.pcCol:=0;
      Context.pcRow:=0;
      Context.pcPos:=1;
      Context.pcError:='';

      while Result and (Context.pcPos<Context.pcLen) do
      Begin
        FChar:=Context.pcData[Context.pcPos];
        Case FCHAR of
        #13:
          Begin
            inc(Context.pcRow);
            inc(Context.pcPos);
            Context.pcCol:=0;
            Continue;
          end;
        '{':
          Begin
            Result:=RMLParseEntry(FTemp,FDeclaration,Context.pcError);
            If Result then
            Begin
              Result:=FDeclaration.cxToken='createobject';
              If result then
              Begin
                Result:=RMLAddEntry
                  (
                  Context,
                  FDeclaration,
                  @Context.pcRoot,
                  FNewEntry,
                  Context.pcError
                  );
                If Result then
                Result:=RMLParseObject(Context,FNewEntry);
              end;
            end;
            FTemp:='';
          end;
        '}':
          Begin
          end;
        else
          Begin
            FTemp:=FTemp + FChar;
            inc(Context.pcCol);
            inc(Context.pcPos);
          end;
        end;
      end;
    end;
  end;

  end.

Why C# coders should shut up about Delphi

October 18, 2016 Comments off
13507225_10209662785317165_99874043994628045_n

When in Rome

Those that follow my blog or know me personally – also know that I don’t go out of my way to be confrontational or disrespectful. I try my best to follow the middle-path, to see positive in all things. But sometimes you face a level of stupid that begs a response. A verbal one. And this is one of those cases.

Lately I see more and more Delphi developers getting into debates with C# developers, and they are confronted with an attitude and belief-system that quite frankly is utter nonsense. It’s not based on history or facts but disputes rooted in childish “isms”. A mix of old habits and an unhealthy obsession with the notion that new means better.

It is nothing short of an intellectual emergency.

Old is bad?

If that is the case then C/C++ should be utter shit, because C is 3 years older than Pascal. Pascal was created to replace C and get away from (amongst other things) the absurd and time-consuming header file practice, not to mention the recursive hell that still occur when headers reference other headers and conditional symbols pile up.

Do you know how curly brackets came into being? Jump into your nearest Tardis and set the destination to the mid 1960’s. Not 1969 like Wikipedia will tell you, but a few years earlier. Back when mainframes were the size of Portugal and 1024 bytes of memory made professors all girly inside. You see, back then memory was sparse and pretty much all the languages (or toolkits) needed to save space. So the { } curly’s were used as replacements for words like “begin” and “end”. Why? Because one ascii byte is better than five ascii bytes when there’s only 1024 of them around.

Ps: when I use the word toolkit here I really mean a random soup of asm snippets dipped in venom. The bones collected to make C was actually a mix of homebrew toolkits made by different engineering teams at the time. And each of these toolkits had their own fanclub /slash/ legal representation; because all of them, miraculously, had invented the exact same thing at the same time before everyone else. These guys kept on fighting over who owned what well into the Watcom era. It’s probably the longest standing demonstration of a grown-up tantrum since the roman emperor caligula outlawed clothes.

Fast forward to 1970 and the amount of memory on mainframes had already doubled a few times just like Moore had predicted five years earlier. The C standard that Dennis Richie had painstakingly wrangled from the cold, greedy hands of grumpy old technicians was due for an upgrade. Tests were done by very dull, very serious men in grey clothing – and in their horror they discovered that human beings would interact with english words and phrases faster than symbols and glyphs. So a word like “begin” would be picked up by the brain faster than {. It is just knockout stuff isn’t it.

You cannot praise Anders as a genius architect and at the same time throw his life work in the thrash. Perhaps you should ask yourself why Anders loved object pascal so much that he dedicated half his career making sure universities had access to it.

Living on the edge with a red tie, Nicolaus Wirth rocks the scene!

Living on the edge with a red tie, Nicolaus Wirth rocks the scene!

Enter Niklaus Wirth, a man so clever and academic that he doesn’t catch exceptions; He is the exception. But next to his colleagues over at Berkley our dear Niklaus is the proverbial rock-star. He decided that in order to make programming more accessible for students, easier to learn and above all, establishing a standard for safer code, that they should take science to heart and include that in a programming language design. So he put on his gravest lab coat and began to implement “a better C”. Nine months later pascal was born, and to celebrate Niklaus used colored socks that day. A risky bit of business that could get him expelled from the university and cost him his seat at the strangely brown sorority club, in which he was master of ceremonies. But hey, Nikolaus is a rebel and this was the swinging 70’s after all.

My point? This is why pascal uses “begin” and “end” as opposed to { and }. Science. Real science.

Whimsical satire aside: with the knowledge that C is actually older than pascal, not to mention that it is identical in features, depth and complexity– what is it going to be? Do you still cling to the notion that older have to be of less value than new? Or could it in fact be that you havent really looked closer at object pascal to begin with? Have you even installed a modern version of Delphi and given it a worthy test drive? Or do you just speak out based on what you like and know, as opposed to what you don’t know and havent even tried.

My 8-year-old daughter is like that. She makes up her mind about food before she has even tasted it. Surely a trained engineer can do better?

And I say that because — if we follow your line of reasoning, C/C++ should be incapable of producing C#. How can something old and outdated possibly produce something new and exciting? You do know that C# is written in C and assembler right? And that Java and all the other high level languages out there didn’t spontaneously self assemble. They are all written in C, assembler or pascal. And there is a reason for that.

Just like nature have different levels, from particles to minerals, from minerals to bacteria, from bacteria to plants, from plants to insects (and so on) — so does a computer. Each of these levels have laws and no matter how much you want to introduce something from a higher level into a lower level – that’s just not how reality works.

foodchain

The fact that I have to explain this in 2016 demonstrates how education and academia has degraded after C and Pascal was replaced with Java.

The law is very simple: each level can only emit complexity upwards. So assembler is used to produce C and pascal, C and pascal is used to produce C++ and object pascal, C++ and object pascal is used to bring about every other single piece of tech you take for granted.

So when you criticize Delphi but use C#, you are actually saying “I want a T-Rex to inhabit the mineral world”. It’s just utterly divorced from reality.

It’s like saying Visual Basic 5 is cooler than assembler. You don’t debate with people like that, you just look at them with pity. I don’t know how many years a software engineering  degree is elsewhere, but if you just spent 3 years in college and 2 years at a university followed by one or two additional years getting your diploma – and this is the level of insight you graduate with then I pity you. And I pity your employer because sooner or later you will bring about the apocalypse.

If we apply rational logical thought to the proposition at hand, we cannot but conclude that the notion of “new is always better” is false. It is to mistake marketing for facts and capitalism for science.

Your teacher should have taught you this: “In a computer, like nature, the past is always alive“. Look closely at your brand new pc: Bios, Vesa screen modes, non linear memory, hardware interrupt vectors and a cpu that supports no less than 3 instruction sets. Do you think Windows or the Linux kernel can just ignore this? Why not call up Linus Torvalds and ask him why he’s not using C# in his line of work; or NVidia why their GPU pipeline only ships with C headers and not C++ classes. I sure as hell wouldn’t want to be on the receiving end of that call.

C# is better than Delphi?

Anders Hejlsberg, the father of many languages

Anders Hejlsberg, the father of many languages

Actually, it’s not. What today is known as .net, from its CIL intermediate language right down to the global assembly cache is Delphi. Yes you read that correctly the entire .net product family is Delphi. It was described on Borland’s news-servers years before it magically appeared as Microsoft’s flagship product.

Anders Hejlsberg created and prototyped these technologies while he was working at Borland. And indeed, the father of C# and entire dot net stack is none other than the father of Delphi.

At Borland (in the borland.language newsfeed I vividly remember) these technologies went mentioned under the codename “portable Delphi”. I followed the thread on the news servers for quite some time. It was no secret that Borland was tinkering away on the next big thing, and I believe it was ultimately Borland’s response to Java. Because at the time Java had eaten quite a chunk of Borlands educational seat licenses. And had Anders continued working for Borland, Delphi and C++ builder would perhaps be bytecode based today.

So when you, the C# fanboy, propose that Delphi is somehow inferior to dot net, or that object pascal is outdated and technically behind C# you are not just shooting yourself in one foot, but both feet at the same time. Keep on reading and you will understand why.

But just to make this crystal clear: Anders Hejlsberg is not just the father of C# and dot net: he is also the father of Delphi. And before that he gave birth to Turbo Pascal.

Borland, land of the free

Borland, the company Anders worked for, was put out to pasture by Microsoft. Bill Gates and his thugs launched a financial onslaught that few companies on the planet could have endured. The reason was that Microsoft really had the worst developer tools on the market, while Borland represented the very best. So for a long time Borland was a direct threat to Microsoft. And they were winning every single time.

When Borland later began to flirt with Linux (Delphi Kylix) it must have made the R&D department at Microsoft piss themselves. Delphi is responsible for thousands of desktop applications synonymous with Windows – and if Linux users got their hands on RAD tools like Delphi, they were in a real position to hurt Microsoft. You have to remember that this was before cloud computing. Microsoft didn’t have a fallback strategy and depended on desktop and server sales. Linux could do everything Windows could, but it lacked the desktop applications, the user friendliness and features Borland made simple. But that is a whole different story so let’s not deviate from our timeline.

Weird Science, a fun but completely fictional movie from 1985. I just posted this to liven up an otherwise boring trip down memory lane

Weird Science, a fun but completely fictional movie from 1985. My point? People who don’t know how computers worked were actually afraid this pseudo-garbage could one day be real. Just like C# and Java programmers believe they are top-dog, they are in fact standing on the shoulders of giants. C/C++ and object pascal is holding you up.

What Microsoft did was, basically, to buy out Anders from Borland and at the same time attack the company from every angle. Drowning them in bullshit lawsuits, patent claims and all the nasty, cowardly practices Microsoft is renowned for.

Bill Gates called Anders up personally and gave him “an offer I could not refuse” as Anders dubs it in various interviews over the years.

So to put this myth to rest and be done with it: C# as a language and dot net as a technology did not originate with Microsoft. It has Borland written all over it and its architecture is intimately joined at the hip with Delphi and C++ builder. Companies like Microsoft dont innovate any more, they buy competence and re-brands it as their own.

Dot Net framework, you mean the VCL?

If that is not enough, take a long, hard look at how the .net framework is organized. Pay special attention to the features and methods of the base-classes and RTTI. What you are looking at is the VCL, the visual component library, Delphi and C++ builder’s run time library.

There was never any secret where this came from, but it’s not advertised either so I don’t blame people for not recognizing it. But when people start to behave nasty over what should be either a passionate hobby or a professional discipline, then truth must be told. The very foundation of the dot net framework is taken straight out of the VCL.

And why shouldnt it? The whole platform was whispered about under the codename “portable Delphi” to begin with, it was even designed by the same author – so why should it come as a surprise that it’s basically Delphi reincarnated with a different syntax parser? Either way a few bells should start ringing in your head – telling you that you may have been wrong about Delphi and object pascal in general. Probably because you know very little about Delphi to begin with.

So, what you perhaps believe sets C# apart from Delphi, what you imagine gives dot net an advantage over Delphi – is in reality the opposite: it is Delphi. It originated in Delphi, was inspired by Delphi and flows straight from the inventor of Delphi himself. Anders is responsible for two distinct object pascal development platforms prior to working for Microsoft. Take some time to reflect on that.

You cannot praise Anders as a genius architect and at the same time throw his life work in the thrash. Perhaps you should ask yourself why Anders loved object pascal so much that he dedicated half his career making sure universities had access to it.

Strength in diversity

The fact that C/C++ is alive and well today serves to prove my point: age has no meaning when dealing with fundamental technology. These languages embody the fundamental principles of computing. It’s like a force of nature. Electricity was never invented, it was there all along as a part of nature – we just had to learn the principles in order to tame it. And archetypical programming languages is almost the same thing. They don’t grow old because they represent a fundamental level that can never be replaced.

Things are the way they are for a reason. And programmers before you established standards that address things you might not have to deal with, but that’s because they dealt with it before you. Just because you don’t see the plumbing doesn’t mean it’s not there.

These are the compilers responsible for the foundation on which all other languages, operative systems, applications and services rest. Remove those, and the whole house of cards come crashing down.

So C/C++ and object pascal continue to exist, thrive even, precisely because they interface with the hardware itself, not a virtual machine or bytecode format. Delphi as a product is naturally tailored for operative systems, as is C/C++. But that is because we use programming languages to create applications. There is nothing in the way of someone using compilers like freepascal and writing an operative system from scratch.

Ultibo is an ARM operative system written purely in object pascal

Ultibo is an ARM operative system written purely in object pascal

By contrast, C#, Java and Visual Basic are context dependent languages. They exist purely in context with an operative system or run-time environment. They can’t exist without these and lack the depth C and pascal brings to the table. The depth to span many levels, from the lowest all the way up to cloud and domain driven programming.

Just look at Android, an operative system written in Java right? Well that’s not really true. The Android operative system depends on a native bootstrap, a piece of code that establishes the run-time environment for Java applications. So when you fire up your Android phone, tablet or set-top box, the first thing to boot is a loading mechanism written in vanilla C. This in turn mounts a filesystem and continues to loads in bunch of native drivers. Drivers for the display, storage, wi-fi and all the hardware components that ultimately make up your SoC (system on a chip).

Its only after this long process that the environment is capable of hosting the Java virtual machine. Then and only then is the device capable of executing Java.

7709-f-1

Notice the “C” part of the Java NDK? Wasnt that exactly what Java was supposed to solve? All that hype and here you are, back at where you started!

So Java, which for the past decade or more have bombarded us with advertising like “platform independence” is a total flop! Its like communism and looks good on paper, but once you start testing these ideas in real life – they just don’t work.

Turned out that the java virtual machine when running on small devices like phones and tablets, choked the CPU. Which in turn used more electricity to keep up, which in turn rendered the battery life of these devices null and void. Talk about irony. All that hype and Java couldn’t even deliver its most basic promise: platform independence. And you removed C and pascal from our universities for this? It’s a disaster en-par with the burning of the great library of Alexandria.

There is more than a drop of ego and arrogance in this material. Young people especially like to believe they are smarter than those who lived before them. It’s a very selfish idea that really need to be addressed. Take someone like Alan Turing for example, the inventor of what we call computers today. This man assembled and created the first computer by hand. He even hand carved the wheels that made the mechanism run (which was mechanical during the second world war). I would happily bet $1000 that Alan could out program the lot of us had he gotten the chance. He has been dead for many years, but to imagine yourself smarter or more capable than him would be the definition of arrogance.

PS: This is where we come into the realm of wisdom versus knowledge. The difference may be subtle, but it’s so important to distinguish between them.

C# would have been a sad little language without the work of this man, Miguel de icaza

C# would have been a sad little language without the work of this man, Miguel de icaza

Either way without the native context to support it Java turned out to be a blundering behemoth. And its the exact same with C#. This is why Miguel de Icaza work on Mono has been so instrumental to the success of dot net and C# in particular. It was Miguel and his team that pushed C# into native compilation versus JIT for mobile devices. C# would never have been allowed on IOS or Android otherwise.

So that is the difference between archetypical languages and context based languages. Hopefully you now see why this negative attitude towards Delphi and object pascal doesn’t make sense. It really is just as stupid as these cults that believe in dinosaurs and that human beings once lived side by side with a T-rex. Anyone with a highschool diploma should instinctively know better.

The problem is when people in great enough numbers start to believe in this nonsense, because then they can actually damage important mechanisms of our eco-system. Insane beliefs really is dangerous both socially and technically.

Grow up!

I have no problem using C# and consider it a valuable tool in my toolbox. Same with Delphi. But when it comes to kick-ass desktop applications for Windows and OS X, Delphi has no rival. It gives you a productive edge that I havent found in any other language. And I don’t base that on preference. I base that on engineering and the years of development invested in Delphi by both Borland and Embarcadero.

I just find it odd that C# developers seem to lack the ability to speak well about Delphi, because it’s a tell-tell sign of immaturity to be incapable of that. Object pascal and C++ is identical in every way (except multiple inheritance, which even C++ programmers shun like the plague so no loss there). Why then should educated programmers find it reasonable to praise C but thrash pascal? It’s like saying that one car is faster than another – but when you pop the hood they have the same engine. The exact same machine code generator even.  It is psychological masturbation. We are coders, we shouldnt do things like that. We should examine the system carefully and then make up our minds.

And what is a programming language anyway? It is the ability to describe the solution to a problem. The ability to define and control how a series of activities execute. Each language represents a methodology for solving problems. A mindset. Nothing more.

Languages like C, C++ and object pascal will always exist, they will always thrive, because they are instrumental to everything else (desktop, operative system, services, everything that makes a computer capable of what it does). It doesn’t mean that Delphi is the solution to all problems, far from it. And that is ok.

Context based languages are more often than not designed for a purpose. Java was initially designed as a network language. This makes Java infinitely more suitable for dealing with that line of work. You can do the exact same in C but you would have to add a few libraries and establish a platform. Which is exactly what C and pascal is good at, implementing fundamental technology. Object pascal is a language you would use when creating other languages. C is more popular for virtual machine development, no doubt there, but there is nothing in C/C++ that you wont find in object pascal.

Interestingly, languages that many believe is long since extinct, like Cobol, are actually alive. Cobol was created to deal with large stacks of numbers and to push associated data through formulas. That is its context and no other language is better suited for the banking sector than Cobol. Which incidentally is the one place where Cobol is used to this day. And why not? Why waste millions trying to hammer in a nail with a hacksaw? Why not use a language especially designed for that purpose? SQL is likewise a language especially tailored for its tasks. I don’t hear anyone bitching about how old and outdated that is. It wont grow old because it embodies the principle of relational data.

And just what exactly is old about Delphi? Generics? Posix support? Weak and strong references? Garbage collection? Attributes? class, record and enum helpers? Dependency injection? Model view controller frameworks? The ability to write assembler side by side with pascal? The ability to link with C/C++ objects? Cross compilation for Windows, OS X and mobile platforms? What manner of logic are you using where you praise other languages for these features, but for Delphi the same features makes it old? Stop repeating what someone once told you like a mindless parrot and investigate. You are an engineer, a field of science; start acting like one.

In my work I use several languages: JavaScript, Delphi, Smart Pascal, Mono C# and even Python. I have also fallen in love with LUA believe it or not.

For web-pages I prefer Smart pascal which compiles to JavaScript (node.js is fantastic). Then you have shell scripting, a touch of x86 assembly code, a dash of bash on my Linux box and .. well, there is strength in diversity.

It all depends on what is best for the customer and what language yields the most robust solution. Sometimes C# is better suited for my clients infrastructure, other times Delphi makes more sense. But if I was to pick a single language to cover all of them, it would either be object pascal or C++ (gcc). These really have no rivals and will never go away.

These are the compilers responsible for the foundation on which all other languages, operative systems, applications and services rest. Remove those, and the whole house of cards come crashing down.

So using many languages is actually an enriching experience. It brings more depth to our way of thinking and (consequently) affect the quality of our products.

Anyways, I believe congratulations are in order, because if your favorite language is C#, you have in fact been using Delphi without knowing it. There is so much Delphi in C# and they both originate from the same author. So why not pay a visit to C#’s older brother?

So go download Delphi, Smart Mobile Studio, Lazarus and Remobjects Oxygene – enjoy the decades of research and excellence these dialects represent. It wont hurt you, it will probably do you a great deal of good.

Smart Mobile Studio, datasets and websockets

September 25, 2015 2 comments
It's all about the bytes

It’s all about the bytes

If you have been playing with the beta you have probably noticed a few cool new units in the RTL. First there is system.memory, system.typecon, followed by system.streams. And last but not least: system.dataset.

What’s so special about these units? Well, they give you the same level of low-level (read: byte) access as you enjoy under Delphi. If you know your way around JavaScript you must have noticed that this is a sensitive subject, a really sensitive subject (!). JavaScript is hopeless when it comes to binary data, and there is no such thing as a “stream” in the browser.

You wont believe some of the solutions out there which pass for “top notch” JavaScript. Most of them involving cheap hacks like stuffing bin-hex’ed data into strings. This means you need a separate layer of encoding before you push the data to a server (or de-serialize it to JSON). Well we dont have that problem 🙂

So, with all these units firmly in place we can now enjoy the same level of power, simplicity and elegance as under native Delphi or freepascal. And this is where TW3Dataset comes in. Because it’s actually a fully OOP dataset which saves to a very simple binary format (!)

TW3Dataset

Fast, binary, pure object pascal

Fast, binary, pure object pascal

Let’s say you have a mobile solution which needs to store uniform data. It can be a phone-book, a list of high-scores for a game, time samples or your latest RSS feed poll. Traditionally you would sculpt it all using arrays and then serialize the whole shabam to JSON; or even worse: make use of WebSQL, PouchDB, TaffyDB or other JavaScript dependencies.

Well that is now a thing of the past. For simple in-memory dataset chores, TW3Dataset covers your basic needs more than adequate. It also saves to TStream, meaning that saving and loading from the new storage system (more about that later) is reduced to a “one liner”.

Is it hard to use?

Nope. In fact it’s even simpler to use than TClientDataset under Delphi (or more or less identical, except with no indexing just yet). Here is a short example of how to create a dataset, populate it and save it to a stream:

var
  mDataset: TW3Dataset;
  mData:  TStream;
  x:  Integer;
begin
  mDataset := TW3Dataset.create;
  try

    mDataset.FieldDefs.Add('id',ftAutoInc);
    mDataset.FieldDefs.add('name',ftString);
    mDataset.CreateDataset;

    for x:=1 to 1000 do
    begin
      mDataset.append;
      mDataset.Fields.FieldByName('name').AsString := 'Name #' + x.toString;
      mDataset.Post;
    end;

    mData := TMemoryStream.create;
    try
      mDataset.SaveToStream(mData);

      writeln('Dataset bytesize = ' + mData.size.toString);

    finally
      mData.free;
    end;

  finally
    mDataset.free;
  end;

As you can see from the code above some calculated field types are supported (Autoinc), and TW3Dataset is going to see some heavy expansion as it’s merged with my universal DB framework. Think FireDac but for the browser.

Other cool stuff

If TW3Dataset is to limited and you want SQL support, Smart Mobile Studio now ships with SQLite compiled for JavaScript. Yes you read right, SQlite has been compiled for JavaScript and reads, writes and generates identical files to the native SQLite versions. That’s pretty darn cool (although it does add 1 megabyte to your apps).

So in fact, you can now create and populate a full SQLite DB and just ship it to your server “as is”. Add encryption and you have a pretty good syncronization layer to play with.

W3C, WC3 or just WC

SQLite used to be built into modern browsers, then dubbed “WebSQL”; but in their infinite wisdom the W3C decided to deprecate that and go for a key-value pair storage system reminicient of MongoDB on wellfare. The good news is that our RTL is now so powerful that we dont need to care about the whims of the W3C any more. Just like Delphi revolutionized database driven desktop application development in the 90’s — we will revolutionize DB driven JavaScript applications for the modern age.

True binary streams? You got it! Compression routines ported directly from Delphi? No problem. In-memory databases? Yup!

Websockets made human

Websocket, oh what a magical buzzword! With all the hype you should think it was black magic. Well our SmartCL.Inet unit has now been expanded with a very cool WebSocket client. This means that if you want to talk directly with a nodeJS installation, or perhaps even better — write your own websocket server and get into Amazon cloud services for next to nothing, the RTL now makes that possible.

Writing a websocket client is now reduced to:

  FSocket.Connect("wss://echo.websocket.org",[]);
  FSocket.OnOpen:=Procedure (Sender:TW3WebSocket)
    begin
      writeln("Socket connected");
      Sender.Write("Rock it with HTML5 WebSocket");
    end;
  FSocket.OnClosed:=procedure (Sender:TW3WebSocket)
    begin
      Writeln("Socket disconnected");
    end;
  FSocket.OnMessage:=Procedure (Sender:TW3WebSocket;Data:String)
    begin
      Writeln("Data received:" + Data);
    end;
  FSocket.OnError:=Procedure (Sender:TW3WebSocket)
    begin
      writeln("Socket has errors");
    end;

File storage for the rest of us

Sandboxed files and JavaScript is a complete mess. JavaScript is utterly event driven, wich means that everything requires callback handlers. From accessing a medium, to being allowed said access to creating a writer and finally do the actual writing (phew!). And each event handler must denote the calling context just for the hell of it.

To make this usable by human beings, the RTL introduces a concept called “file-actions”. They work more or less like TAction under Delphi, but are especially tailored for loading and saving data in a uniform way.

Here is an example of saving and then loading back a small file:

procedure TForm1.W3Button4Click(Sender: TObject);
var
  mAction:  TFileActivitySave;
begin
  mAction:=TFileActivitySave.Create;
  mAction.FileName:="document.txt";
  mAction.FileMode:=fmPermanent;
  mAction.OnExecute:=procedure (sender:Tobject)
    begin
      writeln("Saving done");
      var mLoader:=TFileActivityLoad.Create;
      mLoader.FileData:=TMemoryStream.Create;
      mLoader.FileName:='document.txt';
      mLoader.FileMode:=fmPermanent;
      mLoader.OnExecute:=Procedure (sender:TObject)
        begin
          writeln("Loading done!");
          writeln("Bytes ready = " + mLoader.FileData.Size.tostring);
          try
            var mReader:=TReader.Create(mLoader.FileData);
            writeln(mReader.ReadString);
          except
            on e: exception do
            writeln(e.message);
          end;
        end;
      mLoader.Execute;
    end;
  mAction.FileData:=TMemoryStream.Create;
  var mTemp:=TWriter.Create(mAction.FileData);
  mTemp.WriteString("This is some data");
  mAction.Execute;
end;

As you begin to explore the additions to the RTL in the next release, you will find that a lot of time and effort has gone into this. So I hope everyone get’s excited when they what they can now do — and that object pascal is the perfect language for HTML5 and mobile application development!

Hire a Delphi superhero!

May 18, 2015 2 comments

This is your chance to hire a Delphi super-hero, namely me! That’s right, I’m presently in the market for a new full-time job!

Note: if you need people for a short project then I personally must decline, but I can forward your position at Delphi Developer (4.000 Delphi developers) and here on my website (average of 15.000 visitors per month)

I must underline the obvious, namely that I live in Norway with no intention of moving. However, I have a fully established office which has been used for three consecutive years. So I am used to working remotely, communicating through Skype, Messenger, Google Meetup’s and similar utilities. This has worked brilliantly so far. Full time employment over the internet is finally a reality.

For Norwegian companies I can offer 50% commuting (100% in Vestfold) from Oslo to Akershus in the north, to Sandefjord and Larvik in the south. The reason I can only offer 50% is because I have custody for two children every other week, which means I am unable to drive long distances in combination with school and similar factors.

You need an awesome Delphi developer? Then I'm you man!

Jon Lennart Aasenden, 41 years old senior software engineer using Delphi

My experience is too long to list here, but if you are in the market for a dedicated software engineer then you have come to the right place. Simply drop me a line on e-mail (address at the end of this post) and I will get back to you with a full resume ASAP.

In short: I have worked with Delphi for 15 years, I am the author of Smart Mobile Studio and wrote the VJL (run-time library, similar to VCL) from scratch. I have worked for some of the biggest companies in Norway. I have good papers, excellent reputation and is recognized for my skill, positive attitude and “yes we can” mentality.

Before my 15 years of Delphi I spent roughly the same amount of time programming games, multimedia and contributing to the demo scene. In my view, demo programming is one of the most rewarding intellectual exercises you can engage in. It teaches you how to think and prepares you for “real life solutions” as a professional.

In my career as a Delphi developer I have written several commercial products; ranging from a complete invoice and credit management application, games and multimedia products, serial management components for Delphi, backup clients and much, much more.

No matter what your company works with, as long as it’s Delphi I’m the right man for the job.

My kind of job

It goes without saying that I am looking for a purely Delphi centric position. Although I have worked with C++ and C# and have no problems navigating and adding to such a codebase — there can be no doubt that Delphi is the environment where I excel at my work.

I bring with me a solid insight into HTML5/JavaScript and am willing to teach and educate your existing staff in Smart Mobile Studio, which I am also the founder and inventor of; bringing your team up to speed with the next step in computing: namely distributed cloud computing. At which JavaScript and Object Pascal play central roles.

Torro Invoice

Torro Invoice

So if you are moving towards cloud computing or want to leverage the cloud for service oriented architectures using RPC or REST servers, I am the guy you want to talk to. Especially if you want to use object pascal and leverage nodeJS, JavaScript and the whole spectrum of mobile devices. In short, with me on your team you will have a huge advantage.

What you get is 15 years of Delphi experience; and before that, 15 years of software authoring, demo and game development on 16 bit machines.

Good qualities

I have included a small list of “ad-hoc” qualifications. The list below does not serve as anything other than indicators. I have been a professional programmer for many, many years and to list every single piece of technology is pointless. But hopefully the list is enough to give you an idea of my qualifications, depth and diversity.

  1. Write custom Delphi controls and UI widgets
  2. Create control packages and resource management for our projects
  3. Optimize procedures by hand by refactoring variables, parameters and datatypes.
  4. Write a database engine from scratch and also use existing engines such as Elevatedb, MSSQL, Oracle, Firebird, SQLite and MySQL
  5. Work with Windows API directly
  6. Work with freepascal and port code to Linux and Macintosh
  7. Write networking libraries, custom protocols and high-speed multithreaded servers
  8. Use classical frameworks like Indy, Internet Direct and other out of box solutions
  9. Write advanced parsers for source-code and any complex text-format
  10. Write a real-life compiler and IDE (www.smartmobilestudio.com and quartexpascal.wordpress.com)
  11. Create a graphics library from scratch, supporting different pixel formats
  12. Work with large files, performing complex operations on gigabytes and terabytes
  13. Write mobile and desktop applications using Smart Mobile Studio and FireMonkey
  14. Create your server environment, architect your RPC (remote procedure call) service infrastructure
  15. Implement custom services through nodeJS, Smart Mobile Studio, Delphi and FreePascal
  16. Use Remobjects product line: such as RemObjects SDK, Hydra and Data-abstract
  17. Link with C and C++ object files
  18. Use project management tools, scrum, SVN, github and package management
  19. Write, export and import DLL files; both written in and imported to Delphi
  20. Write solid architectures using moderns technologies: xsl schemas, stylesheet validation, rest, node services

.. and much, much more!

Note: While you may not have a need for all of these qualifications (or any one of them), the understanding which the listed topics demand that I master is of great value to you as an employer. The more knowledge and hands-on experience a programmer can offer, the better qualified he is to deal with real-life problems.

Tools of the trade

All programmers have a toolbox with frameworks, code collections or third party components they use. These are the products I always try to use in projects. I have a huge library of components I have bought over the years, and I have no problem getting to know whatever toolkit you prefer. Below is a short list of my favorite tools, things I always carry with me to work.

  • RemObjects SDK to isolate business logic in RPC servers, this allows us to use the same back-end for both desktop, mobile and html5 javascript.
  • RemObject Data Abstract
  • Remobjects Hydra
  • ElevateDB and DBIsam (DBIsam for Delphi 7-2010, ElevateDB for the rest)
  • Developer Express component suite
  • TMS Aurelius database framework
  • MyDac – MySQL data access components
  • MSDac – Microsoft SQL server data access components
  • Raize component suite
  • FreePascal and Lazarus for OS X and Linux services
  • Mono/C# when customers demands it (or Visual Studio)
  • Firemonkey when that is in demand
  • Smart Mobile Studio for mobile applications, cloud services [nodejs] and HTML5/Web

Tools and utilities

  • Beyond compare (compare versions of the same file)
  • Total commander (excellent search inside files in a directory, recursive)
  • DBGen – A program written by me for turning Interbase/firebird databases into classes. Essentially my twist on Aurelius from TMS, except here you generate fixed classes in XML Data Mapping style.

Note: For large projects which needs customization I tend to write tools and converters myself. The DBgen tool was created when I worked at a company which used Firebird. They had two people who hand wrote wrapper classes for nearly 100 tables (!) They had used almost two months and covered about half. I wrote the generator in two days and it generates perfect wrappers for all tables in less than 10 minutes.

Safety first

As a father of three I am only interested in stable, long-term employments. Quick projects (unless we are talking six figures) are of no interest, nor do I want to work for startup groups or kickstarters. I am quite frankly not in a position to take risks; children comes first.

many of my products are available for purchase online

Many of my products are available for purchase online

I am used to working from my own office. I was initially skeptical to that, but it has turned out to work brilliantly. I am always available (within working hours Norwegian time) on Skype, Google, Messenger and phone.

Languages work format

For the past year I have been working full time with C# under Microsoft Visual Studio. Before that I used Mono for about four months, which I must admit I prefer over Visual Studio, and wrote a few iPhone and iPad apps. So I am not a complete stranger to C# or other popular languages. But as I have underlined in my posts on countless occations – object pascal is a better language. It is truly sad that Borland was brought down all those years ago, because with them they dragged what must be one of the most profound and influential languages of our time.

That said, I have no scruples about mixing and matching languages. Be it Remobjects Oxygene, C#, C++ or Object Pascal. I also do some mocking in BlitzBasic which is without question the fastest (execution wise) of the bunch, but not really suitable for enterprise level applications.

The point here being that I am versatile, prepared to learn new things and not afraid to ask. It would be a miracle if a man could walk through life without learning something new, so it’s important to show respect and be remain humble. Different languages represents different approaches to problem solving, and that is an important aspect of what it means to be a programmer.

The only thing I ask is that I am properly informed regarding the language you expect me to deliver in – and that I receive the required training or courseware in due time. Do not expect super-hero status in C#, I am absolutely above average, but it cannot be compared to my efficiency and excellence using Delphi.

Contact

If you are interested in hiring me for your company, then don’t hesitate to contact me for a resume. You may e-mail me at lennart.aasenden AT gmail dot com.

Angular? Nothing new under the sun

May 14, 2015 3 comments

In a previous post I sort of slaughtered Angular.js and Bootstrap. Partly because these libraries represent “a prototypical solution to the lack of classes, inheritance and a VMT”. My point was simply that if you sat down to program Angular in Smart Pascal or Delphi, you would use ordinary inheritance to solve many of the more tricky subjects angular imposes on us.

And in so doing, no one would bat an eyelid – nor would it be hyped to the point where people believe they can cure cancer with it. It would just be another MVC framework, one among thousands. But since Google made it and spontaneously throws a few workshops around it – people go nuts and imagine that it’s just so much better than anything else out there.

Ladies and gentlemen, that is just sad, disappointing and intellectually disturbing. As a result I no longer believe our species will ever reach the stars, quite simply because the wast majority of our human population are indistinguishable from cattle.

Apple made MVC hot again, but it's an old re-hash from yonder days

Apple made MVC hot again, but it’s really a re-hash from ‘yonder days

Now the blogging I do here can only be one or the other: either a short post (like this one) or a long, more detailed post. It depends on how much time I have and how interesting the topic is. But it’s rare that I post a medium-sized article. I mention this because I have gotten feedback like “Oh you have completely misunderstood MVC” — which is simply not true. In fact I work with angular on a daily basis at work.

But that doesn’t mean I will publish a dissertation on the subject just to underline that I do have experience with MVC. Readers of my blog will know that I’m not a proud individual. If I have done wrong, said wrong or coded wrong I have no problem saying I’m sorry. It is after all impossible to go through life without making mistakes. So if I came across as just shooting things because “I don’t like them” mentality, that was not what I meant; What I meant is that I don’t like them because-of a wide range of valid reasons.

That’s why I cut the MVC criticism short because (quite frankly) I thought my issues would be common knowledge. Clearly they are not so I will try to bring more light to the subject in this post.

MVC is hardly new tech

MVC is not new. It’s bloody ancient and it tends to arise and appear towards the height of a platform’s popularity. So if nothing else it’s a clear indicator that right now JavaScript and HTML5 is at its height, and in the years to come we will see a steady decline in the way we use this technology. The timeframe coincides with the emergence of the next level in computing: namely the cloud and it’s potential.

So for those that believe MVC is something new and fresh – compared to Delphi which is termed old and useless, think again. First of all the oldest programming language still alive in the world is C, which is around six years older than pascal (just to kill that misconception if you suffer from it). MVC is not as old as that, but it’s pretty damn vintage! I remember doing MVC coding on the 16-bit Amiga computer some 25 years ago.

A huge selection of the OS can be automated through AREXX

A huge selection of the OS can be automated through AREXX

One of the lesser known aspects of Amiga OS today is the fact that it came with a built-in automation system called AREXX. It was absolutely brilliant. What programmers did was to define and register AREXX ports in their native applications. These ports worked a lot like socket’s do, in that you can send and receive messages on them. Once exported, which was done by calling the OS informing it about the functions you made publicly available, these functions could be automated and called from any AREXX script.

So what people did was to design the view using a MUI editor (magic user interface), write an application controller and essentially create existing OS level controllers and classes to create an application. Whenever you needed something special you would just import the functionality of a commercial program and use those functions to do your work.

  • Write application controller using AREXX
  • Design views using a MUI (magic user interface) designer
  • Create and maintain OS level objects and controllers
  • Maintain a persistent data model, similar to COM’s property-bag
Listing REXX exported controller ports under Amiga OS

Listing REXX exported controller ports under Amiga OS

Even seemingly new techniques like “MVB”, where you bind or link visual elements to a property in the model could be achieved. In fact on the Amiga you could create fully working, complex and advanced applications using nothing but AREXX scripting. So for those of you that believe the MVC pattern is new and fresh of the mint, sorry to burst your bubble but it’s most likely older than you.

Remember that myself and hundreds of thousands of others were using this more than a decade before Microsoft Windows was even conceived of. I remember bursting out in laughter when Apple introduced their “Automator” script system back in the day. Why? Because the Amiga has that 25 years ago! And it get’s better because in january (I think it was) Apple announced that OS X was now the pinnacle of operative systems, because now they supported REXX scripting (!)

You know what? For ages now people have blamed Microsoft for ripping off Apple’s ideas. But guess what, most of them didn’t come from Apple, but from a kick-ass 16 bit operative system and computer, 15 years ahead of the competition back in the early 80’s.

So Apple have (and there is no doubt here, they have even admitted it from time to time) robbed Commodore Amiga blind. And the fact that they are still lifting good ideas from a 30 year old operative system speaks volumes both about the Amiga and those out to duplicate its technology.

The bright side of MVC

We are all adults here and I take for granted that you have enough life experience to recognize that everything has dark side. It doesn’t matter what it is, there is always some side-effect or “potential for error” or risk assessment where an otherwise brilliant technology yields nothing but disaster. This is true for Delphi’s CCV (class, component, view) pattern, model view controller and dot net’s distributed assembly model. Take your pick, there is no universal technique which works everywhere without flaw, side-effect or zero potentiality for error.

Now the bright side of MVC is fairly easy to spot:

  • If architected with care, the same controller can be used on different views
  • Writing plugins or extending a MVC based framework can be fragmented
  • Under HTML/JS an application appears as a single document, but is in fact rendered by a route manager

If we have a look at these you will notice just like me, that the first one sort of comes naturally.  Right? I mean it’s not an “aha” moment you read here for the first time and just go “Oh my god I never thought about that before”.

The second point is likewise an immediate factoid that you locate if you spend 2-3 minutes thinking about how a 3 partite organized framework must look like. And the last point is cool but ultimately easy to achieve no matter what language, technique or pattern you subscribe to.

MVC applications quickly become a mess to work with

MVC applications quickly become a mess to work with, remember to be nazi at organizing

If I was to point out something positive about MVC, it would have to be the first point on the list, namely that if you carefully architect your controller – it can be used on multiple layout views. So a typical example of something “neat” is exactly that: when you have a website that supports both desktop and mobile devices.

The mobile layout will in the best of cases have the same elements but organized differently. Worst case scenario is when mobile and desktop views use different model fields, forcing your response controller to include logic which MVC was designed to avoid. But in general angular.js is brilliant at bringing this to the world of JavaScript, because it does make things easier for JavaScript developers.

Again, angular is just fantastic for programmers with no knowledge of true object-oriented programming. If all you know is JavaScript then odds are you wont be able to recognize “real” stuff. Your mind would simply exclude it as un-important because it’s alien to you.

Do a quick google on javascript 10kb demos and you will find hundreds of superb graphically demonstrations written in JavaScript. But I can tell you right now that nearly none of those demos are written by a programmer that only know and work with JavaScript. These are old coders like myself with a background in hacker groups, demo and intro programming – and they have been doing this for 30+ years.

The dark side of MVC

The downside of MVC, is that your views can (depending on the framework you use) have something like 30 to 100 controllers running at any given time. Apple is positively criminal when it comes to this. It’s common that a single form design, although a complex one, spawn’s as many as 100 controllers when pushed onto the display.

Why? Because a controller is not the same as “the form resize code”. Oh no, a controller can be anything from watching that you prefix text with a $ character, a routine which keeps track of an application state – to making sure a control horizontally stretch to match its neighbors. A controller is just a piece of code responsible for a single behavior; or better yet – a method which ensures a distinct type of behavior. It all depends on subject, object and toolkit.

Incidentally, this is why Java and C# programmers are so hopelessly dependent on garbage collection. Can you imagine working on a huge MVC iPad project where every single view has between 30 to 100 controllers? This means that every element has controllers taking care of scaling, rotation, movement, fading, projection, touch, routes and cross-view event delegation (phew!). And it’s recursive to you know, hosted user-controls are likewise MVC based! Not exactly an eco friendly, resource moderate technology is it? Not to mention the waste of CPU power just because of a damn coding practice.

Now apply that mess to a single threaded event based runtime engine and try catching an exception induced through an anonymous timer. That’s when the regret of chosing angular over object pascal hit’s you like a ton of bricks and you whole heartedly regret ditching a rock solid language and it’s super effective CCV pattern.

The human factor

By now you probably get that my problem with angular, jquery, bootstrap and it’s likes is not superficial. It’s not based on a whim or defined by something stupid like fanboy-ism. Quite the opposite. In my line of work you have to know several programming languages if you expect to survive. My favorite language is object pascal, everyone knows that, but all languages and techniques, patterns and practices have strength and weaknesses. And it’s your profession to pick the right tool for a job.

So for me personally as well as professionally, a programming language is just a vehicle for my experience. You can’t expect to use the same tool to fix every single problem. Although I must admit that Delphi and Smart Mobile Studio combined is akin to a proverbial swiss army sword.

Bigger the projects, wider the toolbox

Bigger the projects, wider the toolbox

So angular is fantastic if all you know is javascript. But if you come from a more classical background, like Delphi or C++ then angular will soon get on your nerves. Because after a little while you realize that most of the blubber posing as high-tech stocking fillers – exists primarily due to the lack of OOP. It represents the author’s means to overcome, bypass and make up for the fact that javascript is prototypical, not object oriented.

MVC delivers no true benefit over ordinary object pascal’s CCV (or C++ builder, or even C# for that matter). In Delphi everything angular represents (and jquery + bootstrap) would be solved far more elegantly using nothing but vanilla inheritance.

Take something simple, like using the same controller on two different views:

type

TMyView = Class(TCustomForm)
public
  procedure SomeControlOperation;virtual;abstract;
  procedure SomeOtherControlOperation;virtual;abstract;
end;

// Our mobile "view" takes care of the mobile displays
TMyViewMobile = Class(TMyView)
public
  //Layout and operations for mobile views
  procedure SomeControlOperation;override;
  procedure SomeOtherControlOperation;override;
end;

// Our desktop "view" takes care of larger displays
TMyViewDesktop = class(TMyView)
public
  //Layout and operations implemented for desktop displays
  procedure SomeControlOperation;override;
  procedure SomeOtherControlOperation;override;
end;

In the above example we isolate our API, which essentially act as our controller, as purely abstract methods in our ancestor class. We then derive and derive two separate variations, one for mobile and one for desktop. Each of these implement their kind of layout according to the rules we impose in our API (the public procedures).
Since this example only have two elements to support (desktop and mobile) it would be better to implement the desktop behavior directly in the root-ancestor (TMyView) and have TMyViewMobile override that for mobile devices. If nothing else than to keep our code tidy and neat.

Not a controller in sight, but easy to use, deploy and debug

Not a controller in sight, but easy to use, deploy and debug

What I have objected to about angular (et al) is this popular but certainly false notion that MVC produces better, faster, easier or cleaner results than the above. In fact the result would be exactly the same. I would also go so far as to say that using inheritance is cleaner and provides a human bonus: namely better organization. We don’t have to use X number of folders to organize views, controllers and model schemas – because they all make up 3 parts of a common whole. Why write 3 times as much code for absolutely no reason other than pretending to be cool?

So this popular notion that object pascal is old, ancient or past it’s expiration date (comparing to MVC) is simply not true. The entire misconception is based on ignorance and laziness, plain and simple. And how can I propose that? Because there is no technical benefit of choosing MVC over a traditional CCV object orientation. People chose the hyped re-hash because it’s easy, not because it’s technically excellent, faster, yields better results or any of those superlatives.

Just remember: with great simplicity emerges an even greater lack of diversity!

Aros, winner of most interesting OS

May 12, 2015 1 comment

Right. As most readers know by now – once a year I get this unstoppable desire to check out all things alternative in the realm of operative systems. I mean, it’s important to stay on top of our game as developers, and the only way to do that is to make an effort. In this case an effort to look at upcoming systems which may become our own sometime in the future.

And as always one of the criteria is (drumroll) that they should support Object Pascal.

The AROS operative system

Aros desktop, not exactly graphically impaired

Aros desktop, not exactly graphically impaired

Now this year’s winner of “most interesting and promising operative system” must be Aros. It’s a fantastic little OS with plenty of features, and almost as interesting as the operative system itself is it’s exciting and rich background. How do you know that users love their OS? When they decide to reverse engineer it from scratch after the owner goes belly-up, just to make sure it survives (!).

Yes, that was the case with Aros; It’s actually an old-timer in the group of “new operative systems” because Aros is short for “Amiga research operative system”. Yes you read right, Amiga, as in the 1983-2001 prodigy home computer. Odds are that you owned one of these machines in your teens or at least heard of it, and if that is the case then you most likely remember Amiga OS. This was a wonderful operative system lightyears ahead of it’s time. It actually was technically superior to Microsoft, IBM and all the other players back then with around 12 years. That it’s potential was never realized ultimately came down to some spectacularly bad business decisions at Commodore. Never let people who cant code run a computer company.

For my part I remember Amiga OS vividly. My best friend at the time owned an IBM PC and while he was stuck in DOS playing Larry Leasure suite, I was doing things he could only dream about under Amiga OS. I actually learned all my programming skills on the Amiga, so I was an above and beyond fan of the system throughout my teens and well into college.

It was only when Windows 95 came along with it’s fancy new driver system, fast graphics processor and soundblaster cards that the tables were turned. But for roughly 13 years (in Norway at least) the Commodore Amiga was the undisputed champion; both operative-system wise and game/multimedia wise. It was cheap, efficient and the #1 creativity machine. In fact Apple only recently implemented support for REXX which is a scripting system Amiga OS supported from 1990 and beyond (version 1.3 of the software). That speaks volumes about how far ahead Commodore was.

Ok, but what can Aros offer?

Classic Amiga OS version 4

Classic Amiga OS version 4

If you are expecting a boring, grey desktop and faithful reproduction of the early 90’s then no, that is not what Aros is about. Aros is reverse engineered from the Commodore Amiga OS formula; based on available API documentation. As such it’s designed to be compatible on API level, not binary compatible with ancient 16 bit software. In short this means that you can take an Amiga C source-code for instance and re-compile it to run under Aros. But Aros really represents something much more valuable than retro flirting: It represents an actual future for an OS which delivered multitasking a desktop environment 10 years before Windows 3.11 was invented.

The reason Amiga OS has survived all these years is because it’s underlying architecture is brilliant. The way drivers work, the layout of the file-system, how libraries are loaded, how memory is managed, how multi-tasking is solved — all of these things are dealt with in a way which makes for a fast, responsive and highly enjoyable user experience.

It’s not like Windows where evolution meant patch after patch after patch. Amiga OS was designed to avoid bloat. It was designed to deal with libraries and extensions gracefully and intelligently. It was designed to boot fast, respond fast and deliver maximum performance with ridicules sparse resources. Amiga OS boots happily into as little as 4 megabytes of RAM. Yes you read right, four megabytes (not gigabytes). And the speed is phenomenal, you wont believe it until you try it.

Aros is absurdly fast

Aros is absurdly fast

So, with Commodore long gone and the copyright holders showing no interest in doing anything with the Amiga brand, Aros is ultimately the last hope of a realization of this 30 year old dream. A dream of a small, compact, fast and “no bloat” operative system performing miracles from pennies and scraps of ram and CPU. And it works brilliantly. The formula which Carl Sassenracht (the authorof large parts of the OS) deviced all those years ago has proven to be the software equivilent of the ARM processor. ARM was likewise an “old timer” technology until recently. It was almost shelved and taken off the market, it was just by accident that they discovered that the ARM architecture could run just as efficient on low-voltage as it did on “ordinary” power. Had it not been for that economic feature, ARM RISC cpu’s would be a thing of the past.

The Amiga is just like that. An older formula and architecture of an operative system, but one which delivers so much computing power with absurdly few resources. Imagine what Aros can be with a few years of development behind it, and perhaps a couple of hundred programmers?

Have you ever wondered just how fast your PC really is? Imagine how fast Windows would be if it was hand-coded in object pascal and assembler. Not a single procedure wasted and no bloat what so ever. Well with Aros you will find out, or at least as close as you can get. Aros is written in C/C++ (like most operative systems), but the architecture and philosophy ensures that it remains small, efficient and lean. My Aros PC boots in around 3 seconds from powering it on until I can use the desktop. And this is on older hardware (my test machine was a 8 year old dual-core system with 4 gigabytes ram). The desktop is snappy and things like moving windows around, playing video — it’s so bloody fast you will hardly believe it.

To be honest, if Aros keeps this up it will turn into a money saver. Windows and Linux has gained weight over the years, both in complexity and media integration. Aros represents in many ways a clean start, a start with a vision which is now 30 years old. A dream of an OS so lightweight, elegant and easy to use that it makes computing fun again. An OS where efficiency matters and everyone tries to tweak the last drop of CPU out of their code. A system where code is regarded as a work of art.

What about software?

This is why I have given Aros a Mickey rating (both winner and loser), because software will always be a new operating system’s achilles heel. But it’s really not as bad as you think. It’s millions of miles beyond obscure systems like Risc OS (recently re-surfacing and enjoying a renaissance on the Raspberry PI). Why? Well, first of all the Aros authors have provided tools for porting from Linux free for all. Secondly, they have made a few extra libraries to facilitate porting to the platform — and third, because Aros can run 68k (Motorola 68000 CPU) based software!

Loads of juicy titles for Aros, but more is needed

Loads of juicy titles for Aros, but more is needed

That’s right, Aros is capable of running almost all classic 16 bit Amiga software through UAE integration. And believe you me, 20 years of coding makes for a rich and mighty collection of software titles. But yes, this large resovare of software is older. So if you are expecting Adobe dreamweaver, mono developer or Photoshop — that’s not going to happen any-time soon.

But if you can live with The Gimp, like millions of Linux users do — then you will find Aros well stocked in the graphics department.

Software development

And now for the biggie. Does Aros support object pascal? That is the mother of all questions isnt it, at least for us Delphi, SMS and FPC developers. There is no point using a platform we cant program for right?

Well I am pleased to say that Aros does support object pascal and there is a full port of freepascal for the platform (!)

Lazarus is still being ported, so it's not quite ready

Lazarus is still being ported, so it’s not quite ready

It must be underlined that Lazarus is still being ported (!), only FPC is ready out of the box, but lazarus will be excellent on this platform! Lazarus feels more at home with Linux due to it’s multi-window layout. Well, Aros is based on Amiga OS which means you can run applications in their own separate screen. And in such an environment Lazarus really comes into it’s own. It’s the undisputed king on Linux, making mono/C# look like a sad toy in comparison.

Using Aros as a real desktop

Before you sell your house and donate your mother to science, you should give Aros a proper test-drive. You dont want to wipe you Windows installation without really knowing what you get. I recommend installing Aros into a VMWare image first (or some other x86 free emulator from Sun) just to get to know it properly. Remember to create two partitions, one boot and one work (larger). This is more or less traditional for Amiga systems.

Is it ready to be the default desktop? Soon

Is it ready to be the default desktop? Soon

To get a hold of software you point your browser at Aminet, which is the #1 source of 68k and more modern software. There you will find classic stuff like PPaint, Deluxe Paint and ofcourse, freepascal. Exploring the Aros website is also a good idea.

Like all small communities (just like the Delphi community) there are forums you can become a member of. This is perhaps a good start so you have someone to ask and help you out. But Aros / Amiga OS is so much simpler than any OS you have tried to date, so once you “get it” you will be able to navigate most of it without help.

Entering a platform with a bang

The utter upside of any platform is that there will be a huge demand for software. In fact, the worst platforms to create software for is in many ways Windows and OS X, because there you will find hundreds of different alternatives doing the same thing.

On a new, fresh OS the competition will be weaker and you stand a good chance of making some cach once the user-base has brown beyond 10.000. I have no idea how big the Aros world is, but I do know there are at least 10.000 Amiga users in the world, be they retro-gamers or die-hard Amigans. The Amiga is actually a phenomenon. It’s 30 years since it was created this summer; and it went out of production around 1999 (Commodore filed for bankryptsy in 1994, but the license to produce and sell Amiga lingered on for many years). Yet still there is a living market for these machines. These are 30 year old computers running at 7 Mhz (not Ghz, but Mhz), yet people love them to death and still use them in their thousands!

It's an impressive feat, remember this is a user project!

It’s an impressive feat, remember this is a user project!

It should be mentioned that a CPU frequency comparison really means little for the Amiga. It has a set of custom chips dealing with memory copying, pixel moving and everything else. Also the motorola CPU is very different and can do a lot of stuff intel cant with few instructions.

The Amiga was ultiately beaten technically by the lack of single-datatype pixels (e.g: 1 byte for 8bit, 2 bytes for 15/16 bit, 3 bytes for 24 bits and 4 bytes for 32 bit graphics) like the PC have. The Amiga had something called inter-leaved graphics which means a single picture is divided into X layers at different places in memory. For a 32 color display you actually have to write to 5 different memory addresses to set a single pixel (!)

In short, the Amiga has to work 5 times as hard to deliver the same as a PC. Yet you will see these old Amiga computers knock out effects and demos which are en-par with modern PC demos. It really is a strange and mysterious social phenomenon, shrouded in mystery and lore — the platform just wont die! It’s almost ridicules how much beating this system takes, yet there it stands — a reminder of what could have been. An alternative reality which could have been ours where operating systems were light, fast and fun – as opposed to big, bloated and expensive.

Freepascal on Aros

One of the things I love about object pascal no matter the dialect, is that just like the Amiga – object pascal is a language which just wont go away. People have been predicting the downfall of object pascal for decades now, yet object pascal is still highly popular and very much in demand around the world. And just like the Aros team reversed engineered Amiga OS from scratch, so did the FPC and Lazarus team do with Delphi. They cloned a free, open-source version of a language and development platform they loved – to ensure that it would survive regardless of it’s legal owner’s whims.

Older freepascal running under AROS

Older freepascal running under AROS

The result today is that object pascal has a huge, staggering, overwhelming public domain library of source code. You will find units and libraries for just about every conceivable topic. From super-fast games to serious and excellent tools — object pascal have it all.

This means that with a bit of porting work, replacing OS calls where possible – or re-implementing stuff in pure object pascal, thousands of titles could be implemented with ease on the Aros platform. A person with skill and a bit of time on his/her hands can really make a nice bit of money here, by charging a small fee for each program and being honest and give support, the Aros platform would grow rapidly — and your income with it.

Final verdict

Hm. This is always the tricky part.

Aros is slowly becoming a complete desktop environment. I think it’s important to separate OS from desktop, because they are essentially two different things. The OS is what makes a desktop possible, what makes windowing possible, what makes everything possible. A desktop is the human interface into those features- typically provided through default programs and behavior.

Aros is, shortly said, a pretty faithful re-implementation of Amiga OS. But it has evolved away from the old Amiga look and feel (thankfully). But while the underlying OS is no doubt up for the challenge, the desktop experience and default software doesnt quite impress. At least not users who havent started an Amiga in 20 years, or people who have never used an Amiga at all.

Having said that Aros is “almost there”. It’s missing a few minor applications which will add the final touches, but most of all it’s missing that “killer application” to make it popular. For Microsoft it was Word that started it all, for Mac it was no doubt Photoshop, Logic and pro-tools (counting from when Steve Jobs came back up until now), followed by the “family package” which is iMovie, iTunes, iThis and iThat. You get fantastic apps with your mac and that draws customers in.

What Aros really needs is a fantastic software package which only exists on that platform. What exactly that should be I leave to you, the reader. As object pascal programmers and armed with the might and onslaught of our collective source-code repositories, I have no doubt what so ever that it can be object pascal that delivers this — but it will require hard work, dedication and a vision.

If Linux is not your thing — head over to The AROS website and have a look — and yes, it’s free (!)

The art of pissing people off

May 8, 2015 Leave a comment
To provoke is a part of self-examination, education and growth

To provoke is a part of self-examination, education and growth

Ok, I admit it. Part of writing a blog is to be informative, helpful and the whole good guy thing. But another just as important part is to challenge stereotyping, old ideas, new ideas and to basically be a profiled prick. And I admit it, I am exceptionally good at pissing people off — but at the same time I force people to re-evaluate their ideals, tendencies and patterns.

Over the past four years I have pretty much done it all. I have dizzed Delphi on numerous occasions, not because I mean every word of what I wrote (well, the XML mapper is dying for attention, that I meant) but because the only way to create life is to break apart the old, stagnant constructs that is holding an otherwise brilliant technology back.

And look at all we have achieved!

Hate me, love me, It really doesn’t matter. You can hardly say that the Delphi community would be the same without that hyper-active Norwegian who cuts straight to the chase, taking no prisoners and churns out a fair load of code month after month. I even taught Delphi for free in my local community for over 2 years just to make sure I had done everything I could to protect my job and skill-set.

I have been yelled at, thrash talked on forums I never even knew existed, a guy even tried to knock me down once in Oslo after a Delphi meetup (boy was he surprised, I did thaiboxing for 10 years and still remember a few tricks *smile*). I have gotten letters telling me in exquisite detail how utterly retarded I am, but also letters thanking me for helping, creating or solving problems they have struggled with.

I helped this kid in India who could not afford Delphi, so I gave him a copy of Smart Mobile Studio professional. I got a warm letter from his mother thanking me, because using SMS he had got enough object pascal skill to be accepted to the schools computer group. Meaning he would have access to Delphi 2 days a week. And if he works hard he can become a developer as an adult.

You cant put a price on letters like that, it makes you humble. And if everyone in the Delphi community cared enough about our language, our skill-set and the work we do – and help out more, we would have secured our jobs and technical skill for decades to come. I dont make a dime on what I do — I do it because I genuinely care about programming. Programming teaches you to think and to see the world. Cause and effect, potentialities, abstract constructs — the things that makes a mind sharp, insightful and inquisitive.

What better legacy to leave for the next generation of coders? Take responsibility for your profession, because no-one else will.

Paying the devils dues

So do I piss off people on purpose? No, of course not. No sane human being sits down intentionally and plans what to put in a blog. People that insane are usually patients or politicians. No, I tend to wing it as I see it. And I get a lot of things wrong too; Although I tend to get more right than wrongs. Especially when it comes to programming and movements / tendencies in the market.

Lately, especially with the whole freepascal/lazarus thing going on, I just wanted to put this out there. I’m not intentionally out to get anyone or to cause problems “just for the hell of it”. I actually never saw that one coming at all. Which is a shame because had I been prepared I would have served up some cool jokes. It would have been an awesome show. But alas, I was not prepared and hey– i’m only human (well, sort of).

So my stance on blogging goes a bit deeper than just churning out the same boring, superficial crap like everyone else. I dont know, perhaps something stuck with me from art class in my teens, where dialog, free press, the art of writing and human expression was still important.

In other words – If you are going to write, no matter what it is, you are obligated to challenge yourself and others. Conflict is by nature unavoidable because each mind is an island onto itself. It’s impossible to go through life without meeting, eventually, someone who just doesn’t like you. Without any valid cause at all. They just don’t like YOU. And I’m good with that because it goes both ways. It’s fantastic!

But to challenge ideas is important. It’s important because a living, breathing entity – be it a social structure, a metaphysical structure (programming for instance) or a mechanical structure, must be in movement at all times. If death have a property it is the lack of activity and movement. So a dead programming language is one that doesn’t change, that remains static – immutable and unchallenged from cradle to grave.

I kinda enjoy being the devil in the deck. People think the worst of the devil, but they don’t realize just how important his role is in the grand scheme of things. Without the devil there would be no fall from grace, no grace, no distinction, no value and  no peace; nothing to contrast happiness against – nor the notion of positive vs. negative.

Never take anything at face value

Never take anything at face value. Notice the balloon? *smile*

All communities, no matter if it’s programming, social groups and even families – needs a black sheep. A rouge which gives voice to things people would rather not talk about, forget or brush under the table. If there is an elephant in the room, trust the devil to point him out and question why people pretend they dont see it.

In modern society we tend to drug kids that do that, without understanding what a huge loss it is to society. We should be careful of throwing out the devil, because we might just throw out the best in us.

The devil is in the details

Shiva, unbound consciousness

Shiva, unbound consciousness

If all of that sounded a bit religious then relax, I’m not religious. I am a student of tantrika, which is a part of sanatana dharma (hindu esoteric tradition) and buddhism alike. My principal deity is Krishna; The thief, the rebel, the rouge, the best friend to arjun (the mind) who runs into battle to restore order. The maintainer of “that which is functional” in the universe. And my guardian deity is shiva.

Because when things get rough, its shiva the destroyer that swoops in and kicks-ass. And just like Krishna is a part of all human beings psyche, so is Shiva. Who do you think you are when anger takes you over?

And yes, these are psychological symbols which defines aspects of nature. And that includes human beings since we are after all products of nature.

Shiva is a very misunderstood archetype. He is called the destroyer, smears his body with ash from burned corpses, carries a trident — and hence people look at him as evil. But his role and function in nature is to challenge those who think they know it all, break apart structures that no longer serve humanity and ultimately make sure things “work”.

Without shiva, which is the root of the christian devil, there would be no creativity, no new inventions and all would be dull, dark and without life.

If that is to be my archetype in all of this, then so be it. I’m happy to play the devil of freepascal as they now call me; and my work will no doubt insult, scare, impress and help those that use them.

Speak of the devil

Just before we were about to release Smart Mobile Studio (alpha release) a few years back, an individual was so upset with me over that invention, that he actually called me and threatened me on the phone. That’s how protective people are about what they love and work with. That’s how dependent some people are on their habits, their knowledge and their self-image.

Kinda scary don’t you think? Bordering on mental if you ask me. And this is over programming. Not family, children, millions of dollars, your house or the death of a loved one — no, programming (!). Behind it all he was so scared that SMS would somehow kill Delphi as he knew it, that he would no doubt have physically attacked me if he could. People are strange when it comes to their world view. They will do almost anything to protect what they believe is “right” and fight with tooth and claw against “the wrong”.

Little did he know that my mission was not to destroy, but to strengthen object pascal and ensure that his knowledge and expertise would remain valuable and useful in the years to come.

And it has worked like a charm! In the UK kids are learning Smart Pascal thanks to the effort we made, both us on the SMS team and everyone who has helped make it a reality. So kids are growing up and will remember 50 years from now that they learned to program in Smart Mobile Studio. And that is valuable. That means something. And you cant create that without utterly smashing the ideas which no longer works or serve us poorly. And in doing so you will provoke people, like unwritten facts always do.

Devil or not, I am happy I’m not that shy, ego ridden critic that doesnt make a licking difference in his entire life. Death to me is to be stiff and motionless in your work and what you enjoy. To be so utterly boring that you never even speak up when gold is replaced with shit. And to blindly let 15 years of excellence and hard work just fade into oblivion. What did you do to help Delphi remain vibrant and relevant? People who criticize me should ask themselves that before they throw the first stone.

And if that makes me the devil of freepascal, the angry nerd of hades, the emir of forks (or whatever insane title they cook up this week) then I wear that title like a badge – with pride!

Because I did stuff they never dared to do; And brush shoulders with people they will only read about. So bite me.

“Here’s to the crazy ones. The misfits. The rebels. The troublemakers. The round pegs in the square holes. The ones who see things differently. They’re not fond of rules. And they have no respect for the status quo. You can quote them, disagree with them, glorify or vilify them. About the only thing you can’t do is ignore them. Because they change things. They push the human race forward. And while some may see them as the crazy ones, we see genius. Because the people who are crazy enough to think they can change the world, are the ones who do.”

Angular JS + BootStrap and why it’s all bull

May 6, 2015 10 comments
Hype is the number of the beast when it comes to development

Hype is the number of the beast when it comes to development

Web designers and web “architects” as they like to call themselves, are into bling. Their job is after all to help bussinesses sell whatever product they have; be it a perfectly valid product or a completely useless piece of droppings. But with a good designer at your disposal you can to some degree ensure your product will sell. At least at first. So when designers and bling-doctors set out to create their tools of the trade, it’s pretty much natural that they will make it look like the greatest thing since the discovery of the wheel. And people swallow it, hook line and sinker.

JQuery

Take JQuery for instance. It’s a simple little library to collection (query) information about the DOM (document object model). It allows you to set properties on collections rather than single items and it also have a handful of helper functions for effects, css and dealing with JSON and REST.

Eh.. no thanks!

Eh.. no thanks!

Yet when you read the documentation or hear people talk about it – it sounds so fantastic. You can cure cancer with JQuery, did you know that? It’s hype. It’s just spin and you should know that by now.

Angular.js

Angular is, seen from the JS developer’s viewpoint, a fantastic library. It allows you to define content in one place, controller code in another place and Angular gives you the tools to glue those two parts together. The controller is the part which has code, meaning that you access the controller to perform operations on the model (the data) – which is reflected in the view (the html). But wait just one minute! Havent we heard all that before? You have data separated from functions, functions separated from the display — yet they all come together to form a single entity? Yes. You have heard it all before. What I have just described is how a normal class works. The reason it’s divided into controller, model and view has nothing to do with better, next generation or any of that crap — it has to do with the fact that JavaScript doesnt have classes, or inheritance, or polymorphism or any of the fundamental features real programmers expect to find. So if you are a JS programmer Angular is fantastic, because it allows you to break down a presentation (read: component) into logical parts, deal with callbacks and display sequences in an orderly fashion and so on. But for a programmer coming from C++, Delphi or C# — Angular is a childish toy. There is no reason to break these elements apart, that’s why God invented VMT’s (virtual method tables).

Yeah yea, bla bla bla bla, hype

Yeah yea, bla bla bla bla, hype

I mean, have you heard some of these presentations on youtube about angular? Wow. It even get’s me going for a while there. The mental image they paint is that angular is going to solve everything! If you can just use angular, then your website will scale, dance, sing and even click it’s own likes. But when you start coding with angular you realize that it’s just a non-productive way of emulating OOP through objective thinking. It’s technical masturbation. You isolate your data in one place, your procedures in another place and your visual appearance a third place. This is exactly what OOP was created to solve. It may be a step forward for JavaScript, but compared to Delphi, Smart Mobile Studio, C++ or any “real” programming language with OOP — it’s a gigantic step backwards.

Components is MVC

MVC (model view controller) is a programming pattern, or style, which has become very popular lately. It was initially hyped by Apple to get people onboard their Objective C wagon for iOS and OS X development. Picked up by other languages, especially JS which is the mother of all bling, it has become almost the norm. Both in the world of nodeJS and DOM programming in general.

Oh but you can change things easier and use the same controller with different views, or have different controllers for the same view. So? Thats what inheritance is all about:

type

//baseclass for database read values
TBaseDBStorage = Class(TW3Object)
end;

//filtered database values, inherits from base
TFilteredDBStorage = Class(TBaseDBStorage)
end;

//basic display widget
TBaseDisplay = Class(TW3CustomControl)
private
  FData: TBaseDBStorage;
protected
  function getDBStorage:TBaseDBStorage;virtual;abstract;
End;

// display optimized for desktop
TDesktopDisplay = Class(TBaseDisplay)
protected
  function getDBStorage:TBaseDBStorage;override;
end;

// display optimized for mobile devices
TMobileDisplay = Class(TBaseDisplay)
protected
  function getDBStorage:TBaseDBStorage;override;
end;

I mean, the above OOP code allows you to fetch data from a server, and also specialize it as needed. We also roll out two display controls, one for mobile and one for desktop, and we give them different display and layout rules. This is faster and easier than writing two controllers, two data structure profiles, two html segments and two CSS rulesets. Same result, except the code above can be expanded indefinitely without messing up existing models.

So there!

So there!

What people fail to notice is that MVC is just plain old TCustomControl. An ordinary TCustomControl has data (fields), which is a model — methods and implementations which is the controller, and a view (surface, canvas or operative-system viewport). And just like under MVC the code is there to act on the data and control the visual output. What angular does is essentially to rip OOP apart under the assumption that this will make things better. But it doesnt make things better, it makes things worse (!)

Mutation events

Now if you’re a JS programmer feeling you have to defend angular, please relax. I know all about the data binding layer – because just like angular Smart Mobile supports mutation event handling as well. And we do it through proper OOP with full inheritance. Mutation events is just a fancy phrase for “tell me whenever anything changes in the DOM”. So a mutation listner can be created and set to listen to changes on either the whole DOM or a particular piece of the DOM (like your panel or a button for that matter). Whenever a property change, an attribute or a CSS style — you get a callback event with the change data. Using this system Google has made a neat system for binding data changes to visual tags. For instance, whenever you change the value of a variable – you can hook that variable up to a section and have it display the change “live”. You can also bind visual input, like from a textbox, to a variable, another field or whatnot. Sounds familiar?  Delphi Visual Live bindings anyone? Angular creates the illusion of being black magic; and to the JS punters and kids it probably is. But sadly the only spell it casts is one of blinding hype.

Bootstrap JS

Bootstrap has to be, with the exception of jQuery, the biggest disappointment of them all. And I dont write this just to be negative or anything like that. I am genuinely disappointed at how such a small library, containing nothing particular interesting at all, can get so popular so fast. Bootstrap.js is essentially a theme engine. That’s it. Yes you read right, a plain old vanilla theme engine, like we have had in Delphi and C++ for decades now. Bootstrap allows you to define simple constructs, like a panel. It will then automatically align and position your input controls and DIV’s according to a 12 point grid. Does this sound familiar? It should because every Delphi control has an align property, and TLayoutPanel has been shipping with Delphi since 2006. If you add some clever CSS styling on top of that — you essentially have bootstrap.js

Final verdict

In this post I have told you the truth about some very, very big and popular javascript libraries. They are popular and famous because for a JS developer, which doesnt have the luxury of OOP like we do – these libraries is heaven sent. But for everyone who has OOP, like Smart Mobile Studio, there is absolutely no benefit to using angular, bootstrap or jQuery at all. In fact the RTL was designed in such a way that there should not be any unknown tags in the DOM. Hence jQuery is useless because what exactly should you use it for? TW3CustomControl encapsulates the uber-hyped MVC of Angular, our web units outperforms and outweigh the angular toolbox by a factor of 10 — so again there is absolutely nothing angular provides which has any value to a seasoned and professional Smart Pascal programmer. He would make angular.js himself within days (!). Not because he is so clever, but because OOP and inheritance makes it possible. Modern OOP was designed to better help you deal with problem solving, spanning recursively through a well written and designed architecture. This is why OOP rules the world and procedural and objective programming is a thing of the past.

A better and far more powerful way

Over the next six months I will be presenting my web technology. This means that the tools you will get – through smart mobile studio – and the classes you will also get, will help you create web applications that knock the boots of all these 3 libraries. So far Smart Mobile Studio has only been for mobile application development. Well that is about to change (slowly) as we begin to add more and more support for full-on “page” designs. You can naturally create websites today, but webpages demonstrates a slighly different behavior – both in terms of scaling, scrolling and general navigation. You want to create awesome websites with little code? Sure you do! You want to use your Delphi skills to create fantastic HTML5 user-controls which no other language delivers? Sure you do! And you want to connect to databases, REST API’s and your own nodeJS based service layer? Hell yes you do! Well, let’s teach these JS kids how real programmers solve these things 😉

QTX IDE for freepascal

May 5, 2015 Leave a comment

It’s been a hectic couple of weeks that’s for sure. I’ve been called the death of freepascal, a devil with anterior motives, a civil war monger and much, much more. It’s quite dramatic don’t you think? I mean “civil war” (insert dark voice here) and all that. We are talking about programming languages, not the borders of Bosnia. Yet drama these guys spin like spiders on drugs.

And killing the guy that raises the red flag, when did that become popular? So when I go “yo — there is something wrong here, be careful”, they just respond “Why did you say that, I don’t want to know there are bad things in the world!”. Guess I should be glad we’re not in the army together huh? That could get messy.:”Me: Guys there are mines here, go around, seven o’clock!” — “FPC/Lazarus: Everyone into the minefield and twirk like mad! That’s an order!”.

So the entertainment is priceless. Just wonderful to watch people allergic to the words “im sorry i thrash talked you, my bad, you were right to tell us” squirm around like vipers being cooked alive on a chinese barbeque .. pride can be an ugly thing.

Be very careful when using CodeTyphon, wait until it's clear of all GPL and copyright violations

Be very careful when using CodeTyphon, wait until it’s clear of all GPL and copyright violations. I wouldnt go near it personally.

Well, despite all the bad news, the slandering and negativity – I remain cheerful through it all. Why? Because rather than stealing code from others or trying to bypass laws and regulations, I put my time into writing the Quartex IDE from scratch without the help on anyone. And I did that exactly to avoid the awful mess PilotLogic and freepascal now find itself in.

It’s really simple:

  • If i need help, I ask politely
  • If i want to use a component which is free, I ask politely
  • If i want to use a full GPL piece of code, I still ask politely!
  • I dont remove author names, but instead put them in the About box to respect the authors, thanking them for their work
  • I try to solve things first myself before asking for help
  • I use standard packages like SynEdit and Jedi exactly to avoid GPL/copyright problems

Incidentally I was trying to stop problems from happening, but everyone needs someone to blame so if blaming me for pointing out copyright theft and GPL violations — whatever makes you happy I guess. I honestly don’t care any more what happens to these systems. I should not have wasted my time trying to help FPC/Lazarus and CodeTyphon. I guess there is a reason these groups have a bad reputation – sadly I have them the benefit of the doubt.

The best comment on the FPC forum must have been “Who has given you the right to prosecute pilotlogic!” — well, in that case: who has give you the right to make FPC better? Because protecting FPC was what I was doing. So who the hell made you king and decided that you could fix bugs? Do you think you’re better than anyone else?  Huh? — that’s the kind of insane thinking I’m faced with. It’s just unbelievable.

QTX for freepascal

That would be a no I think. Since people actually believe that I am a devil incarnate in all of this, it would only serve to make their insanity a self-fulfilling prophecy. And QTX will render Lazarus useless, so … dont think they would be to happu about that either. They would no doubt scream “I told you so, he was plotting this all along!”. Which is fun because I’m not that diabolical even on my best of days, I couldn’t because there is a limit to how much evil scheming I get done with 3 kids, homework, brownie baking and a full time day job as a C# programmer.

Freepascal is a great product, but the forum is full of characters which do more harm to the product then good.. All projects get's nutcase

Freepascal is a great product, but the forum is full of “characters” which do more harm to the product then good.. All projects get’s nutcase “groupies” but usually the leaders have the sense to get rid of them. This has sadly not been the case here

So, I guess the plans to support freepascal has to be canceled. Which is really a shame because I truly believe in FPC/Lazarus as a universal platform. QTX would sort of be the icing on the cake. And even if you don’t like it – it would still be good to have it, because the more alternative we have the better.

But nope, I will not be supporting freepascal or lazarus after all. If people want it they can ask of course, I might change my mind in a couple of years; but right now I wont go near that copyright mess with a 10 foot pole. Nor would I support people who verbally abuse supporters when trying to help them (months in advance btw). They can blame themselves. A user group that hostile serves little or no purpose what so ever.

Alternatives

But there are always solutions for those that look; in heaps and buckets. QTX is designed to be a transcending platform, meaning that it compiles to an intermediate format (LDEF) which in turn can be represented in other languages through a code-generator API. A bit like .net but on source level rather than binary.

This means that I will be focusing on vanilla C++, shipping QTX with the free GNU C++ compiler, which is the fastest most widely developed and used compiler in the world. And I do believe it has the widest support for hardware out there as well, so it’s not bad news at all.

So to sum up:

  • You write object pascal just like Delphi or FPC
  • The compiler compiles to LDEF
  • LDEF is compiled into C++
  • C++ is compiled to machine code using the free GNU C++ compiler
  • Voila, you have a free path on both Unix, Linux, Windows, OS X and pretty much every platform out there

What have you been doing lately?

That is a good question. I have been very busy with my day-job coding in C# so there has been limited time for personal projects. But last weekend I added a new cool feature to QTX, namely a second way of opening units by cursor.

QTX is still young, but packs a mean punch

QTX is still young, but packs a mean punch

You know that you can CTRL + Click on a unit-keyword and the IDE opens the file automatically for you right? Well, what if that unit is a part of a package? Wouldnt it be great if the IDE not just opened the file – but mapped the file to the treeview so you can see all the files? This is optionally of course, but it will save you a lot of time when writing packages yourself or porting packages from Delphi/FPC.

This is a humble change I agree, but sometimes making the ground-level functions rock solid is valuable. It’s exactly those functions that have been crashing Lazarus for ages. Lazarus is really only perfect on Linux, on Ubuntu for instance it’s just bloody brilliant and really hits the mark. But on OS X and Windows it’s often the small functions, those you take for granted that crash and burn.

So I’ll be spending a few extra months before alfa release just doing those functions really well. The advanced stuff can wait. I’m going for stable and rock solid over super-modern and unstable.

Smart Mobile ‘retrogaming’ cloud services

April 19, 2015 1 comment

Im getting older. It’s with shock I have reached the age of 41 (!) In my sons eyes I am already the proverbial dinosaur. But in my own mind it was only yesterday I ran around with my friends, Amiga in nap-sack, on the way to some copy-party or gathering of Amiga enthusiasts, coders and gamers.

Sexy, compact and extremely fast! Amiga OS

Sexy, compact and extremely fast! Amiga

You may be wondering what all of this has to do with Smart Mobile Studio, cloud computing and object pascal. The answer is: everything. Because the Amiga computer was the machine which started all of this. In fact every project I have loved working on my entire life began on the Amiga. The reason I now live as a programmer is because of the Amiga. The reason I became who I am and live where I live, is because of the Amiga. And the reason I work where I do, and know what I know – is yet again because of the Amiga.

Trying to emphasis the impact the Amiga has had on hundreds of thousands of kids during the 80’s and 90’s is almost impossible. It’s like trying to explain the impact the moon landing had, or the cold war (we share a border with Russia, so that was fun). To be blunt: The Amiga has shaped my life more than any other person, education or “thing”.

The IOT phenomenon is about to emerge, so if you wanted a wink that a revolution is about to happen — this is it. Your chance to capitalize and make money is NOW.

Sadly I was to young to realize any of my ideas back then, and the hardware was not even close to deliver them. This is why the death of Amiga was so heartbreaking to a whole generation. Because the Amiga was the platform that gave us everything, yet it was cut down in it’s prime due to sloppy, greedy and outright insane management decisions. The entire IT market and reality of computing for the entire world would have looked very different had the Amiga realized it’s potential. Windows and OS X has only recently managed to catch up with the Amiga operative system. And we are talking about a machine which went out of production 20 years ago (!). It was way beyond anything Microsoft or Apple cooked up in their labs. We enjoyed a responsive and fast multitasking desktop, high-speed games and graphics and fantastic soundtracks – 15 years before the PC (fifteen years! That’s a whole “growing up” phase).

The amiga also had VR equipment more than 18 years ago. So yeah, it was a personal disaster for a whole generation when Commodore went bankrupt. It pushed computing back to the stone age. Could you imagine having to throw away your modern computer and be forced to buy a 15 year old piece of shit instead? Being told by people who know jack shit about the mac or pc you own today, that their old shabby system is better — when you in fact have tried future technology and used it for years, knowing full well that what they say is not true? Well, that was our experience. Having to pay money to get a 486 after having lived with an Amiga 1200/68040 CPU for years was just insane. It was like trading in your iPhone for a 1996 Nokia, or your Tessla car for a 1980 Fiat.

So indeed; we had so much more than kids today have. The experience of connecting your modem up to your dad’s phone, connecting to a BBS on the other side of the world, logging in and talking to people, swapping games, documents and whatnot — take a close look at the underlying technology there and what you see is the seed of cloud-computing.

A BBS functioned as a file-sharing service. So when you connected to the BBS, the files, games etc. you placed in the public folder was immediately shared with the others. And they all went through the server first, which typically picked up whole files first.

The Amiga was a lot more than just a games machine, it was way  ahead of both Windows and OS X for a decade

The Amiga was a lot more than just a games machine, it was way ahead of both Windows and OS X for roughly 15 years. So for 15 years we had a full multitasking desktop.

Now, going from that – to a reality of mainframes, thin clients, abstracted filesystems and remote data storage (or even better: dispersed data storage, where chunks of data can be stored anywhere on the planet and re-assembed when you need it) — all of this saw the light of day on the Amiga. In fact the second webbrowser ever written (the first was naturally on a unix machine) was written on the Amiga.

A fully working US produced Amiga 500, re-built and fixed by me this weekend. It took 2 days to get it working, but it's worth it!

A fully working US produced Amiga 500, re-built and fixed by me this weekend. It took 2 days to get it working, but it’s worth it!

But for me personally: did you know that the first programming language I wrote was called “concept basic”? It was written in assembler and blitzbasic on the Amiga. So the idea of programming languages, delivering a fun system that people love — it comes directly from my Amiga days. I would never have created Smart Mobile Studio or connected with the other people of the team had I never owned an Amiga.

Blitzbasic and Amos

Have you ever thought about the people who inspired your childhood? Not your mother and father, but all those people who – behind the scenes, did something which had a huge impact on your life? I have thought about that many times. And I believe hundreds and thousands of teenagers back then was touched by two titles especially, written by two near iconic Amiga personalities.

The first is Marc Sibly who gave us BlitzBasic, which was on the Amiga the closest thing to Turbo Pascal or low-level Delphi as you could get. You could write assembler side-by-side with fast basic, and the compiler gave you a single executable which ran at extreme speeds. Even die-hard assembler coders took their hat of to Marc for his invention.

Games like Worms and Lemmings were coded in BlitzBasic  2

Games like Worms and Lemmings were coded in BlitzBasic 2

The other title which enabled a world of children to learn programming and be creative, is Francois Lionet. I have been fortunate enough to talk with him online, where I also expressed my gratitude for Amos Basic. It’s really sad that so few Amiga users have done this, because both Francois and Marc deserves to be recognized.

Amos basic was the multimedia basic par excellence

Amos basic was the multimedia basic par excellence

Thanks to these two people and programming tools – hundreds of thousands of kids became professional programmers.

I cannot express enough just how fun it was to grow up with BlitzBasic and Amos basic. Every day before I went to school I would spend an hour coding. Slowly learning trick by trick. Without the inspiration of these two IDE and compilers, I have no idea what I would be working as right now. But I doubt I would be as happy as I am, or have such a rich intellectual life as I enjoy.

Smart Mobile Studio

What I really want is to re-create that feeling for others. I want people to start Smart Mobile Studio and feel that they can make anything. Be it games, mobile applications or cloud services. I realize of-course that the majority of people using Smart are grown men, but with the student program and a few plans we have — odds are we will be able to reach teenagers who want to master programming. Just like Marc and Francois did for us.

Early variation of Smart Mobile Studio

Early variation of Smart Mobile Studio

So that is a huge driving force in what I do and my work in programming language research

Raspberry PI

What is a cloud? Well it’s not just storage. Even though that is the first service people think about. So dropbox is not really a cloud service just because it allows seamless backup and re-distribution of data. But it is indeed one of the services cloud delivers.

No, what cloud is – is a very, very old idea. The idea that you log into a huge system, allocate computer time (just like on star-trek) and then work on your task is ancient. It goes back even before the Amiga to the huge IBM mainframes of the fifties, sixties and seventies.

The commodore mainframe, an ancient idea

The commodore mainframe, an ancient idea

The fun part is that a single $35 Raspberry PI 2 contains more computing power than the entire US government combined in the nineteen sixties. Just think about that for a moment.

But it should also mean that we have something to learn here, or an opportunity to explore and do things our parents never even dreamed about.

And this is where the Raspberry PI cloud system comes in. I have been coding this for a while now, and it still requires work, but when it’s done – you will be able to run your very own cloud using a single or multiple Raspberry PI’s. An the pricetag? For a measily $140 you can now own a 16 core cloud setup. Perfect for writing cloud software, which (let’s face it) the world is heading.

Smart Cloud

Cloud storage, coming to a smart RTL near you in the future

Cloud storage, coming to a smart RTL near you in the future

So what exactly is this cloud thing? Well, in short it allows you to install cloud resident applications. Meaning applications which live in the cloud, store data in the cloud, and which conforms to the laws of the cloud reality.

This means that you will be able to develop, test, maintain and deploy your own cloud solutions directly on your own mini-cluster at home. When your service is complete, tested and validated — you simply upload the whole system (a zip file) to Amazon or Azure. Now your system is “live” and can be reached by millions of potential customers though mobile phones, pads, smart-tv’s, tabs and computers of any size and form.

The IOT phenomenon is about to emerge, so if you wanted a wink that a revolution is about to happen — this is it. Your chance to capitalize and make money is NOW. If you wait a year, the window will be lost and you will have to wait for the “next big thing”.

Retro computing taken to the extreme

The first service I am going to make, besides the professional tools you need to write kick-ass cloud software, is the ultimate retro gaming platform in the universe. You may have heard of RetroPI, WinUAE and all those emulators which plays Nintendo, Amiga, Playstation and Mame games (NEO GEO) ? Imagine running all of these on a cluster.

Thousands of classical titles at your fingertips

Thousands of classical titles at your fingertips

Imagine being able to easily upload and download games via our Smart Mobile Studio nodeJS services (which you will get when you buy it, to run in your own home). And imagine (drumroll) being able to start and play those games from anywhere in the world. All you need is a browser, and the emulated screen will be transported to the browser in real-time.

With your cluster running at home, you can be in any hotel in the world and access thousands of games, movies and music. And the good part? It’s all written in Smart Mobile Studio, using the SmartSDI daemon interface (daemon is the same as service on linux).

Look out! 1990 is about to hit your system, like a ton of PI's

Look out! 1990 is about to hit your system, like a ton of PI’s

Sounds hard? Well not really. The cool thing about X, the windowing manager on Linux, is the idea of remote desktop session. So connecting and getting the desktop pixels is there from scratch. The rest is pure RPC service architecture, a handfull of scripts – and cluster software, allowing you to make use of all 16 ARM cores for tasks.

Well, stay tuned!

Delphiarmy, the place to find cool jobs

December 10, 2014 4 comments

This is a plan I have worked on for a while. It is born first and foremost out practicality – because let’s be honest, Delphi developers are in high demand these days, but we are in much smaller numbers than JavaScript and C# programmers. So as a Delphi developer it’s hard to find work due to the lack of an official organ taking care of these things, and secondly it’s very frustrating to be an employer because locating good developers is tough enough, but finding an awesome Delphi developer can be the proverbial needle in a haystack.

Want a Delphi job? Well that is going to become much easier!

Want a Delphi job? Well that is going to become much easier!

So, I want to present the upcoming object pascal job portal, humbly named: Delphi Army (www.delphiarmy.com). The website is not yet operational, but in a couple of weeks you can register and secure that job easier than ever before.

Delphi Army

For the past two years I must have gotten at least 25 phone calls from small and large companies who want to hire my services. But since I already have a full-time job, and Smart Mobile Studio on the side – I have had to decline them all. Even though many of them had excellent benefits and solid wages (even by Norwegian standard, which are the highest in the world).

Well, I have decided to do something about this and bought http://www.delphiarmy.com a while back. It will function as a hub for employers looking for Delphi programmers. The organization will operate more or less like manpower — except with a much lower cut (Manpower takes as much as 50% which is ridicules, DelphiArmy will settle between 25% which is very reasonable).

How does it work?

Developers register for free, including uploading their CV and presenting themselves and their previous work. Employers looking for expertise log-into a special portal on the website, where they can register their needs and what qualifications the candidate must meet.

All object pascal, in one place

All object pascal, in one place

We then pick the candidates matching the criteria, or at least those that comes closest to the needed expertise, and present you to the company in need of your skills.

If they accept you as a candidate (taking location and other details into account), they sign a hiring contract for the duration of the project with DelphiArmy — and you are given the job. You will receive your paycheck from DelphiArmy (we deduct 25%), which we receive from the employer.

Headhunting services will also be available for employers for a fee.

Is it Delphi only?

No. As we all know object pascal expands way beyond Delphi, which is a single product in Embarcadero’s portfolio. Smart Mobile Studio is becoming increasingly important as object pascal developers get to grips with HTML5/JS and nodeJS server programming. Not to mention the fact that more and more hardware runs JavaScript by default (such as micro-controllers and embedded boards). Espruino being a prime example of a SOC (system on a chip) controlled by nothing but JavaScript.

Freepascal is likewise an important piece of technology, one which is behind a multitude of object pascal projects around the world. It is also important because it represents an alternative to Delphi itself, generating faster and more optimized code for nearly every platform in the marketplace (even Nintendo, PlayStation and XBox). In-depth knowledge of FPC and a solid grasp of Lazarus for building rich, platform independent solutions is a great skill.

Remobjects Oxygene, which is the technology previously shipped with Delphi to cover the dot net platform, is likewise an important piece of the marketplace. Good knowledge of the dot net framework is essential when working with Oxygene, but for those that wish to build and run their applications on Microsoft’s platform -or Mono for other platforms (that may change very soon since Microsoft has open-sourced the entire framework, including compiler).

Here is how the technologies can be summed up:

  • Delphi classic (Delphi 7 – 2009)
  • Delphi modern (Delphi 2010 – XE7 and beyond)
  • Delphi Mobile development
  • Delphi OS X development
  • Smart Pascal HTML5
  • Smart Pascal nodeJS
  • Smart Pascal Embedded
  • Freepascal / Lazarus Windows
  • FreePascal / Lazarus Linux
  • FreePascal / Lazarus OS X
  • FreePascal Embedded
  • Remobjects Oxygene

Secondly there is knowledge of the various RTL’s, which is perhaps just as important to an employer as is the technical skill to write good code. A candidate versed in the dot net framework will be almost useless in the VCL environment, and visa versa;

  • VCL – Delphi’s classic run-time library
  • FMX – Delphi’s platform independent run-time library
  • LCL – Lazarus and Freepascal component library
  • VJL – Smart Pascal’s run-time library
  • NJL – Smart Pascal’s nodeJS framework units
  • NET – The dot net framework (Oxygene Pascal)

Being able to master various techniques is likewise an aspect of programming which is important to expose to an employer

  • Generics for Delphi
  • Generics for Freepascal
  • Anonymous methods, variables, fields for Smart Pascal
  • Lambdas for Smart Pascal
  • Assembly / Machine code x86 / ARM

Being able to write modular, maintainable solutions across platforms which adapts custom adaptation is a skill-set very sought after; both visual and non-visual components alike:

  • Creating custom controls for Delphi
  • Creating custom controls for Freepascal / Lazarus
  • Creating custom controls for Smart Mobile Studio
  • Creating custom controls for Oxygene / .NET

Then there is types of executables, which to present date can be summed up as:

  • Windows Services, Linux Daemons, OS X Helpers
  • Windows DLL, Linux .so, OS X .dylib
  • Windows COM libraries and typelibrary generation
  • Windows COM server initialization and use
  • RemObjects Hydra
  • RemObjects SDK service containers (.dll)

And various standard Delphi project types

  • REST client/server
  • ISAPI modules
  • Apache modules
  • Multi-lingual projects in Delphi

And last but not least, being able to work with standard object pascal third party technology is a must, no matter what compiler or framework you provide services for:

  • XML binding
  • SecureBlackBox XML signing
  • CryptoAPI XML signing
  • Bluetooth API
  • XSLT schemas and validation
  • Developer Express controls
  • TMS Aurelius
  • TMS grids and controls
  • mORMot  object relation mapping framework
  • RemObjects SDK
  • RemObjects Data Abstract
  • Datasnap with Smart Mobile Studio
  • Remobjects SDK with Smart Mobile Studio
  • TClientDataset caching and update mechanisms
  • ElevateSoft’s DBISAM
  • ElevateSoft’s ElevateDB
  • MySQL, MSSQL, Oracle, Interbase / Firebird
  • FastReports, Crystal Reports, Report Server
  • DirectX
  • OpenGL
  • WDOSX embedded framework
  • GSM modem technology
  • Smart card technology

All the above sections are each areas which is of interest to an employer, including what debug or error management framework you use (logging to file or Windows log is also valid, but the more depth you as a developer can describe and back up with knowledge, the better).

The important thing is to present factual information, because you will be tested. And candidates lying or otherwise miss-representing themselves, will never work again through DelphiArmy.

I live in country xyz, how can I remote work in Norway?

Most companies that deal with outside employees have strict guidelines regarding contact and availability, and it’s important that these are meet. The majority of companies I have worked with, either here in Norway or in the states, will typically start the day with a 15 minute scrum meeting on Skype to set the agenda.

You are expected to know your way around SVN, GIT, and other tools of the trade. It’s imperative that you speak english and that you at least write english which is coherent (some languages have a tendency to present conclusion before the deduction, which can be hard to understand in english).

Most companies also demand that you can be reached by phone, Skype and email during work-hours, this can be tricky if you live on the other side of the globe, but after a period of time when the employer sees results, most give you some freedom regarding contact – reducing it to being able to contact in case of an emergency.

Well, I hope this is good news for everyone. I am presently busy picking out the website software, which will include more than just work — it will also host forums and a web-shop, so stay tuned!

Things are about to get a lot better for all of us 🙂

TDBF, your free, open source, Delphi database engine!

November 7, 2014 6 comments
We need a light database

We need a light database

One of Delphi’s strengths has always been it’s support for databases. Even back in the day I remember C++ users looking over my shoulders at how easy it was for me to create a database application, while they themselves had to commit proverbial warfare on some bulky, esoteric API just to store lists. So when it comes to databases Delphi programmers have been spoiled rotten with an impressive menu of drivers and native engines.

But as always there is a catch, and that catch used to be that you had to ship the BDE with your applications (which at the time was “wow, that simple?” factor. The basic and C guys had it much worse) if you were going to work with Interbase, Paradox or DBase – which were the heroes back then.

Like many others I decided to skip the whole BDE and opt for a native, embedded database engine. Meaning a full database system written in Delphi itself as opposed to C/C++ (which really is the paradox here, since working with databases under C++ was a bit like shaving with a cheese grinder: slightly amusing but mostly painful). And I mean no disrespect to any Delphi database engine author, but DBISAM was king, only topped by ElevateDB which is it’s successor (and very much alive and kicking to this day). So if you want a solid database engine which is embedded (meaning: compiled into your program) ElevateDB is worth every penny.

At the end of the day, what Delphi had (and still has to some extent) to offer is:

  • Pretty much the best support for popular databases out of the box (read: drivers)
  • A wide variety of database engines written in Delphi

As you probably guess, none of these options are really free. And those that are free, like FireBird, requires a lot of reading or studying of code to get working. Now please don’t get me wrong, I really want to avoid any debate situation where some Firebird guy wants to protect his favorite database. The point is simply this: if you know absolutely nothing about Firebird or Interbase and you just want a quick “drop in” component which gives you database capabilities, then Firebird can be pretty daunting. It’s a serious piece of software engineering which means you should know what you are doing and have the time to learn exactly that.

Take myself as an example: I spent a whole day trying to connect to a FB database, only to discover way into the dark hours that there were in fact two different FB versions. Had this been explained in right at the start I could have spent my day making my actual database rather than googling for error codes and exception identifiers. Secondly, the Firebird team should ship a simple Delphi demo complete with the embedded version – ready to be used by anyone.

And last but not least, FireBird doesn’t always play nice with Interbase components – and getting everything to work out of the box (I ended up with Zeos component set) can’t really be compared to the smooth sailing that is ElevateDB or DBISAM. There you just install, drop the components on a form or datamodule — voila, that’s it.

Shooting sparrows with a canons

While all of this is well and good, with plenty of drivers and support for popular technology from mySQL to MSSQL to Firebird and whatnot, dont you find it to be overkill? I mean for small projects?

For instance, I was writing a simple movie collection program a few years back, which downloaded the movie cover online and figured out things like what year the movie was made etc. based on name and online sources. My database needs very humble to say the least, something between 5 to 100 megabytes maximum. My first “test” database did not take up more than 30 megabytes (using TClientDataset which bloats everything by storing data as variant no matter what).

So where is the alternative? Do I really need to fork out $300 for a native Delphi engine just to store between 5 and 100 megabytes of data in a sequential, indexed and searchable way? And if I go for the “free” alternatives, how many hours do I have to work just to get the database engine working in the first place? Having played around with mySQL embedded, SQL Server light and Firebird – sticking to Windows and using ElevateDB seemed like the best option.

But having seen what ships with Visual Studio, Mono C# and even Lazarus/FreePascal I felt outright annoyed that Embarcadero had absolutely no free, built-in (so to speak) alternative. The only possible alternative was TClientDataset, which is perfect in terms of functionality (you rarely need SQL when dealing with such a small amount of non-complex data) — but it’s not a disk based table and quickly eats up memory once you start stuffing blobs into it.

I wanted a small, compact and humble database solution that may not be the fastest gun in the west, but at least you could trust it to scale properly and be written in such a way that it’s portable.

TDBF to the rescue

For the past couple of years I have held an eye on the database segment of Delphi, hoping that someone out there had either written a native Delphi database engine which was free and open-source, or that someone had taken the time to compile SQLite to .lib files and turned it into a TDataset descendant. The closest thing I came to a good clean production of SQLite was from Synopse — but just when I thought I had finally found what I was looking for, they decided to include it in their mORMot framework — adding a lot of dependencies which I quite frankly did not want.

As my search continued, I finally stumbled across a project which fit my needs! It’s a very small piece of database kit called TDBF, written in Delphi and compiles straight into your exe file.

To quote the Sourceforge website:

TDBF is a freeware native data access component for Borland Delphi, C++Builder and Kylix, and for FreePascal. It allows you to create very compact database programs that don’t need any special installer programs. In fact the code to access your database is compiled in your project executable file.
It takes only a few kilobytes in your executable and doesn’t need any other external files to run.

That is spot on perfect for my needs, and I’m guessing others as well. Having a simple “drop in” database which can be used for anything, speed not withstanding, should be considered a primer for any native programming language. I sincerely hope that Embarcadero either pick up this open-source project as a low-end alternative to Interbase Embedded (or perhaps sqLite would be more suitable).

If you visit the website you will find that it has quite a few years of development behind it. Secondly, if you check the SVN you will see that it was updated in 2013 (last year) so you should probably check out the code via SVN, since the website havent been updated in 7 years. But that doesn’t necessarily mean anything bad, there are plenty of components which doesn’t need updates because they work just fine. But I know many people regard “recent updates” as a sign of quality, so I’ll just mention this — the website havent been updated, but the code has (!)

The author has done a great job in keeping it backwards compatible with earlier Delphi releases (all the way to Delphi 3), but personally my absolute lowest possible limit would be Delphi 7, which I consider “classic object pascal” but even that can be discussed right now since we just moved to XE6. Either way, I will probably do a little cleanup of the code to get rid of legacy support and assembler segments.

And that’s another positive point: it’s platform independent from the ground up, designed to compile under both Delphi and freepascal. That is very nice because I am moving more and more code to Linux these days, and having a small and compact database engine which is portable and free is most welcome!

So if you are looking for a simple, clean, functional and free database engine written in object pascal which you can use anywhere — then I sincerely urge you to download and give TDBF a try. I also hope someone out there takes the time to fork this project and keep it alive (I only have time for my own stuff right now) because it’s something the Delphi community needs!

Although it ships with some 15 units, the content of the units is surprisingly small – so you could easily pack it all into a single unit without turning it into a mess. I love it when cool technology fits nicely inside a single unit with no dependencies 🙂

Im actually hoping to port some of it to Smart Mobile Studio later !

Highlights

  • Ships with several localization units (French, English, German, Spanish, Italian and more)
  • Compiles under Delphi and Freepascal
  • Platform independent (Windows, Linux and Unix)
  • No dependencies or external drivers, compiles into your program
  • Very small footprint, only adds a few KB to your exe file
  • Perfect for small projects and mobile applications
  • Compatible with DBase
  • Memo field support (dynamic size fields)
  • Indexing supported, fast lookup and searching
  • Derives from TDataset (standard Delphi database framework)

 Click here to visit the website. See the “SF Project Page” link to view the sourceforge SVN repository

Smart Pascal dialect

November 5, 2014 2 comments

Ever since I posted the “Smart Pascal now an official dialect” post, I have gotten a fair share of negative comments on the subject.

Article

Article

First, I am open to the choice of words perhaps being “off” the mark. It was written at the spur of the moment as just a quick message to those that read my blog. So I didn’t exactly sit down and meditate of 2 days beforehand, trying to find the exact right words to use – nor is English my native language, so unless I focus a bit – my style of writing will always have a Norwegian flavor to it.

What does official mean

For some odd reason people have reacted to the word “official”, as if that requires some form of consortium or establishment behind it. It’s a word open for translation perhaps, but for me it simply means:

Publicly available, publicly accessible – and ultimately: publicly open for scrutiny.

I mean, when BattleField III and IV was announced it was done via a public announcement which is often termed “official”. When you google websites which has a lot of fans, it’s often required to add the word “official” to the query – just to filter out all the fan-sites from the actual site (especially for movies and bands). So how people can react to the word “official”, like I have somehow mis-represented Smart Mobile Studio and whatever articles have been written about it online; well, it could not be further from the truth.

And when it comes to the term “dialect” and Smart Pascal now being an “official dialect” of object pascal, consider this: On paper American English and British English can be tough to distinguish, yet everyone in the world recognizes the difference between British, American, Irish and Scottish. There is very little linguistic difference in the vocabulary between, say, an Irishman and someone born and raised in London with a purely “brit” accent. But the moment you get a chance to hear how they pronounce and use words — you will recognize that one is from Ireland and the other from London. You should also have no problems telling a man from Texas USA apart from a Scottish Highlander based on their dialect.

Smart Pascal is especially suited for HTML5/JS

Smart Pascal is especially suited for HTML5/JS

A dialect simply means that:

  • There is enough in common to recognize it belongs to a group (English)
  • There is enough differences to recognize that it stands apart (Scottish, British, American, Australian, Irish and so on)

Looking at how other programming languages deal with this very problem: is Blitz Basic something completely new or is it regarded as a dialect of Basic? And why is it recognized as a dialect as opposed to a whole new language?

It is recognized as a dialect because, naturally, there are key elements in the syntax which follows the “basic language” style. The same can be said of Wacom C in context with Borland or Gnu C. They are all recognized as C compilers, implementing a variation of the C language. In fact most vendors are quite proud when they finally support the official, latest C language specification. But this is also where things become paradoxical.

If a dialect is supposed to strictly follow a defined standard, then we would have no American English, no Irish English, no British Columbia, no South African English and absolutely no Scottish English. We would only have British. Forever and ever and under no circumstances would the language expand or evolve to absorb new elements and realities without a group meeting? Thats not gonna work.

The problem? The problem is that the pascal specification (ISO 7185) is bloody ancient! It was first envisioned back in 1977 (!) And I would feel deeply sorry for the entire IT community if the extent of our technological reach begins and ends with a paper. That would to a large extent invalidate most of the changes added by Embarcadero since it bought Delphi and C++ builder, and indeed any changes after Anders Hejlsberg left Borland (because he defined the standard for object pascal). It would also utterly condemn Remobjects for creating Oxygene — and freepascal would never exist in the first place.

FreePascal and Lazarus is just as in power as Delphi is

FreePascal and Lazarus is just as in power as Delphi is

So to make it crystal clear: modern pascal has no group or controlling entity (legal or otherwise) which is in charge of “pascal” and what that means. C/C++ on the other hand has a vibrant and very much active group of thinkers and specification thumpers, led by the author of C++Bjarne Stroustrup (which I guess we should regard as an lawless rebel because he dared invent something not yet defined by a standard); A group which keeps on knocking out standards for the C++ language. But it’s up to each compiler author and/or company to implement and follow these standards. The key here is choice and what lingo is better suited for a particular task. And this has nothing to do with academia, that’s not their job.

So once again for pascal, there is no such organ. People have somewhat fallen into line automatically behind Embarcadero as “the trend setter” for object pascal, but in reality it has no more authority on the subject than Remobjects or myself. The sad reality is that object pascal sort or died when Anders Hejlsberg jumped ship and defected to Microsoft. It is a very sad story, but it’s none-the-less true. And in his absence the pascal community has had to make due. And after many years of loom and doom Delphi, FreePascal, Smart Pascal and Oxygene Pascal is standing on their own feet, evolving without the guiding hand of the grandfather of object pascal: Anders Hejlsberg.

And it should also be mentioned that Anders produced object pascal in his room, living with his parents back in Denmark– utterly violating the existing pascal specification. Something which was a necessity in order to create something new. A rule of life: the old must be destroyed for something new to be created (there is a limited amount of particles in the universe after all).

Tools of the trade?

Let’s face facts: There is no board, organ or philosophical entity in the world from which developer’s must seek a blessing in order for something to be official, although Apple is sure as hell playing the role of emperor without clothes pretty well. RemObjects Oxygene for instance, does that need the approval of Embarcadero to be an official dialect of pascal? I sure consider it an official dialect, nor was there ever a time when it was not official except for the incubation period. The moment Oxygene went from beta to public release, it was an official dialect.

The exact same thing can be said about Smart Pascal.

The tools of the trade in this case is probably university type mentality meets reality. People with a higher degree of education tends to pick up concepts along the way which quite often goes against the reality of nature and the mother of necessity. Things are created and built out of personal need, adapting to a situation or technology. Nature doesn’t write a paper on it, subject it to a panel of peers for review, until it finally jumps into gear and builds it. Nope, if you can envision it, built it and drag that idea from the realm of thought to our human, factual plane — nature will back you up and provide momentum. That is the law of the jungle, and bitching about it is not gonna help.

Is Remobjects Oxygene not a proper dialect? Ofcourse it is

Is Remobjects Oxygene not a proper dialect? Ofcourse it is

And it’s been like that for thousands of years. It amuses me to some degree how few of our human practical inventions that we enjoy were created in a funded, managed environment. The wast majority were in fact incubated and forged in personal “hobby” type labs by people of passion. Apple and Google started out in a garage for pete sake.

I have higher education myself, but I also recognize that inspiration and motivation can just as easily be murdered by academics as it can be polished and perfected.

Final words

So what makes something official? Well it depends on who you ask perhaps. My observation is that languages can die out just as quickly as they appear, but those that “make it” into history are typically those with a book or two dedicated to them. There is also a high level of persistence involved (or required) for the inventors and initiative-takers. But there is never a guarantee that one idea will win over the other. If VHS vs. BETAMAX taught us anything, it was that (or Windows vs. OS/2 for that matter).

In the meantime, I will continue to use the best tool for a job. I have no intention of putting in a nail with a screwdriver, or a screw with a hammer. Programming the browser is in my view best done with Smart Pascal, and the benefits of true OOP under JavaScript far outweighs whatever concerns some may have over a spec violation from the late seventies.

 

QTX vs. Smart Mobile Studio?

October 7, 2014 4 comments

It appears to be some confusion regarding what “Quartex IDE” is and how it’s connected to Smart Mobile Studio. In fact, the Smart team was asked if they had stopped production — which is a very unfortunate interpretation of the facts. Let me assure you that Smart Mobile Studio is not only in production, it’s growing by the hour – with several key developers working on it (!). I must underline and stress that QTX has no relation to Smart Mobile Studio at all.

The only thing these two projects have in common, is me. I am the author of both
systems and as such there will be similarities between the two.

So what is QTX and what is Smart?

Smart Mobile Studio

Smart Mobile Studio

Smart Mobile Studio is the programming platform I created together with Eric Grange a couple of years back, and later in co-operation with other great programmers. We all to this day make up “the Smart Mobile Studio team”. Smart is sold and marketed by Optimale Systemer AS in Norway. I own 50% of the product and as such is intimately involved with every aspect of Smart Mobile Studio.

Smart Mobile Studio is a completely separate, isolated project which is, to be perfectly frank, the best HTML5 development platform on the marked. And it continues to grow on a daily basis – with (as mentioned) several programmers working on it. Myself included.

Smart Mobile Studio has NOTHING – I repeat – NOTHING to do with QTX.

So what is QTX or “Quartex” thing?

QTX is a personal side project. It was created by me after Smart Mobile Studio and functions more or less as a kitchen-sink for ideas. The goal of the QTX project is to create a generic IDE, preferably open-source, which would be the Delphi version of Java’s Eclipse. Meaning that it can be used as an IDE for many different compilers, not just Smart Pascal but also Free Pascal, Delphi, mono C# or even GNU C++.

Smart Mobile Studio is architected to interface with and absorb the document
object model and JavaScript completely. Smart gives you access to the browser with
the same fine grain of detail as the VCL does for WinAPI. The Quartex IDE and RTL does not.

The reason I created QTX as a side project, is precisely because Smart Mobile Studio is a living, vibrant project. Smart is purposefully intertwined with the document object model and JavaScript by design; Hence, in order to target other platforms, languages and compilers it made more sense to create a new and separate project.

The Smart codebase is small enough to be managed and maintained by a single individual (although barely) and we want to keep it that way. It’s tempting to push the envelope and stuff the IDE full of everything under the sun, including third party compilers, secondary code analysis packages and god knows what — but my experience is that such a codebase ultimately falls pray to bloat, confusion, unexpected errors and bad performance (read: Delphi 2006). We want a HTML5 development environment that is lean, mean and responsive.

So instead of doing that – I sat down and started to experiment with a new IDE. Testing new ideas of how to make routines faster, looking at managing tabs and frames through a different API. This is how the Quartex IDE was born. As a research and development IDE into the object pascal language and parsing technology.

Is QTX better than Smart?

Quartex IDE, early prototype

Quartex IDE, early prototype

Absolutely not. And the two products can’t be compared like that either. It’s like saying that a water-scooter is better than a dirt-bike without taking into account their completely different environments and design goals. I received some statements along the lines of “QTX is better than Smart and is the next Smart IDE”. This is an exquisitely absurd and anal interpretation of what I have written. I tend to write from a personal point of view and I can sympathise with people who may mix up personal views with “hard production facts”; but let me assure you that QTX is not the replacement for the Smart IDE. Smart Mobile Studio is architected to interface with and absorb the document object model and JavaScript completely. Smart gives you access to the browser with the same fine grain of detail as the VCL does for WinAPI. The Quartex IDE and RTL does not.

What I have stated is that parts of the QTX Core, routines inside the IDE which takes care of files, packages and general organization of open editors — that, and that only may merge with the SMS codebase at some remote point in the future. But there is presently no need to do so, because SMS if polished, tried and tested.

One feature which sets the products apart is the RTL (run-time library). Smart ships with a RTL written from scratch to interface with the browser(s) exclusively. While it is theoretically possible to abstract the RTL so it could run on native platforms, it would require herculean efforts and almost a complete re-write. The Quartex IDE, in contrast, comes with a generic RTL architected to suit any platform. Meaning that it’s a lot more complex and borrows shamelessly from the .net framework (since I am heavy into C# I tend to bring something back to Delphi whenever I can).

The only thing these two projects have in common is me. I am the author of both systems and as such there will be similarities between the two.

I have also aired that I have made advances in the way I have built the QTX IDE, internal optimizations and more efficient approches — but under no circumstances does that mean that Smart Mobile Studio is “bad” or “not as good”. Smart Mobile Studio is an extremely complex piece of engineering. Writing an IDE may seem like a simple task – but I can guarantee you that it’s not.

Code sharing

Since I am active in both projects, naturally there is a convergence of code between the two. For instance, I recently wrote the QTX HTML5 library, which can be freely downloaded and used in Smart Mobile Studio. It provides effects and several helper classes which makes it easier to deal with callback’s and non-linear calls.

I can understand the confusion some people have around this — but it’s really very simple. When I have code that benefits Smart Mobile Studio then naturally I will put the code there as well, and visa versa.

So what is the status of these projects

To sum up the situation:

  • Smart Mobile Studio is a fully separate, living and vibrant product
  • Quartex IDE is a generic IDE, separate from Smart Mobile Studio
  • Smart Mobile Studio is written and fully adapted for HTML5, QTX is not (!)
  • Both projects were written by me, this is the only thing they have in common
  • Since I am active in both projects, I tend to share my codebase with myself (sigh)
  • QTX functions as a kitchen-sink for new ideas, prototypes and parsing technology
  • Good ideas are ultimately pushed into Smart Mobile Studio
  • Smart Mobile Studio is 100% about JavaScript and HTML5
  • Quartex IDE is generic and tries to work with everything

So there we have it. I have two separate projects i’m involved in. They both include an IDE. They both use compiler technology. But they are very different and completely separate.

I have written that “QTX begins where Smart Mobile Studio ends”. This have for some strange reason been interpreted as Smart Mobile Studio somehow going out of production (??). Let me de-mystify that line of thought straight away:

What is meant by that statement is simply that Smart Mobile Studio is not multi-lingual. It targets HTML5 and JavaScript exclusively. It contains thousands of lines of code written to cater for – and make JS programming as easy and flexible as possible. And it is getting better and faster and more clever for each day that passes! As such, Smart Mobile Studio is only about high quality JavaScript. Hence Smart Mobile Studio ends there; it only does HTML5 and JavaScript. And it does so brilliantly.

Quartex on the other hand is generic. Meaning that it completely relies on an external compiler to do the job. It implements the typical functions you expect from an IDE, but does not dig into the peculiarities of any language. It is purely language agnostic, meaning that it has no idea if you are writing pascal, php, java or c++. All of that has to be crafted and designed. As of writing it uses the freepascal compiler as its primary code generator. Allowing it to reach out to Windows, OS X, Linux, Amiga, Nintendo and other platforms. But it deals exclusively with native code at this point.

Will you make another HTML5 studio?

Well, I can if I want to, but there are several reasons why I would not do that. First of all we are 5 people who have worked countless hours on Smart Mobile Studio and Smart Pascal. Christian, Primoz, Andre and Jørn have invested both time and money into this – not to mention Eric Grange (writing a code generator for another language is no walk in the park) and I feel it would be a catastrophic demonstration of disloyalty, egoism and selfishness to create a competitor to a product I myself started, own, maintain and sell.

Secondly, the smart pascal team are my friends, and friends don’t do shit like that.

Third (from the Bhagavad Gita) : “A man at war with himself, is sure to lose”.

Final words

I sincerely hope this little post cleared up the confusion regarding this topic. Smart Mobile Studio is growing by the hour and it is well under way to reaching its goal: to become for HTML5 what Delphi is to WinAPI — The ultimate HTML5 Mobile application studio.

My personal project, Quartex IDE, has nothing to do with SMS. Since I am the author of both systems, naturally I will share my codebase with myself in order to make sure Smart Mobile Studio is as fast, robust and intuitive as possible. But keep in mind that Smart Mobile Studio has 4+ years of constant development behind it. We are 5 programmers working every day to make it more clever.

Kind regards

Jon Lennart Aasenden

Converting QTX Pascal to FreePascal/Lazarus

September 23, 2014 1 comment

As you may remember, I run a second website for Quartex Pascal, a research IDE for custom compiler technology. Aiming first and foremost to be the object-pascal equivalent of Eclipse. In many ways QTX continues where Smart Mobile Studio ends. Smart Mobile Studio targets HTML5 exclusively – aiming to be the best Object Pascal to JavaScript compiler on the marked — but Quartex Pascal is a very different beast all together.

The QTX IDE has so far been written in vanilla Delphi XE2 and XE3. It uses plain generics and is otherwise without external dependencies. The editor functionality is provided by a forked version of SynEdit, and as of writing the DWScript engine is the primary code generator framework. But depending on how portable DWScript is (a port of DWScript is reported to be in circulation, but if it supports the code-generator framework added by Eric Grange is unknown at this point) that will probably change.

There is also a secondary code generator framework being written for it, which uses Castalia for parsing and building the AST (abstract symbol tree). It is also capable of parsing visual basic .net (OOP, rule based parsers are very easy to write using my framework). The parser/tokenizer constructs an AST using an intermediate language format, which in turn can be stored as plain XML. This is quite revolutionary because it means – that turning the intermediate code into “real” code is now a matter of XML transformation, which is an off-the-shelf technology tried and tested by time. Ultimately, QTX may use the freepascal universal compiler itself to build “real” applications, or custom code generators – targeting mono C#, GCC or any other native compiler available on a target system.

Porting to freepascal

In order to support more platforms I have decided to port my work wholeheartedly to freepascal. This does not mean that Windows wont be supported anymore, or that I’m abandoning ship – far from it; it means that QTX will eventually be available for Windows, OS X, Linux, Amiga OS and MorphOS to name a few.

I will no doubt continue to work with Delphi for a long time, but I must admit that I am beginning to phase out Embarcadero from my toolkit, in favour of FreePascal, JavaScript and C#. Delphi’s pricing has become ridicules, the generated code is not what it used to be – and since FreePascal and Lazarus have reached a point of quality that is hard to rival — I see no reason continuing to pay top dollar to a company so clearly hostile to Smart Mobile Studio. In fact, they threatened to poll their funding for a “famous Delphi event” if Smart Mobile Studio was allowed to be presented — which is just plain unacceptable behavior for a company like Embarcadero.

If you have never tried Freepascal + Lazarus under Ubuntu, I sincerely urge you to install it. It truly is a fantastic experience!

My desktop right now

My desktop right now

 

QTX RTL, experimental Smart Pascal run-time library

September 15, 2014 Leave a comment

The Smart MobileStudio RTL I designed primarily for mobile applications, and it does a damn fine job at managing that – but what about larger and different form-factors? What about applications designed for a full desktop browser? Or even better, compatibility with native Delphi?

Well this is essentially what the QTX RTL is all about: To have a platform for RTL experimentation and evolution, a kitchen-sink where we try stuff out before it’s released into the wild and merged with Smart Mobile Studio’s RTL.

Advances

Since I have just begun architecting this one there is still a lot of work ahead, but here is the general class hierarchy:

  • TQTXErrorObj
    • TQTXPersistent
      • TQTXHtmlElement
        • TQTXComponent
          • TQTXControl

That might not seem so different from the VJL (Visual JavaScript Component Library) as deployed by Smart Mobile Studio today, but there are many important design considerations involved. Most notably:

  • Built-in error management at the core
  • Built-in persistent mechanism (RTTI is optional)
  • No dependencies on low-level procedures
  • Delegate support
  • Interface driven

Delegates

This is a topic that must be explained a bit more in-depth, as it is extremely important and beneficial. Delphi and other Object Pascal compilers dont use delegate objects, they use what can only be called “ad-hoc” event handlers. In essence, Delphi events are nothing more than a bare-bone callback mechanism. This is extremely fast and effective, but limited to only one receiver at any given moment.

A delegate however, is an object wrapper around a classical event handler. You could say that it represents an object-oriented version of the ad-hoc mechanism. And it comes with the benefit you would expect from OOP, namely that you can create as many object instances as you wish. In other words, you can have 10 delegates responding to the same event if you so choose (!).

This is extremely efficient for component writers, because descendants can now respond to the same events as their ancestor methods without interfering or having to override anything. You also get away from the classical Delphi-style exposure of event trigger procedures (like below), which is quite frankly unnecessary bloat.

Procedure TMyComponent.DoChanged;
Begin
  if not (csDestroying in ComponentState)
  and assigned(OnChanged) then
  onChanged(self);
end;

Another nice feature of Delegate objects, is that they are resource efficient. If you only listen for one event, then no resources or callback handlers are allocated for anything else. Delegates also have the benefit of being persistent, name based (you define the target event by name, not slot or id like under OSX or GTK#). And perhaps more importantly – they are natively supported by all browsers and as thus represents a very thin layer over the actual HTML5 framework.

Future IDE advances

There are also quite a few benefits if we consider the Smart Pascal IDE. Should delegates be introduced in the form-designer, it would to a great extent remove the need for event inspection (which is a fairly complex process). You would simply add the number of events you want for an element, perhaps more than one foe the same event if that is necessary – something which would is infinitely easier to deal with.

Delegate examples

Creating and using a delegate is almost as simple as setting an event in Delphi or Smart Mobile Studio today:

var
  mDelegate: TQTXDelegate;
begin
  mDelegate:=FControl.Delegates.add;
  mDelegate.Bind('onClick');
  mDelegate.onExecute:=Procedure (EventObj:TQTXDelegate)
    Begin
      //Handle event here
    end;
end;

Or the short-hand version:

var
  mDelegate: TQTXDelegate;
begin
  mDelegate:=FControl.Delegates.add.Bind('onClick',
    procedure (EventObj:TQTXDelegate)
    Begin
      //Handle event here
    end);
end;

Triggering a delegate can now be done several ways. First, if you have access to the delegate object itself:

  mDelegate.Dispatch;

And secondly by name, which will only dispatch the event if it’s actually has a registered delegate(s) for that event:

begin
  //Trigger all delegates mapped to onClick
  FControl.delegates.dispatch('onClick',[0,1,"hello"]);
end;

And finally you can mute events with a one-liner:

begin
  FControl.delegates.active:=False;
end;

And last but not least, storing delegates is a piece of cake:

var
  mJSON: String;
  mAccess: IQTXPersistent;
begin
 mAccess:=(FControl.delegates as IQTXPersistent);
 if assigned(mAccess) then
 mJSON:=mAccess.writeContent;
end;

So finally we can decouple event management from the work of writing components. Such things can now be regarded almost as action objects in Delphi, specifically tailored and isolated in classes.