0

A love of languages

 2 years ago
source link: https://derw.substack.com/p/a-love-of-languages?s=r
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

A love of languages

Some developers are content with the languages they use for work. Others experiment with other languages, and others still might make their own languages. All of these are fine! But I find myself in the second category. This is exploration of why I personally find languages so interesting — and further, why I have involved myself with language development.

I first got into programming because I really liked playing with computers, and I didn’t like school. So I would stay up late intentionally breaking and fixing my computers, so that I could help others over IRC and forums. The first bits of code I played with were some form of C++ drivers on my Linux system. I didn’t really understand what I was doing, but at the time the excitement of feeling like I was doing something unusual and cool drove me on. From there, I think I moved onto Bash. You might argue that Bash is not a great language for learning how to program, and you might be right. But I’d complete challenges I found online in Bash. Never under value the ability to easily connect existing tools together. Instead of writing my own search functions, I could just use grep. Instead of writing a bunch of plumbing code to make directories recursively, I could use mkdir -p.

From there, I believe my next language was C. There was a great book called Accelerated C++, which contains a bunch of exercises aimed at learning C++, but I’d do them in C. I don’t really remember why I chose C and not C++, but at the time I had been following Linux kernel development, and from my earlier experience with C++, I appreciated C’s simpler model. Having no formal education, I didn’t really understand OOP or templates. I just saw it as taking more steps do something that should be simple. At this point in my learning journey, implementing data structures and algorithms was still fun. It was exciting to think about how useful structures like lists could be implemented, and how they could be used.

My next progression was onto PHP 4. My main driver at this point was doing web backend stuff, particularly focusing on a photography CMS. It was a mess. I understood how to program enough to get things done, but not enough of PHP to understand how to use the class-based examples that were all over the internet at this point. I remember one particular phonecall with a friend I was working with on the side project, and they reviewed my code and asked me what $this did. I had no idea, but tried to explain what I understood about it. I was wrong. My favourite feature of PHP though, is variable variables. They allow you use the string value of a variable to reference another variable. Not amazingly useful but I love how confusing they can be.

At the same time, I would run into Perl and Javascript code a lot. Javascript at this point would be small client side functions designed just to have some visual effect, and doing AJAXy type things. I wasn’t fond of Javascript as a language. The syntax was not great, the developer experience was kinda bad. I liked what Javascript enabled: interactive experiences. I have the same feelings today. Perl I would run into when writing Bash scripts. Sometimes an entire script could be a single line of Perl, and at the time a lot of Linux tooling used it. I never quite understood it all myself, but the flexibility of the language along with the great interop with Bash and regexes is inspiring even today. My favourite programming language talk Temporally Quaquaversal Virtual Nanomachine Programming In Multiple Topologically Connected Quantum-Relativistic Parallel Timespaces...Made Easy, is all about how flexible Perl can be. These were the kinds of languages that I would use if I had to, but not experiment in or spend time implementing algorithms or data structures. MySQL was another language I picked up at this time - to this day, I love the power that SQL provides. So easy to transform and filter data. Similarly to early JavaScript, MySQL is used as part of a different language’s ecosystem. I particularly enjoy running queries directly against the database, and get frustrated whenever there’s an ORM or something hiding the raw query.

I don’t really remember how I got into Python, but this was the first language where I fell in love. You could use it for servers, GUIs, command line tools. It was relatively easy to pick up, and had a bunch of great integrations that meant you could use powerful libraries without C-style code. You’d get comments of Python having significant whitespace, but I literally can’t ever remember that being a problem for me. Just indent when you would like a regular developer. I started implementing games and maths homework in it. Project Euler was a great resource at this time, along with some other coding challenge sites. I couldn’t get enough of programming at this time: I had a cluster of old computers in my room running several different distros and various BSDs, and had a lot of fun programming utility programs for them. You know the best thing about Python? How trivial it is to turn a thoughts into something that actually runs. To this day, if I’m making a quick prototype, it’ll be Python that I turn to.

