1. Introduction

The significance of language for the evolution of culture lies in this, that mankind set up in language a separate world beside the other world, a place it took to be so firmly set that, standing upon it, it could lift the rest of the world off its hinges and make itself master of it. To the extent that man has for long ages believed in the concepts and names of things as in aeternae veritates he has appropriated to himself that pride by which he raised himself above the animal: he really thought that in language he possessed knowledge of the world.” Fredrick Nietzsche.

Every computer programmer has few comments on how his programming language of choice is the best. There are common attributes that most programmers want, like an easy to use syntax, better run-time performance, faster compilation and there are more particular functionalities that we need depending on our application. These are the main reasons why there are so many programming languages and a new one being introduced almost daily. Despite the large amount of interest and attention on language design, many modern programming languages don’t always offer innovation in language design for example Microsoft and Apple offer only variations of it.

It is not too far in the history when C stepped into the world of computing and became the basis of many other successful programming languages. Most of the members of this family stayed close to their infamous mother and very few managed to break away and distinguish themselves as an individual being. The computing landscape however, has changed considerably since the birth of C. Computers are thousands of times faster utilizing multi-core processors. Internet and web access are widely available and the devices are getting smaller and smaller and mobile computing has been pushed to the mainstream. In this era, we want a language that makes our life better and easier.

According to TIOBE Index, Go and objective C were amongst fastest growing languages specially in 2009 and Go was awarded “Programming Language of the Year” in the very same year. TIOBE obtain its results on a monthly basis by indexing. Indexing is updated using the data obtained by the links to certified programmers, training and software vendors. This data is assembled for TIOBE via the Google, Bing, Yahoo, Wikipedia and YouTube search engines. The results was more predictable for Objective C as it is the language of the iPhone and Mac, and Apple is running strong in the market. However, this result gets more interesting because it has not been long since the technology darling introduced her own programming language called GO.

2. A Little Bit Of History

Go’s infamous mother Google has dominated search, e-mail and more. So the introduction of a new programming language is not a shocker! Like many of Google’s open source projects, Go began life as a 20 percent time project which Google gives to its staff to experiment, and later evolved into something more serious. Robert Griesemer, Rob Pike and Ken Thompson started its Design and Go was officially announced in November 2009, with implementations released for Linux and Mac OS platforms. Google released Go under a BSD-style license, hoping that the programmer’s community will develop and build Go into a viable choice for software development. At the moment, Go is still very young and experimental. Even Google isn’t currently using Go in large scale production of applications. While the site that’s hosting the code is running a server built with Go as a proof, the primary purpose of the release was to attract developers and build a Go community around it. Despite its uncertain status, Go already supports many of the standard tools you’d expect from a system language.

Objective C In contrast has a longer and broader history. Today it is used primarily on Apple’s MAC OS and iPhone. Objective C is the primary language used for Apple’s COCOA API. Objective C was created by Brad Cox and Tom Love in the early 80s at their company StepStone. In 1986, Cox published the main description of Objective C in its original form in the book “Object-Oriented Programming, An Evolutionary Approach“. Since then, Objective C had been compared feature for feature with other languages, and now it is Steve Jobs’ language of choice.

There are many aspects that contribute to the design, and success or failure of a programming language. In this article, I attempt to give a general comparison of these two arguably very important languages of the future.

3. General Comparison

These days, the world is full of programming languages and they are becoming more and more general and all-purpose, but they still have their specializations and characteristics, and each language has its disadvantages and advantages.

Languages can generally be divided into many different categories. The following Table isn’t a complete list of all the possible comparable features. Features which were thought to be of somewhat more importance in comparison of the two chosen programming languages were selected and a brief explanation of each one is given.

3.1 Paradigm

Objective-C is an imperative object oriented language, meaning objects can change state. Objective-C also gives you the full power of a true object-oriented language with one syntax addition to the original C and many additional keywords. Naturally, object-oriented programs are built around objects, so in Objective C, objects are the roots of everything. A class is used to produce similar objects, called instances of the class. Classes are used to encapsulate data and methods that belong together. Methods are the operations that Objective-C applies to data and are identified by their message selectors. Objective-C supports polymorphism meaning that several classes can have a method with the same name. Also Single Inheritance is used for code reuse. The closest that can be achieved to obtain multiple inheritance is to create a class with instance variables that are references to other objects. However, the Objective-C philosophy is that programmers do not need multiple inheritance and it discourages it.

In GO things are a little bit different. The Go designers selected a message-passing model to achieve concurrent programming. The language offers two basic constructs Goroutines and Channels to achieve this paradigm. In their design FAQ, Google writes that GO is and isn’t an object oriented language! Although Go has types and methods and let us simulate an object-oriented style of programming, there is no type hierarchy. Lack of type hierarchy makes “objects” in Go to be much more lightweight than object in Objective C. Go utilizes an innovative approach to objects and programmers are not required to worry about large object trees. Since go isn’t a truly object oriented language, a programmer can solve the problem in whatever way he wants and still enjoys the Object Oriented-like features.

