Monthly Archives: July 2014

How top 10 programming languages work

TIOBE index: July 2014

I am programming for more than 10 years. I realized that, when I found my first, personal home page (written in PHP) on my hard drive. Some files have last modification date: May 2003. Since that time I was working (or playing) with 9 of top 10 programming language from TIOBE Index list. As I mentioned, I started with PHP, then I learnt a little bit JavaScript (to create fancy menus or ‘secret pages’ on my website). In high school I started learning C++. At the University I learnt C, more C++ and Java. Then I learnt C# on my own, and it is still my favorite language. Along with C# I learnt ASP.NET and T-SQL (to be able to create websites with databases). I also learnt Python and Objective-C. Former became useful when I started my Research Assistant Job.

More experience I gain, more interested I am in how things work underneath the code level. In this post I want to provide short description of the Top 10 programming languages (by TIOBE Index), how they work and their super short history.


Interpreted language created by Rasmus Lerdorf. Originally, collection of Perl scripts, rewritten to C for performance reasons, ability to work with web-forms and communicate with databases. Most popular interpreter: Zend Engine. Since PHP 4, the PHP parser compiles input to produce bytecode for processing by the Zend Engine. Facebook developed two PHP interpreters: HipHop (transforms the PHP scripts into C++ code and then compiles) and HipHop Virtual Machine (converts PHP into a high-level bytecode, which is then translated into x86-64 machine code dynamically). Recommended book: PHP and MySQL Web Development.


Dynamic, interpreted and prototype-based language. JavaScript is superset of ECMAScript standard. Usually used as part of web browser, but also in server-side (Node.js) or even for desktop and mobile application development. Current browsers perform just-in-time compilation. There are many JavaScript engines (interpreters): Rhino (written in Java), SpiderMonkey (written in C, first JS engine), V8 (written C++, by Google, used in Google Chrome), Chakra (performs JIT compilation on a separate CPU core, parallel to the web browser; created by Microsoft, used in Internet Explorer) etc. Recommended book: JavaScript: The Good Parts.


C is compiled, static type language created by Denis Ritchie. It influenced many other languages, e.g.: C++, C#, Java, JavaScript, Objective-C, Perl, PHP, Python, and even Unix’s C Shell. C++ is nearly a superset of C, with object oriented features inspired by Simula language, created by Bjarne Stroustrup. C and C++ are compiled to machine specific code, thus platform specific compiler is needed. Most popular compilers: GCC and Visual C++. C++ evolve, Modern C++ (currently C++ 11 and vNext: C++ 14) introduces: smart pointers, for each (range for), lambda functions and much more. Recommended book: Ivor Horton’s Beginning Visual C++ 2012The C Programming Language (by Brian Kernighan and Denis Ritchie)  used to be one of the most popular programming books ever.


C-based language created by James Gosling, which introduces automatic memory management by Garbage Collector. Java is compiled to bytecode (.class files), which runs on JVM (Java Virtual Machine). Its main design goal is “Write Once, Run Anywhere” (WORA). The same code can be compiled to the same bytecode on different machines. Then JVM (platform-specific) translates bytecode to particular machine code during run-time (Just-in-Time (JIT) compilation). Java applets can run in web browser. My personal recommendation for Java book is Hortsmann’s Core Java Volume I – Fundamentals and Volume II – Advanced Features. Well known Java book is Bruce Eckel’s Thinking in Java.


C# is Microsoft’s version of Java language created by Anders Hejlsberg. However, C# is closer to C++ in case of design and syntax. It is compiled to Intermediate Language (equivalent of bytecode in Java) and runs on Common Language Runtime (equivalent of JVM). C# also uses Garbage Collector. It has many features not existing in Java like rich native interoperability, query language (LINQ) or dynamic type. For more, check Comparison of C# and Java. Book for quick start: Sams Teach Yourself Visual C# 2010 in 24 Hours recommended by Eric Lippert (former developer of C# compiler). To dive in, check: C# 5.0 in a Nutshell: The Definitive Reference by Joseph Albahari and Ben Albahari, C# in Depth by Jon Skeet and CLR via C# by Jeffrey Richter.


