Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: [Informer Article] A Discussion on Programming Languages
PostPosted: January 28th, 2013, 11:59 pm 
Site Owner
Offline

Joined: September 9th, 2004, 9:26 am
Posts: 6878
Location: Wild Rose Country ca
RS Name: shane12088
RS Status: P2P
This topic come from Earth, one of our editors here at Informer. A while back he asked me to write about various different programming languages and their differences. A knowledge of programming languages is essential because often the type of project we are working on dictates which programming language is ideal. Also, some languages are more suited for learning programming in general; this is very important for first time programmers. Overall, choosing a programming language blindly is not a great way to start a new project, hopefully by the end of this article you'll have a better idea of where to start your journey.

Before we begin I'd like to talk briefly about the types of programming languages that exist. There are literally hundreds of programming languages that fit into almost as many categories. Some examples of the many categories are assembly languages, procedural languages, object oriented languages, declarative languages, and interpreted languages to name a few. Languages may also fit into many categories, for example PHP is an interpreted language but it is also a procedural language with object oriented components. It's not uncommon for languages to span multiple categories, that's what makes a language powerful. The categories the language falls into does not determine which language we should use but it sometimes lends us a hand in deciding.

I prefer to class my languages together based on platform. Today to keep things simple I am going to class languages discussed here into three categories: desktop, web, and other. Before I begin talking about a certain set of programming languages I'd like to highlight the TIOBE Programming Community Index. The index is a list of popular programming languages and tracks their relevance over time using search results. I'll be discussing most of the languages in the top 10 and a few others.

Desktop programming languages will today be discussed starting with high level languages going down to the very low level languages. Now you might be asking, what's high level or low level language? A high level language provides a great amount of features to the programmer in order to reduce the amount of time spent programming (we hope). High level languages in general also provide less access to the hardware, this fits into the theme of making life easier for the programmer. As we move towards lower level languages the programmer is responsible for implementing most of the utilities and features that will be needed. Lower level languages also provide easier access to the running hardware. An example of this can be seen if one writes a program to access the system network hardware. If a programmer is using Objective-C they will simply call up the specific functions to create a connection to their server. It gets better, if using an API for a service (Dropbox) they can simply ask for a connection. If this was being written in a lower level language such as C the programmer would have to go through the tedious process of creating the socket and connection in order to achieve the same result. Overall programming in lower level languages provides more control but also requires more patience and forethought. The higher level languages reduce this greatly but at the cost of not being able to access system hardware as easily.

Higher level languages are plentiful today as evident by most of the top 5 on the TIOBE index. The three high level languages that I want to focus on are Java, Objective-C, and C# (C-sharp). Java is the multi-platform language that we all know and use; it's what is used in RuneScape. Objective-C is the programming language that's widely used to create applications for Apple's OS X and iOS. C# is used to create applications for the Windows environment.

Java acts as a bit of an outlier here due to the way it operates but it has enough similarities to sit in this same camp. Java's benefit is that Java code written on one platform will be guaranteed to work on another. This is accomplished by the use of a virtual machine, this is what sets Java apart from Objective-C and C#. The Java virtual machine is what a user installs when they install the Java Runtime, it runs the code provided by the application. When the programmer compiles their Java program the program is compiled down to byte-code. This byte code is portable and is what is run on the Java virtual machine. This translation of needing to run the byte-code and convert it to system native code is what causes a slight performance hit while using Java.

Now that the slight difference in the way Java works is out of the way we can talk about high level languages. As stated previously high level languages provide abstractions in order to make life easier for the programmer. These abstractions are useful in that they often force us to write code once and not repeat ourselves. Writing code once is always better because it reduces time coding and it also reduces the chances of a bug appearing in our code. This is partly accomplished by the fact that these languages are object oriented which means they focus on creating "things" rather than doing specific "procedures". For example in a todo list app one might declare a Task object and a TaskList object in order to create our app. Later we might decide we need a PriorityTaskList which would inherit (meaning use all the code) from our main TaskList object. As previously mentioned setting up a connection to a network service might be a one or two line operation compared to having to write code to access the network hardware in a lower level language, this can be attributed to the object oriented nature of these languages. Higher level languages used to be considered slower than their lower level counter parts but in general they are fast enough for most applications one will want to make. If anyone you talk to thinks otherwise just have them look at RuneScape or any of those games you play on your smartphone (Android uses Java).

