“With a sufficient number of users of an API, it does not matter what you promise in the contract: all observable behaviors of your system will be depended on by somebody.”
C++ – Understanding lvalues and rvalues
It is important to know the distinction between an l-value and an r-value if you are to be a serious C++ programmer. This article is intended to provide a basic understanding of their differences.
Continue reading “C++ – Understanding lvalues and rvalues”C++ – Initialization
Initialization of variables/objects in C++ can often be a reason for confusion.
Continue reading “C++ – Initialization”C ++ – Multi-threaded Programming 2
This is my second article on multi-threaded programming. I highly recommend you to read Multi-threaded Programming 1 before proceeding any further.
Concurrent programming, Parallel programming and Asynchronous programming are often spoken about in the same breath. However they aren’t necessarily similar.
‘const’ keyword is a type qualifier that can be associated with an object. It tells the compiler to mark the object as read-only.
Shell Scripting – Subshell vs Subprocess
How a sub-shell differs from a sub-process/child-process can often be a cause for confusion. Hopefully, this article may help alleviate it.
Continue reading “Shell Scripting – Subshell vs Subprocess”
Pareto Principle
“Roughly 80% of consequences (output) come from 20% of causes (input).” In computer Science, this principle can be applied to a variety of scenarios. For example, “Nearly 80% of the bugs are found in 20% of the code”, “Nearly 80% of the traffic is generated by 20% of the clients” etc.
C++ – Templates
Templates allow us to write generic classes (called template classes) and generic functions(called template functions) that can work with generic data-types.
Continue reading “C++ – Templates”
C++ – Lambdas
Lambdas or Lambda Expressions were introduced into the standard in C++11.
Continue reading “C++ – Lambdas”
C++ – Memory Alignment
I was once asked in an interview about the importance of memory alignment. I had absolutely no clue as to what it meant or why it was important in high performance/low latency programming.
Develop and deploy a gRPC application on AWS
What is gRPC?
gRPC is an RPC framework whose default Interface Definition Language (IDL) is Protocol Buffers. But IDL in gRPC is pluggable which means that other serialization formats like Thrift, Avro etc can also be used with gRPC instead of Protocol Buffers.
Continue reading “Develop and deploy a gRPC application on AWS”
Multi-threaded Programming 1
Writing good multi-threaded code is a skill in itself. There are several concepts one needs to be familiar with before starting out to write a multi-threaded program. I will briefly explain some of these concepts with a focus on C++.
Continue reading “Multi-threaded Programming 1”
LifeCycle of a program – A C++ Perspective
If you have ever wondered how a program written in C++ or any other language finally gets executed on the hardware and gives us the intended results,this is the article for you. This article will give you a high level overview of what happens behind the scenes.
Continue reading “LifeCycle of a program – A C++ Perspective”
C++ – Type Casting
Typecasting in C++ allows us to perform conversion between types.
Continue reading “C++ – Type Casting”
C++ – Smart Pointers
In C++, memory allocated from heap has to be freed manually. But there could be situations where the programmer forgets to deallocate the memory and causes what is known as memory leakage.
Continue reading “C++ – Smart Pointers”
C++ – Polymorphism
Polymorphism is the ability of an object to exhibit multiple behaviors. C++ allows two types of polymorphism, Static and Dynamic. Static polymorphism happens at compile time via function overloading whereas Dynamic polymorphism is exhibited at run time via function overriding.
Continue reading “C++ – Polymorphism”
Object Oriented Software – Visitor Pattern
Visitor pattern is a behavioral pattern that allows addition of new features to a class without actually modifying the class. Visitor pattern is one way of implementing the Open/ Close principle (which is one of the SOLID principles).
Continue reading “Object Oriented Software – Visitor Pattern”
Object Oriented Software – GOF Design Patterns
Softwares are susceptible to change. A new requirement can come-up any time and the software should be able to handle this change effectively with minimum intrusion. A software that is well designed can easily adapt to these ever-changing requirements and hence a good design is of utmost importance especially when it comes to design and development of a commercial software.
Continue reading “Object Oriented Software – GOF Design Patterns”
C++ – Be wary of strcat() and strcpy()
strcat() and strcpy() are two functions that work with the c-style strings. While the former concatenates two strings, the latter copies one string into the other. Both these functions have been the reason for multitude of bugs in many applications. Although, they are simple functions to use, most programmers are oblivious to their implementation details which has resulted in quirky and hard-to-debug behaviors in several applications .
Continue reading “C++ – Be wary of strcat() and strcpy()”
Algorithms – Optimizing nth Fibonacci Number
Let me make it clear beforehand. Don’t misinterpret the heading. I am not going to talk about the Fibonacci optimization technique using memoization and DP where you store the result of sub-problems to make the algorithm faster. That’s the old school optimization technique which has a time complexity of O(n) and an equivalent space complexity. There is an even better optimization technique which I came across in one of my graduate classes (where I am a student:D). I will be talking about a new way of representing the Fibonacci series which will help us compute the results way faster than the other techniques.
Continue reading “Algorithms – Optimizing nth Fibonacci Number”
C++ – ‘Friend’
A class or a function can be made a friend of another class in C++. A friend gets access to all the private members and protected members of the class to which it becomes a friend.
Continue reading “C++ – ‘Friend’”
C++ – Constructor
A constructor is a special member function that is automatically called when you create an instance of a class. Continue reading “C++ – Constructor”
C++ – Inheritance
The idea of inheritance implements an IS-A relationship between classes.
Continue reading “C++ – Inheritance”
C++ – Virtual Functions
When a class inherits from another class, it is possible to override the public methods of the base-class in the derived-class.
Continue reading “C++ – Virtual Functions”
C++ – Mastering ‘Static’
Static keyword in C++ can often be a cause of confusion for many people because of its varied use cases. If you are one of them, hope this article helps you alleviate it.
Continue reading “C++ – Mastering ‘Static’”
C++ – Duration, Scope, and Linkage
A name in C++ has three main properties, Duration, Scope, and Linkage.
Continue reading “C++ – Duration, Scope, and Linkage”
Algorithms – Dynamic Programming
I have been coding for some time now and yet, I feel confused when I get into a discussion about the core algorithmic concepts. I still can’t figure out if a problem needs a Dynamic Programming solution, or if its needs a divide and conquer treatment or if it should fall under a different category. This article is just an attempt to convey my level of understanding of the intuition behind Dynamic Programming. Feel free to weigh in!.
Algorithms – AI in Nine Men’s Morris Game
Let’s see how Artificial Intelligence form the core of the Nine Men’s Morris Game.
Continue reading “Algorithms – AI in Nine Men’s Morris Game”
C++ – One Definition Rule
One Definition Rule or ODR is an important rule in C++ which loosely states the following.
Continue reading “C++ – One Definition Rule”
Algorithms – AI behind a Tic-Tac-Toe Game
TicTacToe game can be framed into a typical search problem involving game trees with each node representing a game state (or game position) and each edge representing a move made by a player.
Continue reading “Algorithms – AI behind a Tic-Tac-Toe Game”