Dynamic, interpreted language, created by Guido van Rossum. Most popular implementation: CPython (implemented in C). It compiles Python programs to intermediate code (.pyc files) and runs them on Virtual Machine. There are many other implementations, e.g. Jython, which compiles Python to Java Bytecode (.class files). Python is much more expressive language than C or Java. Some constructs, which needs 10 lines of C code or 3 lines of Java code, requires only 1 line in Python (check reverse words example in my post about Python). Python uses whitespace indentation, rather than curly braces or keywords, to delimit blocks. To get started I recommend Google’s Python Class (videos section) created by Nick Parlante. Other resources: Python tutorial and Dive into Python. You can also check my post Python jump start for more details.


Strict superset of C language with object-oriented capabilities inspired by Smalltalk. Every C program can be compiled by Objective-C compiler, C code can be included within Objective-C code. Most popular compilers: Clang and LLVM. Instead of calling methods (like in C++: obj->method(param)), messages to objects are being sent ([obj method:param]) and resolved at runtime (not at compile time like in C++). There is no Garbage Collector (which works at run-time) in Objective-C, but instead Automatic Reference Counting (compile-time feature) is used. Objective-C is the main programming language used by Apple for the OS X and iOS. However, in this year Apple announced plans to replace Objective-C with new Swift language. Resources to learn Objective-C can be found in my other post.


Declarative language for managing data held in a relational database management system (RDBMS). Created by Microsoft (for MS SQL Sever), T-SQL is an extension to SQL, which makes it Turing complete. It adds to SQL: procedural programming, local variables, functions for string and date processing, mathematics etc. and allows FROM clause in DELETE and UPDATE statements (which allows joins to be included). T-SQL (and SQL) query differs from program in such a way that they just tell what to do, not how to do that. Figuring out how to execute query is a role of query analyzer. Check Understanding how SQL Server executes a query.  To learn T-SQL, you should learn SQL first. Recommended tutorial: T-SQL Step by Step Course (video tutorial). Recommended books: Itzik Ben-Gan’s Microsoft SQL Server 2012 T-SQL Fundamentals and other his books.

(Visual) Basic (.NET)

Compiled language created by Microsoft. Compiles to native language or P-Code and uses the Microsoft C++ compiler to generate the executable. It derives from BASIC. Similar to Python: tabs and new lines are used to delimit blocks. VB (under Visual Studio) allows to create GUI using drag-and-drop technique. Last version (VB6) was released in 1998 and is abandoned in favor of VB.NET, which introduces many features (present also in C#), but still supported, even on Windows 8. Check Comparison of VB and VB.NET. Both (VB.NET and C#) run on the same run time (CLR). More details can be found here. Recommended tutorials to get started: Visual Basic Fundamentals: Development for Absolute Beginners by Bob Tabor and Visual Basic .NET Tutorials. Good reference is Visual Basic at Wikibooks. To get VB syntax highlighting in SublimeText, this package works.


I read about all 10 languages in Wikipedia before writing this post. I was surprised how much I could learn in 5-10 minutes reading. I don’t know why, but I feel much better now, when I refreshed and organized my knowledge. If you want to start learning about new programming language, I recommend you to read about it on Wikipedia first. Even more, read about all languages you are using now on Wikipedia as well. It gives you great, high-level overview. Now, Wikipedia will be my start point of research about “some new thing”.

Installing Mac OS X in VMWare Workstation on Windows 8

I created Mac OS X Virtual Machine on VMWare. It wasn’t simple process, so I decided to share this experience. I was following this article. Here is an outline:

  1. Download and install VMWare Workstation. But to do that, you need to disable Hyper-V first.
  2. Download VMWare unlocker and run windows/install.cmd script. It allows to choose Mac OS X system during VM creation later on.
  3. Convert Mac OS X image (Mountain Lion in my case) from .dmg to .iso (using dmg2img).
  4. Create VM for Mac OS X and choose created Mac OS X .iso file in new VM settings -> hardware -> CD/DVD (SATA) -> Use ISO image file
  5. Run Virtual Machine and install Mac OS X (described in mentioned article).
  6. Install VMWare tools (also described in mentioned article).

Once Mac OS X is installed and running I updated Mountain Lion to Mavericks. That was easy and went smoothly. Additionally I recommend to do following:

  1. Enable shared folders (they are located in /Volumes/VMWare Shared Folders/NAME_OF_FOLDER)
  2. Install TotalFinder
  3. Install iTerm 2
  4. Install Witch
  5. Install SublimeText 3
  6. Install Xcode (not only for iOS development, it contains e.g. gcc compiler)

Linux (Ubuntu) installation is much easier. You just download Ubuntu iso and create VM on VMWare workstation using downloaded .iso file. That’s it.

How to add Google Analytics to WordPress blog in the right way

I just found out, that Google Analytics was not counting my blog post pages. Only index page and all other subpages, but not post pages. This pages, which I am linking e.g. on twitter every time I blog!

From some time I was wondering if really only ~10 people are reading my blog. My last post about Getting started with iOS, was visited by 12 people in the day it was published and 10 in the day after.

iOS post stats

Then, on Google Analytics, I went to behavior > ‘site content’ > ‘all pages’ to check how many people visited the blog post page. And…there are no post pages in the statistics at all!

iOS post stats: pages

I knew that it is impossible, because at least I visited the post page. Then I checked statistics on Azure:

iOS post stats: Azure

There are no unique views, but even page views on Google Analytics shows less than 20 per day. I published the post around 11 am, and announced it on twitter 11:18am. Then I got 7030 requests between 12pm and 1pm. It makes sense. Of course 1 Azure request < 1 unique page view. According to Azure Management portal I had 62226 request in last week. How many unique pages views it is? I don’t know and I will never know. But I am sure it is more than 54!

Why Google Analytics didn’t track my posts? I put Google Analytics script in index.php file, in my WordPress theme directory. Apparently I forgot to check if it works for all pages.

Now, I installed Insert Headers and Footers plugin to insert script from Google. As recommended in How to Install Google Analytics in WordPress for Beginners. It seems to be working fine now. Here are statistics from today:

iOS post stats: after Google Analytics script fix

There are also other plugins like Google Analytics for WordPress or Google Analyticator, but they insert Google Analytics snippet based on communication with Google api. It means, that if Google change their API for Google Analytics, plugin may not work. I don’t want to be depend on that and just want to paste customized JS code I obtained from Google.

I also added Azure analytics script. Now, I will be able to cross-check the statistics.

Getting started with iOS Development


I started iOS development last year. Here, I would like to summarize all (good and worth to spend time on) resources I have been using since that time.


Unfortunately, or fortunately, there is only one right set of tools: MacBook and xCode. Of course you can use terminal and Vim but…


First step in learning iOS Development is to learn Objective-C. Good place to start is free Try Objective-C on CodeSchool. There is also Programming with Objective-C on Mac Developer Library, but it is more in documentation style, than tutorial. Choose whatever you like better. To get more deeply there is a great book written by Stephen G. Kochan: Programming in Objective-C. It is for beginners, but discuss all aspects of the language in details.

Programming in Objective-C

iPhone/iPad programming

To get started, there are two nice tutorials:

After getting familiar with the platform, it is time to become more advanced. My favorite, and the best in my opinion is Stanford course: Developing iOS 7 Apps for iPhone and iPad by Paul Hegarty. He is a great teacher. I really recommend you to go through all lectures and do all homeworks if you think seriously about becoming iOS developer.

Developing iOS 7 Apps for iPhone and iPad

To summarize and sort out your knowledge, there is another great book: iOS Programming: The Big Nerd Ranch Guide.

iOS Programming: The Big Nerd Ranch Guide



At the WWDC 2014 conference, Apple announced new programming language: Swift. This is something, that everybody was waiting for. Finally, we have higher level of abstraction in top of Objective-C, whose expressiveness was simply uncomfortable and not developer-friendly. Swift uses the Objective-C runtime, allowing Objective-C and Swift code to run within a single program. Swift is pretty new thing, but there is already a lot of online resources to learn it. Check Swift Cheat Sheet as high-level overview. More detailed starting point is Ray Wenderlich’s Swift Tutorial: part 1, part 2 and part 3. There is also nice To do list app video tutorial. For more, check Swift at Apple Developer website and free book The Swift Programming Language (bible, over 800 pages).


All of these resources will give you solid fundaments for iOS development. After getting familiar with them you will be ready to create your own apps and publish them on App Store. Of course it is not required to go through all of them before you start creating your apps. You can just go through basic tutorials and publish your app. However, it may save you a lot of time, which you will need to spend figuring out things. Additionally, you will learn how to do things in a right way.

UPDATE2: Recently, Udacity released beginner’s guide to Swift Playgrounds, and full blown Intro to iOS App Development with Swift.

UPDATE3: On iTunes, there is already available updated Developing iOS 8 Apps with Swift from Stanford by Paul Hegarty.