A Primer on Programming Languages

There are many different programming languages that are built for many different systems.  Some programming languages are low level meaning they don’t have a high level of abstraction between the hardware and the language.

Assembly Language

An example of this assembly language.  Assembly language uses basic operations that the hardware knows how to compute.  The assembly language can have different instruction sets for different processors.  Assembly allows math operations, logic operations, and transferring between hard disks, memory, various levels of cache and registers.  Registers are the part of memory that are directly used by the processor.  If the processor does not have data in a register it must fetch the data from other memory.  Ideally it fetches the information from the source that takes the least amount of time.

Computers are built in such a way that they have different levels of memory.  Similar to how a person has short term memory and long term memory.  The different levels of memory are generally more expensive the faster they are like sports cars.  Registers are the fastest, if we could build processors will only register memory they could never be penalized by having to fetch data from sources that take more time.  In reality that is not the case, at least in consumer and corporate computers as I know them now.  If the processor doesn’t have the data in memory it must fetch that data from the cache.  The cache is a small set of memory that generally holds frequently accessed information in the main system memory (RAM – or random access memory).  If the computer does not have the data it needs in the cache, it will ask for that data from RAM.  If the computer can’t find the memory in RAM it will get the information from a hard disk.

Generally each step cost much more time and greatly reduces the speed of a processor. Luckily as technology has progressed we have more room on the lines to send that data across, so we can take the penalty in shorter amount of times and ideally pull a large set of data to make sure we don’t have to keep going back to RAM or hard drive for similar sets of information.  We call that system the bus.  Initially we had smaller buses that could only transfer small amounts of data.  Now we have larger buses that can transfer more data.

Assembly allows us access to those basic functions but not much more.  Assembly closely compiles to machine code which is directly run by the processor itself.  Everything a person wants to do in assembly they really have to do with those basic computer functions.  This is why higher level languages and abstractions were created, so more complex concepts could be expressed.

High Level Languages

The basic functions of a computer are great for doing math and transferring data but converting real world concepts into this kind of code is difficult.  Imagine building a house with only a hammer, wood, and a box of nails.  This can be done, but what about plumbing, electricity, insulation, the size of rooms, and other more complex concepts?  That is why higher level languages were built.

Computer Scientist don’t like reinventing the wheel all the time, unless the wheel is broken (many times though they think they can or need to reinvent the wheel).  Sometimes though the wheel is broken, and it needs to be reinvented or can’t be trusted as currently made, though that is a bit of a tangent.

Many programmers have worked hard to create both open source and closed source projects and generate abstractions above assembly with different languages.  These higher level languages can be grouped in to categories.  Some compile directly into machine code that can run on the computer.  They basically compile into object code which is like assembly.  Another type of languages compiles code into byte code, which is a set of instructions much like a processor understands, but then the virtual machine converts those byte code into actual instructions the processor uses.  Finally there are interpreted languages, like scripting languages where the code is not compiled and just interpreted by another program running on the computer.

Compiled Languages

Examples of compiled languages: C++, C, Objective C, FORTRAN, COBOL

Before the existence of virtual machines lots of programming was done in compiled languages.  Initially virtual machines did not have just in time compilation and did not have all the features they have today.  Some have argued that virtual machine programs run as fast or faster in some cases because of optimizations than the compiled counter part.

Pros: fast, does not add another layer of abstraction between the hardware and the program which could add to security or reduce security

Cons: generally tied to one platform, no just in time compilation, possibly more rigid and less expressive – tools like reflection might not be available

Virtual Machine Languages

Examples of virtual machine languages: C# and Java

In the time Java was created there was Unix, Apple, Windows, and Wang computers as well as more.  Having to recompile code for each different machine made distributing and packaging the same application for multiple computer types difficult.  The idea of write once and run anywhere helped drive the conception of the Java virtual machine.

Initially Microsoft also had their version of Java, Microsoft J++.  After some lawsuits they gave up on using Java but made another product which runs on a virtual machine, C#.  Virtual Machines have some power that allow a great level of abstraction from the systems that they are working on, with many different hardware vendors this can be powerful and help not tie developers to a particular hardware vendor.  This can also allow for powerful debugging, profiling, and security tools to inspect what is being run on the system.  With any level of abstraction, this could reduce performance or introduce security risks.

Pros: Does not have to be recompiled on different systems. Same Java code can run on Macs, Windows, and Linux.  Just in Time (JIT) compilation can allow certain optimizations for particular systems.  Automatic garbage collection, this allows developers not to worry about complexities around allocating and de-allocation of memory.

Cons: Might have a subset of functionality available to a particular system, could potentially not be optimized for running on that system, not bare metal – there is a layer of abstraction that could introduce security risks

Interpreted Languages

Example of interpreted languages: JavaScript, Python, Perl, PHP, Ruby

