Am I Lost Alone, in a World of API and Syntaxes?

Tonight, like many other nights, I sit looking at my personal projects. Often I open a file belonging to one of them and I'm immediately put off... I'm put off because in order to move forward, I have to journey into a fog of documentation. This is not a rant about having to read documentation. In fact I enjoy reading documentation. My problem is having to balance the syntaxes of so many programming languages in my head and APIs to a bunch of libraries. It makes me question myself; I'm I any good at this? At programming? I swear there are times when I forget how to even do the most simple things, like split a string in the language I'm working with. Lets see how many syntaxes there are to split a string in the languages I use:

C:
strtok(char *string_in, char *delimiter)

PHP:
explode(delimiter, string)

Haskell:
splitOn delimiter string

JavaScript:
String.split(delimiter)

Python:
str.split(delimiter)

Java:
String.split(regexp) <- a="" b="" character="" not="" plain="">but a regular expression

Go:
Split(string, delimiter)

So there are roughly 3 different ways to split a string amongst these languages. I often try using the non-existent split(delimiter, string) in PHP and in JavaScript. The odd time I'll do .split(delimiter) in PHP as well. It's also ridiculous how the arguments are reversed. It is hell. Another syntax related issue is declaring functions. So simple right? I don't really have an issue with this until I'm using Python, JavaScript or PHP.

def mybeatifulprocedure(var $argument_one):
A horrific mix of JavaScript, PHP, and Python.

I'm exaggerating a little here, but my complaint still stands. It doesn't cause any runtime issues, but having to re-remember how to declare a function is insanely annoying. This actually doesn't happen much in Python because I follow my own rule which is basically "Python is always simpler". As of writing this I remember them all because I've had the last 10 minutes to decide how to mash them together.

...Anyways.

How do people deal with this? I end up having to do this on a daily basis for many simple functions. Often my mind strays towards the Python-way of doing things, but sometimes not. It seems that object oriented languages make documentation easier to access, but when a library grows larger, it actually becomes more difficult.

As of writing this, I had to go out and run some errands, but had an epiphany.

What if the majority of these functions are just bad? Why is split called split anyways? Shouldn't it be tokenize, or something similar? Sure we are splitting up a string, but into tokens. In my mind, split should cut an array at a range you specify, such as split(ArrayOf(Characters), 3, 10), which will result in a new array. You would use another function, findDelimiterIndices() to find where the delimiters are in a string, and in our tokenize() function, we would call that and then our newly defined split() function.

Next complaint: APIs. I'm working on a personal research project called Universe. It is a theoretically infinitely-sized desktop. I began this project using C and Xlib. After learning how to use Xlib in my free-time and making a program that draws a "window map", I was told that XCB was the way to go. Fast forward a few weeks, and the code is now in pieces and I just have no motivation to move forward. Another example of this is with the NodeJS library Express. When I started using Express on Debian Wheezy, a recent version of Debian stable, apparently it was old. So old that the way to use the library had fundamentally changed. What the heck! It is impossible to keep up with either A) the APIs, or B) the documentation. None of it makes sense. Whenever I go do something it turns out the way I've been doing said thing is the old way. I won't get started on SASS/LESS/css-preprocessor, Coffee/type/*script, and Angular/Ember/Meteor/framework-name. That is a whole other mess.

Again, how do people deal with this? Do others feel like they are running to keep up? I get a gut feeling that the only way to avoid this is to use a single programming  language. Use that language like a toolbox. Mechanical engineers don't have 6 toolboxes in front of them that are 6 feet tall filled to the brim with extensions hanging off. I feel as if programmers do. I've actually been getting into Electrical Engineering and it's such a breath of fresh air to see that everyone uses one to two ways to express something and nothing more.

Maybe I'm just hopping around too much. I mainly use PHP for my day job and I find this issue is happening less and less with PHP. When I was learning Python it was the same; I could use Python no problem, and rarely had to look back at documentation.

Death to abundant programming languages, then? Or birth to "standard" syntaxes?

Good luck to those with the same problem.

----

After spending some time in ##programming, it appears that this phenomenon is common. A user there recommended I read "Feyman and The Map of The Cat". I recommend you do too. I won't paste the punch line here, because it is flipping great.

Comments

Popular Posts