At school, I had elected to take the computer science course. Despite the course at the time accepting Python, VisualBasic.Net, and Java, our school staff only knew VB, and our school computers were too old to run .Net, so we used VB6. But there was another catch! The only license they had for us to run VB at home was VB4. I could’ve been writing Python but they went for a proprietary language that I couldn’t even use properly from Linux except via Wine. So that’s what we had to use. Never mind. I would finish the assignments minutes into the lesson, and spend the rest of the time taking the challenge further. It was my first encounter with Hungarian Notation too, which seemed like a good idea in a language which had a poor IDE experience. No more remembering whether age is a long or a short, now you have sAge. Safe to say, my interest in Hungarian Notation quickly died off. I also during this time tried looking for a better way of doing VB coding on Linux, and found Gambas. Gambas is also a GUI-driven BASIC language, I made some trivial programs in it, but sadly it wasn’t similar enough to VB to allow me to skip running VB. Our original teacher quit half way through, and since I had been programming for a few years at this point, I took over teaching. When I think of VB now, that’s what I get reminded of. Making silly example programs from a book but then completely changing it to be more fun. We also played with Scratch, making little games in it.

Forced to use Windows for school, I started looking for an equivalent of Bash there. There were some versions of bash for Windows, but I found Powershell to be more useful as it was installed by default on other people’s computers. The premise of Powershell is pretty interesting: where Linux shells work with text, Powershell works with objects. That means that Powershell scripts can take in full .Net objects, and interact with their properties and methods. Imagine instead of a taking a list of directories as lines of strings, you take a File object which you can call getFullPathon. That’s Powershell’s selling point, and it’s pretty compelling.

At the end of school, I started getting really into computer science theory. I started reading open material from American universities. They used to have a lot of great stuff out there, though I understand now more universities have been closing themselves up. Books like SICP provided a great deal of interest, and though I never particularly got into Lisps or Scheme, this book inspired me. I would start to learn Haskell around the same point, and I remember deeply struggling with monads. I didn’t understand how to make anything useful. It’s a problem that I think many newcomers to functional languages suffer with, especially those which focus on types. Great, now I have a type for representing a success and fail state, but how do I read and write to a file? I mostly confined my learning to Project Euler and katas, understanding how to use the type system but not how to integrate it into real projects. I also looked into Scala, which at the time seemed like a compelling way to avoid Java.

At university, most of our projects were in Java with no freedom. We were even told what IDE to use. I did not like the language, and the verbosity really bugged me. I could’ve gotten assignments done in half the time, even without the IDE auto generating code for me, in Python. I was also not a big fan of Matlab, another language they imposed on us. We’d have to remotely connect to the school network to get anything done, as they didn’t have enough licenses to allow us to install it on our own machines. Proprietary languages and tools have no home in my heart. The one language I did like from university however, was NetLogo. NetLogo is an agent-oriented programming language, based on the Logo language for visual programming. If you haven’t heard of agent-oriented programming languages before, imagine it as a way of writing OOP objects AI behaviours. I would make a ton of simulations in it, like an ocean, or a nuclear apocalypse. It came with a tool that you could create graphics with, and the main interface of the program would allow you to create buttons and sliders for controlling variables. One of the main novelty of the language is how simple it is to make a functioning visual environment. No need to worry about frameworks or tools, just get into it.

While I was at uni, I started a company with some friends. Our projects were generally in Python, Javascript, and PHP. But Go was getting some traction at the time, so over a Friday evening, I ported one of our programs entirely from PHP to Go, and found it great. Go at the time didn’t have all the tooling considerations it has now, but being able to quickly write code that compiled quickly was amazing. JSON support at the time was pretty weird, and I remember telling my friend “this web framework doesn’t support JSON”, and ended up patching it to run our own code. To this day, I still believe that Go is a great language for getting stuff done. I’m not the biggest fan of the error handling mechanics, but it beats exceptions for me. We also picked up a project that involved making a game, so we turned to Unity and UnityScript. At the time UnityScript was basically Javascript with "with" removed. I did all my Unity programming on an old Windows laptop that could barely run anything, because my main development machine was an Eeepc and Unity wouldn’t run on it. I’m not a major fan of tools where you have to use some kind of 3D tooling, so I generally avoid 3D games. But it was required in this case, and Unity has an interesting idea of being able to attach scripts to world objects.

