Friday, January 6, 2017

Why Use One?

Why Using a Single Language is not always the Best Idea!

A good code is meant to solve a problem fast and efficiently. A code needs a language to be written in (duh!). Every language out there has its own advantages. As a student, I always associated these advantages with my favourite languages:

  • C - Fastest runtime, pointers, easiest for systems level programming (always preferred raw system calls), great for learning. I also considered it best for structures like trees and heaps (everyone have their opinions).
  • C++ - C + STL + Objects Oriented Programming 
  • Java - Applets, Swing and AWT. Also, I have always found Java great for string handling
  • Python - Smaller codes, very useful libraries and sometimes a great replacement for bash
Many times I have seen people around me struggling with their project because the language fails to solve a specific problem efficiently. For example, Java is great for creating something with a graphical user interface but you lose out on, say, great machine learning libraries of python or even the process management that C provides (there is no easy way to achieve system() of C or os.system() of python, ProcessBuilder comes the closest). So I have always felt that best way to complete a work is to use the languages for the tasks which they do the best.

If we choose to take the path of using multiple languages, the one challenge we will face is to integrate all the chunks. This however can be achieved in multiple ways:
  • Languages like python and C provides methods to call each other
  • The subprocess module of python is great for binding
  • A socket can always come in handy 
  • Pipes always help in the flow
  • The easiest and maybe the most inefficient, use the file system (😛), write the data on to the file from one and read the same from other.
I hope this helps, this has helped me out several times.

Examples,

No comments:

Post a Comment