The next set of languages I'd like to talk about are still considered high level but aren't as high level as Java, Objective-C, or C#. This is primarily because they are not pure object oriented languages. There are two languages in the top 10 of the TIOBE index that fit in this list, Visual Basic and C++.

Visual Basic was popular a few years back for its ease, people I know have even started programming with it even though that's not recommended anymore. Visual Basic fits in this category because it has the full power of the operating system behind it. Visual Basic may be used to create anything from Microsoft Office macros all the way up to full Windows applications. Visual Basic also used to be a common way for newcomers to dip their feet into the pool of programming.

C++ is the other language in this category. As you might expect it's an evolution of C which we'll talk about shortly. C++ offers programmers the power of the C language but with an increased toolset to make programming easier. C++ is a procedural programming language which means that more often than not small collections of code (called functions) are created. These functions are then called from other locations in the code. With proper discipline functions can be almost as elegant as object oriented code. C++ features object oriented programming as an option but does not make it a requirement. C++ object oriented programming itself is a very loose form of object oriented programming and can be more powerful than any of the higher level object oriented languages if desired. Applications written in C++ can include a whole myriad of applications from Skype, games, and more.

Moving down a level from C++ and Visual Basic is C. C is the precursor to C++ and is extremely low level. C is about as low level as one can program without using assembly language. C is often used for tasks where performance is critical, but it's also used where extensive access to the system hardware is necessary. Most device drivers are written with C, it wouldn't make sense to use Objective-C to write a video driver, would it? When using C it's not uncommon to access the individual bits of the system memory to perform operations. While using C it is the responsibility of the programmer to manage memory of anything that is not a primary type (integer, floating point value, character). This makes C hard to use for some people but it's also a hallmark of efficiency as you, the programmer, only use the memory that is needed. Examples of where C is used are applications including games, device drivers, operating systems, and Unix system utilities.

Many might not believe this but it is possible to go one level lower and interact directly with the hardware. The vast majority of modern CPU architectures include an assembly language. The whole point of assembly language is to interact directly with the hardware, hence why they border on the edge of human readability. Rather than using variables with specific types and having the programming language manage the variables the programmer must load and store variables manually in system registers. System registers are actual physical components on the systems CPU that are reserved for various types of storage (integer, floating point, etc.) Assembly language is also able to leverage the actual hardware instructions that reside on the CPU. For example JMPZ might be an instruction that means jump to a certain marker if the given value is 0. This example illustrates that not only does the programmer need to manage storage but they also must manage program flow! Steve Gibson of the Gibson Research Corporation and host of Security Now writes each one of his Windows utilities in assembly language. His applications showcase the power of assembly language and the small footprint they occupy. You can read more about his assembly language setup here.

Overall desktop programming languages range from high level to low level. They all have their respective uses and excel in that area. The language in use is generally governed by the platform being written for and what the end objective is going to be. Overall desktop program languages provide a great deal of speed and this speed can be enhanced by moving towards the lower level languages.

Now that we've covered different types of program languages for desktop computers and devices I'd like to talk briefly about web programming. In the recent years web programming has become an important discipline. In the past it was accepted that there might be a bit of programming on the web in order to make websites more customizable for the user or to initiate e-commerce. Now it's entirely feasible to have an application that exists on the web entirely and just like desktop programming there are a variety ways to implement such an application.

Two of the earliest web languages used were PHP and Perl. They're still used today but there are other choices that people find more desirable as they give them a programming environment similar to that of one of the high level desktop languages discussed. PHP and Perl are both interpreted languages, this means that when the user requests access to a certain script the PHP or Perl interpreter simply reads the script file and executes it. PHP is running the application used to manage the RSBANDBInformer! articles, PHP is also what Facebook uses. PHP's closest analog in terms of desktop languages is C, meaning if you're comfortable with C or C++ you'll be very comfortable with PHP. Perl has waned slightly in popularity but it's not uncommon to see it online in 2013.

