Technology Blog

Is Language Fashion?

"Why would you switch the language the whole platform was written in, just because it was fashionable?"

In 2004, everyone was talking about Java Java Java! The company that I'd come over to the US to work with had adopted a platform written in Visual Basic but everyone I spoke to had a kind of not-so-subtle distain for Visual Basic, as though it was simple and child-like.

When you stop to think about it, I realize, looking back (literally, I'm browsing the code right now), that it was, in no way less superior at all, it had all the same structures, all the same mechanisms for object access and manipulation, all the same protection levels of its peers and, significantly better capabilities than many popular languages today... PHP, I'm talking to you... though you're probably too blocked on the current thread to handle an interrupt from me!

Private Sub dropdownSchool_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dropdownSchool.SelectedIndexChanged

   'Fetch School details:

   If Me.dropdownSchool.SelectedValue = 0 Then ' Clear
      With Me
         .imageSchool.ImageUrl = ""
         .imageSchool.Visible = False
      End With
      Dim f As New clsFunc
      Dim myDataTable As DataTable = f.GetDataTable("Select ID,County, Name, Description, 
Address, Principal, PhoneNumber, url from Schools where id=" & Me.dropdownSchool.SelectedValue)

      With Me
         .imageSchool.ImageUrl = "SchoolPictures/" & myDataTable.Rows(0).Item("id").ToString & ".jpg"
         .imageSchool.Visible = True
         Session("SchoolID") = CInt(myDataTable.Rows(0).Item("id"))
      End With
   End If
End Sub

But for a few curly brackets it's not too different to Java, C#, Swift, JavaScript, etc. Plus, I quite miss the 'with' statement that let's you work with a single object in a sort of (what's now called) fluent manner.

However, after reading a few Java books and watching lots of demos and code samples in C#, I fell for the hype and started to get the itch to make it feel a bit more special - to be one of the cool kids.

By the end of 2004 I'd re-written the code into C#. Surprisingly, it was not the train-wreck I'd warn against today if someone told me they're looking to change to Swift or Rust or some-such. The transfer was basically without drama. That said, it Brough no immediate benefits... at all, it just looked more fancy.

Today, C# is the first language of the dotnet ecosystem, with F# following up behind. Sample code is almost exclusively written in C# and, well, it makes sense to me today though, like all languages there are new fancy phrases popping up into popular culture every day... Dependency Injection, Closures, Lambda Functions, and of course async/await. As an old hack, I'd say that these new terms are just things that have always existed, we just didn't have names for them... turns out I've been using Dependency Injection since about 2006!

The codebase in 2005 is very recognizable today and it stands testament to the .NET ecosystem in general. Yes, we have dotnet core today which seems to be a cleanup but is essentially the same but different.

What language would you pick for a new project today, what's the Fashon? Rust, Go, Swift? Would you ever pivot to a different language?


Tech deep dive:

Visual Studio 2003 was the tool of choice at the time, on Windows only. I admired the bold future that Java promised, remember "Write once, run everywhere" which translated to "Write once, debug everywhere" when the code hit the machine. It was however ground-breaking in one aspect - a Just-In-Time compiler, or JIT. For those that might not have looked under the covers, languages like Java and frameworks like .NET achieve their cross-platform ability by compiling the code, not to the machine's native instructions like Intel x86 but instead to an imaginary pseudo processor. The pseudo processor machine code wouldn't run directly on any CPU but instead could be further interpreted and/or compiled to the native code using a JIT compiler at run-time. The idea was that, each program compiled to the pseudo code or Intermediate language (IL) could be ported to any machine that had the simple JIT compiler built for that machine, e.g. one for Windows x86, one for Linux, Unix, Dec Alpha, Macintosh or, even, your fridge, your car, etc.

The JIT compiler had two issues, one real one and one fake one. The real problem was that the programs still had to talk to the lowest common denominator if they were to be cross-platform, i.e. what if you assume your user has a three button mouse instead of a two or one, or even a mouse at all! What if your machine didn't have a GUI? The fake problem was one of perception. Proper code written in C could be compiled to the native processor and that ensured the fastest execution speed and, at first, that proved to be true, the overhead of interpreting the code did impact performance, especially at startup. However, and I saw this first hand, over time, the JIT engines became better and better at first caching then re-factoring code, pre-compiling and storing blobs that might be re-used, actually re-writing common crappy code into better code! The realist was that, in the hands of regular programmers, this 'JITed' code was not only fast enough but often faster and, kept speeding up!

Ultimately, whilst Java has gained some cross-platform wins, ironically, I think that  .NET has ended up more successful in that space. Today, I write the code on macOS on a computer that has an 'Apple Silicon' 64-bit RISC processor and, I run the code under Linux with a 72-core Graviton processor, but can just as easily run it on Windows on a CISC x86, iPhone on ARM7, Android, on a Raspberry Pi with a Qualcomm chip or even, in a browser as WASM - now isn't that a surprising twist!

All these CPUs and operating systems are from different companies which didn't even exist when I wrote the code in 2003 but that code still fires up and runs smoothly today albeit a lot... lot... faster.