Static vs Dynamic Typing

1 mainIf you are a programmer, you must have heard the terms “static typing” and “dynamic typing” being thrown around a lot. When we talk about programming languages, this is an important feature that tends to significantly affect the programs written in that language. In the spirit of simplicity, I will try to keep this post as code-free as possible. Actually, you don’t have to know any programming language in particular to understand this concept. If you are doing a hobby project or doing something simple, this will not come into picture and it will not affect your code as such. As you build bigger systems, static and dynamic typing will become a big concern. If you are not fully aware of the limitations of a given programming language, you will end up spending a lot of time in code maintenance. So it’s always good to know some of these things. Alright, so what exactly is it about? Does it really matter that much?   Continue reading

What Is Metaprogramming? – Part 2/2

1 mainThis is a continuation of my previous blog post on metaprogramming. In the previous post, we saw why we need metaprogramming. In this post, we will see what exactly this whole metaprogramming is all about. In the world of programming, the basic problem is that any general-purpose programming language is that it has its own limitations. If the language doesn’t have a metaprogramming model that is as pleasant and expressive as the language itself, then it will eventually frustrate the user. Nobody can design the perfect language, we get that! The people who manage these languages don’t allow the users to extend the language in generic ways. Not a bad thing altogether! This is done because a lot of people end up extending it in too many different ways and it becomes one big potpourri of nastiness. Coming back to the topic at hand, how exactly do we understand metaprogramming?   Continue reading

What Is Metaprogramming? – Part 1/2

1 mainYou know how people talk about creating machines that can create more machines by themselves? Well, we already have machines that can create other machines. The concept of metaprogramming is just the technical side of it. Metaprogramming is the process of writing programs that can create other programs. It is one of the most underused programming techniques. The good thing is that it allows programmers to minimize the number of lines of code to express a solution, or it gives programs greater flexibility to efficiently handle new situations without recompilation. If it’s so good, then why isn’t it used everywhere? Why do we need it? Before we jump into the details of metaprogramming, let’s understand why we would consider it in the first place.   Continue reading

CMake vs Make

mainProgrammers have been using CMake and Make for a long time now. When you join a big company or start working on a project with a large codebase, there are all these builds that you need to take care of. You must have seen those “CMakeLists.txt” files floating around. You are supposed to run “cmake” and “make” commands on the terminal. A lot of people just follow the instructions blindly, not really caring about why we need to do things in a certain way. What is this whole build process and why is it structured this way? What are the differences between CMake and Make? Does it matter? Are they interchangeable?   Continue reading

Programming Paradigms: Object Oriented vs Data Oriented

mainOver the last couple of decades, different programming paradigms have emerged in an attempt to make software better. Different situations demand different requirements, so it wouldn’t be fair to say that one paradigm is better than the other. Whenever you want to create a software system, you usually write code that attempts to fulfill most of the requirements. Now the difference between these paradigms is the way in which you write your code. On one end of the spectrum, we have object oriented programming. The world revolves around pieces of data here and functionalities are attached to them. On the other end of the spectrum, we have data oriented programming. In this paradigm, everything is just data. How does that work? What exactly is this spectrum and how do we understand it?   Continue reading

Essential Python Tools: virtualenv and pip

A wise man once said ‘Necessity is the mother of invention’. But I think the real mother of invention is laziness. If you are lazy enough, you will find an easier way to do a particular thing. In order to solve large problems elegantly, we need to use tools that solve smaller sub-problems very well. To the coder in you, yes, it’s a bit like dynamic programming! If you have fiddled with Python, you would have definitely come across many different libraries and packages. Sometimes, you wish that you had different machines for different libraries because the requirements differ from one thing to another. There should be an easier way to manage different environments and packages right?   Continue reading

Command Line Within Python

One of the cool things about Python is that you can do absolutely anything and everything with it. This blog post deals with using command line within Python. When you are writing your code in Python, you might want to access the command line to run a couple of commands like ls, grep, make etc. If it were a shell script, you could directly write that command and it will get executed as if you were on the command line. But shell scripting will only provide limited functionalities. So how do we do it in Python?   Continue reading

Inside The Shell of Shell Scripting

I’m pretty sure people working in the tech domain are aware of something called Shell Scripting. Were you ever working on a project and felt that some tasks were repeating over and over again? Did you feel that there should be an easy way to automate these things and you don’t have to worry about it every single time you want to run your project? People who have heard about shell scripting and don’t know what it is, you are missing out on a cool weapon in your arsenal. People who haven’t heard about shell scripting, well it’s time to move you into the other category. So what exactly is shell scripting?   Continue reading