The web also has its share of high level languages. The web 2.0 era of the second half of the 00s brought about the much appreciated and sometimes despised web framework. Web frameworks took mid-level languages and gave them high level features. These features allowed for rapid development of all the web apps that we saw but they had an unfortunate downside. They did not scale. The weight added onto these languages with the web frameworks meant that in some cases with an influx of traffic the web app would simply break. Remember the Twitter "Fail Whale"? That's what was happening. This has largely been mitigated for small to medium developers with the advent of cloud computing and simply being able to throw more CPU cores at the application for a very cheap price.

One of the most popular web frameworks is Ruby on Rails (RoR). RoR uses the Ruby programming language and allows for quick prototyping and application development. Twitter uses Ruby on Rails and has done so quite successfully. It's important to note that if you are using a high level web framework that it's very important to keep in mind that with a huge influx of traffic it could become very hard to manage your language.

Another language that can be expanded to use high level frameworks is Python. Python can also be used on the desktop to create applications as well, that makes Python very interesting. One of the common frameworks for Python is Django. Two very intensive media sites Instagram and Pinterest use Django. As with Ruby on Rails, Django would also have the same issues of scalability and it's important to keep in mind the scope of your application in order to avoid pain in the future.

There's one more web language that I'd like to discuss before moving on to two oddballs. JavaScript. JavaScript started out in the 90s as a way to do interesting things with web pages, make it snow, prevent right clicking, or make the status bar dance with text. Now JavaScript has become a full programming language for use on the web. A developer might use a toolkit such as jQuery to assist with client-side scripting (JavaScript code that will be executed by the browser). It's also common to use object-oriented JavaScript in concert with jQuery. There are also smaller toolkits to provide a more structural form of JavaScript, one of my favourites is Backbone.js. Finally there's one more interesting thing, JavaScript can be used server side. There's a technology called node.js that enables JavaScript to be used not only in the clients browser but also on the server to perform more intensive tasks that might require accessing a database or other libraries.

Overall web languages are not new but they are increasingly receiving more attention due to the reality that almost everyone wants an application that can be run anywhere. Web languages went from sporadic use to being an almost certainty with the whole web 2.0 fad that was the latter half of the last decade. The vast majority of web languages are interpreted meaning they are never going to provide the performance of the compiled code on our desktops but nevertheless they are a great option.

As I mentioned there are two oddball languages left that I'd like to highlight. So far our discussion has focused on object oriented and procedural languages. This means that the languages either focus on creating objects to represent data and manipulate that data or they use smaller blocks of code (functions) in order to accomplish the same task. Both methods are novel and provide a great deal of control. There is a subset of languages that are non-procedural and non-object oriented. These are especially interesting when looking at just what they can do. Two languages that fall into this area are Lisp and Prolog.

The name Lisp comes from the original focus, "LISt Processing". Lisp is a fully parenthesized language meaning that each expression in the language is enclosed in parenthesis and the entire program can often be represented with one set of parenthesis. Lisp is used today in the Emacs text editor for configuring the editor. It's also common for Lisp to be used in computer science programs to teach recursion. Overall Lisp is a very powerful language and provides a new perspective on programming.

Prolog is a language focused entirely on logic. Prolog is a language that is used to teach formal logic. Prolog also has certain advantages for academic research problems. An example of this might be using Prologs constraint logic programming extension to enable solving a finite domain problem quicker than a procedural language would solve the same problem. Prolog was a fun (although challenging) language to learn in that it looked nothing like any other language that I've used.

If there's enough interest I'll cover a few of these languages in much more depth. Overall though, I hope you've enjoyed this discussion on programming languages and if there are any questions don't hesitate to post them!

This was originally posted as an Informer Tech article.

_________________


Top
 Profile  
 
 Post subject: Register and login to get these in-post ads to disappear
PostPosted: January 28th, 2013, 11:59 pm 
Site Owner

Joined: September 9th, 2004, 1:47am
Posts: 9047
Location: In your web browserz


Top
  
 
Display posts from previous:  Sort by  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Jump to: