What does writing idiomatic code mean? Let us say you are using Python to populate a list with numbers. One way to do this is Another is The second one is the idiomatic code. It leverages the Pythonic way of coding. Python is just an example here; every programming language has a philosophy and a … Continue reading Idiomatic Code
Category: programming
Concurrency Models
We can roughly classify concurrency models into: 1. Thread based concurrency. 2. Event based concurrency. Imagine that you run a store with only one customer service representative. As soon as a customer walks in, the customer service representative greets the customer with a quick hello saying – “If you need any help, give me a … Continue reading Concurrency Models
Ode To Queues
If you have a producer with an uneven rate of production and a consumer that cannot keep pace with the producer at its peak, use a queue. If you have a workload that need not be addressed synchronously, use a queue. If your customer-facing application is riddled with workloads that can be deferred, move these … Continue reading Ode To Queues
Software security
Some disparate thoughts on security in no particular order. Many security bugs can be avoided by making a clear distinction between authentication and authorization. When one logs into Facebook, one uses a username and password. Facebook lets you log in only once it is sure that you are the owner of the account by verifying … Continue reading Software security
Naming Things
There are only two hard things in Computer Science: cache invalidation and naming things. -- Phil Karlton Even though the above might have been in jest, naming variables while writing code is a head-scratching experience. Should I make it short? Should I make it descriptive? If descriptive, how descriptive? These thoughts keep running in one's … Continue reading Naming Things
Switching Languages
Many are apprehensive about switching programming languages. It is perfectly fine to have preferences - I am heavily biased towards statically typed languages with great tooling support, but being dogmatic is not something one should aim for. What could be the downsides of switching programming languages? I am disregarding the psychological aversion to change and … Continue reading Switching Languages