A Live Developer Journal

Exploring colleagues database connection script

Really awesome conversation with a colleague earlier. We were talking about impressions of different languages, why we were moving towards a different software architecture and lots more.

One of my questions was, what kind of language would be good to learn to connect to databases, and display the information on a webpage. That was a very rookie question, one that many beginner programmers ask.

The answer was, pretty much any language.

For some reason, I had thought that there were only a select few languages that would let me connect and interact with a database from a web-page. This is probably because when searching for 'server-side languages for the web', the results tend to be a few languages that people defend to the death over all other languages. At the time of writing, these languages are PHP, Ruby on Rails, Node.js and Python.

In reality, these are four of literally hundreds of languages that you could use. There is no reason to box yourself in. Some may argue that time resources are limited so there's no point focusing on a niche language that can't be found in mainstream job descriptions. I remember feeling this way when I was at the very start of my journey, and still fall into the same trap every now and again. The truth is, the tool you choose to use is not all that important, the concepts are.

From a server side perspective, there will be lots of things you will be able to do across ALL of those languages, like connect to a database, display data, add to the database, edit information in the database etc. All fundemental concepts that are transferable across each language.

Once you understand how to do each of these things in one language, it'll be retty trivial learning how to do them in other languages. Then you can start focusing on the really interesting stuff, like how does this language express this concept differently to this other language? Or, this language allows us to employ concepts I have never seen before, why do they use it, and is this something that proves to be an advantage over other languages, or a limitation? This is all part of the joy of programming for me.

Okay, so after having this conversation, my colleague sent me a link to a server-side connection script he wrote for the software we are all working on. Looking at the code, I immediately have a bunch of questions that are worth exploring. At the end of this excursion, I hope to have a better understanding of the syntax used, but more importantly, an idea of what concepts are at play. I have a little experience with PHP, which should help make the concepts a little easier to identify, as there is an existing frame of reference.

Exploring database connection script

At the top of the file, I notice that this connection script is stored in a specific sub directory. The directory structure looks like this: app_name/REST/events/lib/event_database.js

I know that the 'lib' directory stores production code... I just asked my colleague quickly and they said that this is a temporary folder to reflect a move towards the new system, which will have one lib folder.

Instead of trying to research all of the questions I have one by one at the moment, I'm going to list the observations questions I have as placeholders. A lot of them will be things that are less important to focus on that some of the other things I am trying to get the hang of right now, but also want to capture them.