Interpreted languages or scripting languages generally have the ability to interpret each line of code and call a specific set of functionality based upon this versus actually compiling the code to machine code.  This works much like the virtual machine does without byte code, though some of the newer browser engines have the ability to compile this to an intermediate representation.  Also languages like JavaScript have the ability to minimize the code into more a more machine friendly format which could increase efficiency on both file transfer and performance.

Procedural (FORTRAN or COBOL)

Most of the original languages were functional.  They did not have the concept or objects or classes.  The moved to different parts of the application via procedures (blocks of codes with inputs and outputs).

Object Oriented

Object Oriented programming helps create an abstraction of real world objects.  The idea is that objects have both data and functionality.  An example object could be a Dog object.  Dogs have a height, weight, appetite, and breed which could all be data associated with the Dog.  They also have the ability to bark, fetch, run, rollover etc which would be part of their functionality.

Passing a Dog object around programmers can call different functions such as bark or eat and this could change an appetite variable within the Dog object.  In object oriented program there is usually a conception of hierarchies as well.  There could be an animal class which could have basic functionality and variables like height.  This could be extended as a Dog, a Cat, a Snake, a Dove class etc.  The sub classes can have different functions.  Dog could have a bark function, and a Dove could have a fly function.  They both could use the eat function specified on the animal class.

Wikipedia has an article on the greater complexities of this.

Strongly Typed Languages vs Loosely Typed Languages

Loosely Typed

Some languages like JavaScript developers can assign any variable type to a variable.  This is called loosely typing, the variables don’t require a specific type so they are not as stringent.  An integer, a float, a string, an object can all be stored in a var in JavaScript.  JavaScript can be powerful because this lack of type can reduce work for programmers and can allow reuse of functions for many different types, and can make the language less restrictive on the developer.

Strongly Typed

Other languages like Java and C++ require specific types to be assigned to certain variables.  I like other developers see this as a benefit as some of the errors can be found at compile time.  I also understand that this can require extra boilerplate code which can make development less pliable.  The strict typing will throw an error if you try to assign a String to an integer for example.  This forces the developer to deal with the issues before they are in testing or production rounds.  This strict typing can be worked around by other mechanics within the language and can be useful at times.  Such as that every class in Java is an Object, so if a developer writes a function that takes Object as the input any class can be passed to that function.

Programming Language Performance

I have not done performance testing on this so I will leave that up to other articles to prove or disprove.  A lot of money can be won or lost and there are legal restrictions around published performance results.  This is understandable as vendors wish to show their technology in the best light possible.  It is also understandable that as a user of the the software you would want to know its strengths and weaknesses.  So my personal suggestion would be write your own performance test on multiple languages and run them in a disconnected isolated environment without other programs running.  Preferably on machines you know haven’t been compromised.

A Few Words On The Industry

Many developers have worked many years with certain technologies.  Their resumes and their well being is attached to whether or not a technology succeeds.  I have a personal experience with that.  I was using Apache Flex which uses the Flash run-time environment and after Steve Jobs discussed Flash being insecure and the reason Macs crashed the industry started shifting away from Flex.  Even good technologies can fail if politics change around us.  Programming work generally pays pretty well, given my own life experience I would suggest saving because you don’t know when and if the politics about a certain technology might change around you or what kind of health problems you might experience.

I believe in charity and trying to help others and this is also important to understand.  I am currently going through bankruptcy and had been extremely close to bankruptcy years previous.  People sell the tech sector as always having work.  Some bosses get very stringent on exact requirements for developers and can make matching your skillset to their needs difficult.  Further developers are competing on a world market where great developers from other countries have great skillsets as well.

Strict regulation and high wages in the US can make it more difficult for US companies to compete on the world stage.  Some executives will decide they have to outsource or find it more cost effective to outsource to other nations.  Businesses are for profit though they should also look out for the people that make them great, and finding that balance is not always easy.  Not all businesses are looking for there to be a balance and my guess is that will be the downfall of that business overtime.  Focusing only on short term profits can bankrupt organizations but so can shifting technologies, too much red tape, bad PR, or many other reasons including those that are unforeseeable.  So short term profits might be all a person gets which is why saving and being smart financially is important, as well as learning new skills and keeping off the bad PR radar.

When times get tough people might leverage any of your personal problems as a reason to keep their jobs.  I would advise being exceptionally careful in merger situations as technology companies generally only need one set of infrastructure to complete a particular task.  Ideally companies would work together to find new positions for all those in the other organization but that might not be the optimal amount of labor to compete against the competition on an increasingly worldwide market.  This mindset does not just apply to organizations at large, it can also apply to teams competing with each other for funding, or even people on a particular team trying to climb the corporate ladder.

All that said I don’t want to scare people away from the industry I would just like them to understand some of the difficulties I have faced in my life and hopefully give a fuller picture of what the computer development industry is like.  I can’t say there are perfect fixes to any of these problems though if you are struggling through or have struggled through similar things know you aren’t alone.

Published by techinfodebug

Flex and Java Developer, Christian, Art, Music, Video, and Vlogging

Leave a comment