When you enter a file, leave it better than you found it

Image for post
Image for post
Photo by Luke Chesser on Unsplash

“Refactoring is the process of changing a software system in such a way that it does not alter the external behavior of the code, yet improves its internal structure.

It is a disciplined way to clean up code that minimizes the chances of introducing bugs. In essence, when you refactor, you are improving the design of the code after it has been written.” — Martin Fowler (Father of code smell).

Let’s face it. We are all programmers. We are smart and intelligent and like to deliver results. But how many times do we care about cleaning up code smell?

Perfect Code Please?

We desire to write code that is free of all bugs. One that tests all possible edge cases. One that passes linter checks each time you run a build. Code that you start to fall in love with. Surely top-notch programmers must be writing such code all the time, right? …


Image for post
Image for post

You just started at your dream job as a software engineer. You feel like you are at the top of this world. You feel motivated and want to make a difference. It’s been a week and it’s now time for you to start shipping code. You choose a sprint task that you think you can accomplish. You want to impress your colleagues.
You created your first feature request. And then, you receive 100 negative comments on it. Some reviews sound like, “Oh do you even know how a HashMap works?”. You feel sad, devastated and depressed.

We have all been there. Life is funny sometimes. On the one hand, programming is so much fun. You can be creative. You are like Leonardo DaVinci painting out his next Monalisa. But then reality hits you hard. …


“Everyone should learn to program a computer because it teaches you to think” — Steve Jobs

Image for post
Image for post
Photo by Larisa Birta on Unsplash

Are you fascinated by technology? Do you spend hours looking at source code? Is Stack Overflow your second home? Do you like debates about the best programming language in the world?

If you answered yes to all of these questions, then voila, you are a programmer. If you answered no, well, fear not, you can still become one. And I am going to show you how to do that.

“Everyone should learn to program a computer because it teaches you to think.” — Steve Jobs

Why is learning how to think important? This is because thinking inculcates problem-solving skills. And that is exactly what companies look for, more effective ways to solve problems. …


Extract media information from Twitter accounts using only a few lines of code

Image for post
Image for post
Photo by Sara Kurfeß on Unsplash.

Introduction

Popular social media platform Twitter contains a wealth of information. Not only does the text from individual tweets help in mining social information, the images and videos contained in the tweets and retweets also give an idea of the content the account handle usually browses or shares on the internet.

I had a friend ask me to give him a script that would download all tweets, images, and videos for any account. He was particularly interested in getting the images and videos that the account handle had tweeted on their timeline. …


Back it up — before something happens!

Image for post
Image for post
Photo by Shahadat Rahman on Unsplash

The other day one of my colleagues asked whether I’d set up regular backups for important files and folders. While I’ve used Dropbox and Google Drive before, I would really like to more fine-grained control over what I want to back up. Additionally, I was interested in using Python to back up important files.

Introducing PyDrive

PyDrive is a wrapper library of google-api-python-client that simplifies many common Google Drive API tasks. …

About

Saurav Biswas

Saurav is a senior software engineer, with a special love for machine learning, data analysis and distributed systems.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store