I can’t really think of any object oriented language which does not have a hierarchical inheritance mechanism. But for those who do have it, it seems to create a better model for flexibility and reuse. Absence of Inheritance in Go is interesting indeed! As far as I remember, Inheritance has always been taught to me as the punchline of object orientation. The reality is that inheritance is not the only possible mechanism for reuse in object orientation. Composition arguably is a more powerful mechanism for sharing behavior than inheritance.

Object-oriented programming became very popular specially in big companies, because it is suitable approach for the way they develop software and it increases their chances of successful project using teams of mediocre programmers. Object-oriented programming implements a standard for these programmers and prevents individuals from making too much damage. The price is that the resulting code is full of duplication. This is not too high a price for big companies, because their software is going to be full of duplications anyway.

3.2 Syntax

Objective C is an extension of standard ANSI C, existing C programs can be adapted to use the software frameworks without losing any of the work that went into their original development. In Objective C, Programmer gets all the benefits of C when working within Objective C. Programmer can choose to do something in an object-oriented way like defining a new class, or, stick to procedural programming techniques. Objective-C is generally regarded as something like a hybrid between C and Smalltalk. One setback due to the learning curve could be the necessity of having the basic knowledge of programming in C before entering the world of Objective C. C like syntax and Object-oriented programming, often presents a long and difficult learning curve to new programmers and Objective C is also not an exception.

Go is a C family member also, but I think Go manages to break the coding style and somehow makes it different. Compared to Objective C, declarations are backwards. In C, the notion is that a variable is declared like an expression denoting its type like in Basic, which is a nice idea in my opinion.

in Go: var a, b *int;

I find Go closer to a human natural language for example this statement: “Variable a is integer” can be shown as:

var a int;

This is clearer, cleverer and more regular.

Go also permits multiple assignments, which are done in parallel.

i, j = j, i // Swap i and j.