I started reading on Reddit about Elm, a language that seemed interesting. It was like Haskell, but for the web frontend. A compelling idea. At the time it did all the graphics via a custom renderer, so I played with it a bit before deciding I couldn’t find an immediate use for it. A couple of years later, the first support for VirtualDom and Html came out, and then I started using it with a passion. I’d find any excuse to program something with it - it combined my love of Haskell with visual, practical things. Error messages that weren’t confusing. It also solved out of the box the question of how do I make something useful with this? I spent a good deal of time writing examples, providing online support, and talking to people about it. When I started my research at university, I even switched my topic half way through to be about Elm, and influence of functional programming on the web. I ended up implementing Stalk in it, a stack-based language intended as a toy language similar to NetLogo but running within Elm’s runtime. I also implemented a Whitespace interpreter during this time. We had a codegolf group at university, and the novelty of languages was a big fun factor for solutions. After uni, I worked at NoRedInk where I spent a good deal of my time in the Elm community, making libraries, tooling, advice and talks. Included in that effort was making Elm run server-side, and the first Elm-based compiler for (parts of) Elm. I also was working with a decent amount of Ruby code, particularly a Rails-based stack.

Post NoRedInk, I ended up at a Norwegian company with their own language called Uno. It was basically C#, but with support for inlining graphics code, shaders, and platform specific code. It would compile down to native code: C++, Java, C#, ObjectiveC. I ended up learning a lot about graphics programming as a result, and ObjectiveC. I am not a huge fan, but I appreciate the novelty of having different syntax for function calls and pointers.

I don’t remember when I picked up TypeScript, but it was at a point where I was writing Javascript a bunch for work, and somehow TypeScript had a heated debate with Flow, and TypeScript won. I’m pretty glad about that, because TypeScript has turned out amazing. The tooling is incredible - you can run a lightweight-ish editor like VSCode, and get amazing type information and errors in real time. No more sitting at the terminal once every function to see if it compiles. This is not particularly impressive to IDE users, but when you think about the old way of writing Javascript that relies on your memory to be correct, TypeScript is amazing. There is a lot that I would cut from it as a language, but if you stick to a common subset, the code is generally readable and scalable in a way Javascript never was.

In my personal time, I was making a bunch of games. I have my whole career, but at some point I was making one or two a week. PICO-8 (subset of Lua) entered my life, and I loved it. PICO-8 is a “fantasy console”: restricted hardware and software limits as if it was a physical console from the 16bit era. It comes with a built in pixel-based editor, a music editor, and code editor. You don’t need to use the code editor, so I usually use VSCode with the Lua setting turned on. The amazing thing about this tool is how quick it can be turn things around. Because of the limits, instead of writing abstract framework code like I usually do for programming, PICO-8 encourages you to only write what you need. I implemented a weird version tetris in it in a matter of hours.

While at NoRedInk, I had picked up some Elixir, and during university I had looked into Erlang. We used it at Omni for some of our critical infrastructure, and until last week when they started migrating it to a different provider, it had no errors. So I was a big fan of Elixir. But having used it for a serious amount of time, I’m not such a big fan. The story with types is not great. A lot of documentation is missing. It’s possible to write code that says it is typesafe, but it is not at all. Instead of relying on types to handle awkward situations, Elixir encourages you to just have errors. I don’t think I would use Elixir again on any new projects, though I do appreciate the step up over Ruby.

All these languages led me to Derw. I started it one day, pretty much as a thought of I haven’t done much programming language experimentation lately, let’s make my own. I can see where Elm has been, where Haskell has been, where Go has been. And I can put all that knowledge together, so that I can take pieces from each. I think that’s what most people who write their own languages or frameworks think: they can make a system that works how they want it to, rather than how it currently does. And that’s a great thing, because it means innovation is happening, driven by curiosity and not settling for what exists.

If I ever end up disinterested in languages and their design, that’s probably the day that I know programming is not for me any more. There is so much to learn, to experiment with, to experience. There are thousands of languages out there, each with their own story to tell, and their own way of telling that story. We should never settle for just one language or one way of doing something, because new languages and new approaches change how we view the world.

I hope this rambling was interesting, and maybe you learnt something new. And if not, I hope this will be a good source in the future for when someone asks why make another new language?


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK