Category Archives: Programming

Comparison of Programming Languages C, C++, Java, Python, R, Rust, Scala & C# – Part 1

Part 1 of a series on comparison between programming languages: C, C++, Java, Python, R, Rust, Scala & C# compiled from WIKIPEDIA

C:

  • Invented in 1970s
  • Used widely in operating systems and driver programming
  • Imperative, procedural, compiled and structured with low level access to memory
  • Cross platform capability
  • Has had influence on C++, Java, C# and other languages
  • Concepts: Functions, Data Structures, Input Output, Pointers, Run-Time polymorphism, Recursions, Static data types
  • Limited keywords
  • Directly compiles to machine instructions
  • Static, automatic & dynamic memory allocation possible
  • Runtime problems can happen in memory and other areas
  • No support for object orientation & functional programming

C++:

  • C with classes, extension of C
  • Support for object oriented, generics & functional programming
  • Compiled & low level memory access
  • Systems programming, embedded systems, games, servers and more
  • Standardized by ISO
  • Inherits & builds on top of most of the syntax of C
  • Static, automatic, thread & dynamic memory management
  • Templates with implementation of generics concept is possible
  • Operator overloading
  • Compile time & runtime polymorphism possible
  • Support for lambda expressions
  • Enum data type
  • Core & standard library with multi-threading, regular expressions, smart pointers
  • STL – Standard template library
  • Criticism: Overtly complex

Java:

  • General purpose, high level, object oriented, write once run anywhere
  • Java -> ByteCode -> JVM
  • Automatic memory management & garbage collection
  • Generics, Spring, Functional, JavaEE, Scala, Kotlin and many other projects have come out from Java
  • Mostly used for application programming
  • Used in Android and as a base for many other frameworks & programming langauges

Python:

  • High level, general purpose
  • Focusses on code readability & uses concepts like indentation
  • Automatic memory management
  • Features from structured, object oriented & functional programming
  • Large ecosystem of libraries
  • Used in machine learning, web development and many areas of data science

R:

  • Focussed on statistics & graphics
  • Interpreted, features from procedural & object oriented
  • Large ecosystem of libraries / packages
  • Commercial options available

RUST:

  • Focussed on systems programming & being looked as a replacement for C & C++ by many
  • Major focus on type safety, concurrency and memory safety
  • Only valid references allowed for memory except few other scenarios
  • Object lifecycle & variable scope checking at compile time itself unlike many languages that do this at runtime
  • Strongly and statically typed
  • Generics
  • Ownership & lifetimes concept introduced over objects
  • Features of functional programming

Scala:

  • Functional & object oriented features
  • Many functional features are implemented: No difference between statement & expressions, Lazy evaluation, Currying and Type inference
  • Strong & statically typed
  • Options to compile & run on JVM or as JavaScript or as native code

C#:

  • Multi paradigm
  • Static & strong typing
  • Functional, generic, object & component oriented features
  • Common Language Infrastructure standard driven which helps to get Common Intermediate Language for runtime
  • Metaprogramming concept is used
  • Garbage collector & detailed memory management techniques exist

References:

  • https://en.wikipedia.org/wiki/Comparison_of_programming_languages
  • https://en.wikipedia.org/wiki/C_(programming_language)
  • https://en.wikipedia.org/wiki/C%2B%2B
  • https://en.wikipedia.org/wiki/Java_(programming_language)
  • https://en.wikipedia.org/wiki/Python_(programming_language)
  • https://en.wikipedia.org/wiki/R_(programming_language)
  • https://en.wikipedia.org/wiki/Rust_(programming_language)
  • https://en.wikipedia.org/wiki/Scala_(programming_language)
  • https://en.wikipedia.org/wiki/C_Sharp_(programming_language)

Email me at Neil@HarwaniSystems.in

Learning R Programming – Part 1

As per Glassdoor Top 5 skills in Data Science for job openings are:

  1. Python
  2. R
  3. SQL
  4. Hadoop
  5. Java

Most Java developers know SQL, Hadoop & Java to a good extent in today’s environment, two important skills Python & R should be learned by the Java developer / architect / manager if s/he wants to contribute / work in Data Science area. In this article you will find a structured step by step approach for learning programming in R.

  1. To start with install R and familiarize yourself with R Console & R Script interface. You can run commands on both but it’s best to write multiple commands and try them out in script editor. Use short cut CTRL + R to run your commands in R Script editor.
  2. Explore menu options like Package -> Install / Load / Choose CRAN Mirror. By default many commands for statistics, visualization, etc. are given in R by default. Big set of libraries are already loaded into R by default and 100s more are available. Select any mirror to download new packages and install / load them step by step. You will need working internet connection. Learn how to set working directory. You can see default libraries available in R using library()
  3. From there move on to various R Objects / Data Types – Explore Data Frame, Vector, List, Matrices, Arrays and Factors. Try out examples for the same.
  4. Next step learn to load / read and write datasets by commands like read.csv / write.csv. You can also read / write excel sheets but for it you will need other packages. See the basic commands like summary, structure & fix to analyze / edit your dataset
  5. Next step – go through various categories of operators (logical, mathematical, relational) and concepts like pipe %>%, constants, rules for naming identifiers followed by various statistical functions directly available in R. You can get help on a command by using ?<COMMAND>. Also, learn to create functions and use conditions like if
  6. By now you should revise basics of statistics & various visualization charts which are taught typically in Year 1 / Semester 1 of MBA. Explore various default commands for statistics built into R by default. Some examples – mean, variance, standard deviation, etc.
  7. Learn to manipulate / read / write datasets using subset, sample_n & sample_frac and using dplyr package which has commands like select & filter among others
  8. Check various types of default visualization commands in R for various charts like barplot & pie. Post this learn how to use ggplot2 package
  9. You will get many datasets at kaggle.com and various websites like stock exchanges – NSE / BSE, RBI, Open Data websites of various Governments and others
  10. Explore top 20 packages of R categorized by various areas as given below.

An advantage of learning R is that you will become better at statistics & data science. It’s much simpler than Java in terms of syntax and structure and is influenced by open source languages / scripting like Linux, etc.

Reach out to me at neil@techandtrain.com if you want to discuss R, conduct a training for MBA / BE / MCA / MSc students in R or want to conduct a workshop for your managers / executives on Data Science / R / Java / etc.

References:

Top 10 skills for Data Science – Glassdoor Economic Research

Top 20 packages in R