Control statements in Go do not accept parenthesis. While the most common control statement, if, would take the form of “if ( self ){” in Objective C and most of the other OO languages. But in Go, it would have the following form:

if self {

Another difference in Go is that semicolons are not recommended. However, you can terminate any Go statement with a semicolon optionally. In reality, semicolons are for parsers and Google wanted to eliminate them as much as possible. A single statement does not require a semicolon at all which I find rather convenient.

Go is a compiled language similar to a C. There are two Go compilers currently available, one for the x86 platform and another for AMD. Compilation speed of Go is very fast. When I first tried it (without any intended or proper measurement), it was just too damned fast! My experiences with programming languages is limited and rather focused on Object Oriented languages like Java so I had never seen a speed quite like that! One of the fundamental promised goals of Go is to be able to compile things really quickly. According to the official Go demonstration video, Go’s performance is within 10 – 20% of C. However, I don’t think that’s really trust-worthy until we get some performance benchmarks in the near future.

3.3. Exceptions And Generics

Objective C does not have Generic Types unless programmer decides to use C++ templates in his custom collection classes. Objective-C uses dynamic typing, which means that the run-time doesn’t care about the type of an objects because all the objects can receive messages. When a programmer adds an object to a built-in collection, they are just treated as if they were type id. Similar to C++, the Objective-C language has an exception-handling syntax.

Go’s type system does not support generic types. At least for now, they do not consider them necessary. Generics are convenient but they enforce a high overhead in the type system and run-time, and Go cannot stand that! Like generics, exceptions remain an open issue. Go’s approach to Exception while innovative and useful, is most likely difficult for many programmers. Google’s codebase is not exception-tolerant and so exceptions are a similar story and they have been left out from the language. Instead, programmer can now use multiple return values from a call to handle errors. Since Go is garbage-collected, absence of exceptions is less of an issue compared with C++, but there are still cases where things like file handles or external resources need to be cleaned up. Many programmers believe that exceptions are absolutely necessary in a modern programming language. However, I like the no exception fact because I find exception handling in most languages ugly. In a language like Go, where it’s possible to return multiple values from functions, programmers can do things like return both a result and a status code, and handle errors via status codes.

3.4. Type Systems

Compared to other object oriented languages based on C, Objective C is very dynamic. Nowadays, programmers tend to choose dynamically typed languages such as Objective C. The downfall is that there is less information at compile time. This dynamicity means that we can send a message to an object which is not specified in its interface. The compiler holds detailed information about the objects themselves to use at run-time. Decisions that could otherwise be made at compile time, will be delayed until the program is running. This gives Objective C programs flexibility and power.

Dynamically typed languages have the potential problem of an endless run-time errors which can be uncomfortable and confusing. However Objective-C allows the programmer to optionally identify the class of an object, and in those cases the compiler will apply strong-typing methodology. Objective C makes most of the decisions at run-time. Weakly typed pointers are used frequently for things such as collection classes, where the exact type of the objects in a collection may be unknown. For programmers who are used to a strongly typed languages, the use of weak typing would cause problems so some might give up the flexibility and dynamism. At the same time and while the dynamic dispatch of Objective C makes it slower than a static languages. Many developers believe that the extra flexibility is definitely worth the price and they argue most desktop applications rarely use more than 10% of a modern CPU. I do not agree with the above justification that we only use 10% of the CPU. So what?! It is not a very good trend that the minimalist approaches aimed at efficiency and performance are being replaced by wasteful programs which are largely betting on the power of the hardware, and I personally prefer to work with a more static type checking.

Go also tries to respond to this growing trend of dynamically typed languages and it offers an innovative type system. Go ends up giving a programmer a language with a Pythonish duck typing. Go indeed has an unusual type system: It excludes inheritance and does not spend any time on defining the relationships between types. Instead, programmers can define struct types and then create methods for operating on them. Like Objective C, programmers can also define interfaces. Go is Strongly Typed, but the good thing is that it is not that strong! Programmer do not need to explicitly declare types of variables. Instead, Go implicitly assigns the type to the untyped variable when the value is first assigned to the variable. there is dynamic type information under the covers that programs can use to do interesting things.

3.5. Garbage Collection

It is very important these days to have garbage collection as one of the biggest sources of keeping everything clean and manage memory. In Objective C 2.0 Garbage Collection was introduced. It certainly was a good news for new iPhone and Mac Developers who might be very used to Java. Garbage collection simplified matters but still required programmers to be careful when dealing with the memory management. The Objective-C 2.0 garbage collector is a conservative collector meaning that not only developers have full access to the power of the C language, but also C’s ability to integrate with C++ code and libraries is preserved. A programmer can create the bulk of his application using Objective C, letting the garbage collector manage memory and where it’s needed, we can escape to the power of C and C++.

In Go, as a concurrent and multi-threaded programming, memory management is very difficult because objects can move between threads, and it becomes very difficult to guarantee that they will be freed safely once we want to get rid of them. Automatic garbage collection eases concurrent coding. Looking at it with the prospect of a person, like myself who is used to a high level, safe, garbage collected languages for many years now, so much of this is just a boring news. but in the other hand, in the low level world of systems programming languages, these types of changes are revolutionary, specially if the desired performance can be achieved. Go’s focus is on speed, and in garbage collection lies a performance overhead. Advances in the garbage collection technology however, allowed it to have it with no significant latency and enabled Google to include it in Go.

4. Future And Conclusion

There must be a reason behind the growth of the popularity of these two languages. Maybe the reason could be that when the light of Microsoft is declining; Apple and Google are rapidly taking over each with their own particular ecosystem. Go is a language promoted by Google, giving it an undeniable advantage in terms of popularity, reputation and technical coverage, and Objective C is supported by the might of the Steve Job’s empire.

Objective C enjoys the benefits of Cocoa libraries that ships with Mac OS. Mac OS X and the iPhone are the largest implementations of the language by a big margin. Recently, there has been a huge iPhone Applications trend and the potential to make easy money with easy programming projects is quite high. And I believe this very basic human fact will greatly contribute to the future growth of Objective C. Because the more developers use a language and test it in different situations, the better and the stronger a language can become.

Go is indeed an interesting language. With Google’s backing and resources, programmers can rest assured that Go will have some sort of a future even if not too shiny! I think the language has potential but it will be some time, not a very short time, before it can attract developers to drop their current platform and choose Go. Go still is a small language. It is experimental and is not recommended for production environments. There is no IDE integration and there are few code examples. Go is incomplete and they put out what they’ve got and encourage developers’ contribution. As an open source project backed by Google, I think Go will soon develop an IDE and an ecosystem, as it seems to be really well received as mentioned before on the TIOBE index. But it’s impossible to predict how big the ecosystem will get. If the language is able to generate an ecosystem, then things can go smoothly. I think there is a need to later put in support for the Windows operating system and also integrating it with Eclipse IDE to further expand it among programmers.

Apple and Objective C stress on object oriented programming and all of the documentation for the language is geared toward object-oriented programming. So in this sense there is a huge difference between Objective C and Go. But, like any other human or machine language, Objective C and Go are comparable by certain criteria and I tried to provide a general comparison between the two. However, it might take a very long time for the path of these two languages to actually come across. Go is young and full of uncertainties. This makes the comparison of these two programming languages rather difficult or maybe as my programmer friends say “impossible”. Go needs proper evaluation by unbiased referees for some time in order to be more comparable but I’m sure we will hear more about these two languages in the near future.



Source by Esfandiar Amirrahimi

Prince

Recent Posts

Putting Together Your Cleaning Business Portfolio

If you are already trying to put together your cleaning business portfolio, then this already…

2 years ago

Ideas for Financing a New Embroidery Company

Because the area of financing can be confusing, yet crucial to the success of any…

2 years ago

6 Tips To Becoming A Successful Entrepreneur

Its best for an average person to have an entrepreneurship mindest and build on their…

2 years ago

Entrepreneurship and Innovation: The Inconvenient Truth

Entrepreneurship and innovation: The popular beliefEntrepreneurs are widely believed to be the agents behind economic…

2 years ago

Work at Home Business Ideas

Here are some excellent businesses that you can start, operate and grow from your home.…

2 years ago

Three Reasons For Starting a Family Business

You want to start a business but also know you do not want to do…

2 years ago