What I’ve Learnt as a Self Taught Programmer Till Now

I have been an independent programmer for a long time. Like 5-6 years? Recently been employed with Xentrix Studios, an animation studio based in Bengaluru, as a pipeline developer.

Today I want to share what changes I’ve felt in these recent years. 

Write Readable Code

The code is read much more often than it is written. In fact, source code is written for us, humans. A source code to achieve a certain task to be done can be written in dozens if not hundreds of ways. Computers will still interpret it. So at the end of the day, it’s human to whom flow of source code matter.

This was something I wasn’t aware until some time back. This isn’t something you learn when you code for yourself. Because there is a high probability that you’ll understand your own code. But when you code in a team, this is not the case.

This is where coding convention kicks in. Coding convention in a group is adhered to maintain interoperability between co-programmers.

Adhere to the style guide of the language community or your company’s own; Python has their PEP-8, other might have their own. Google has its own style guide covering multiple languages.

Avoid Tight Coupling

In my former days of programming, like any other self-taught programmer, I used to write procedural code.

Tight coupling is something when you write code which is highly dependent on another piece of code, most probably in the same script. When you change the code in one place, it breaks the entire script, like a ripple effect.

But when you break the code in different modules, you get a same place to look up into for similar problems.

Conceptual model of coupling (Wikipedia)
Conceptual model of coupling (Wikipedia)

UX

An analogy of UX can be taken from a door. There’s a door which has a handle. Would you push it or pull it? Now there’s another door which has no handle, would you push it or pull it?

Same applies in interface design. Avoid distracting users attention with multiple components. Notice how having no handle on door makes up obvious to push the door?

Don’t make the user click 5 buttons to do the stuff which can be done in 2 clicks. 

Unit Testing

Unit testing is something I’m not doing right now. But I anticipate it’s essential for large-scale development.

Making a Switch to KDE and zsh

It’s been a long time I’ve been fiddling around with Linux and Linux distros. The first Linux distro I ever used was Ubuntu.  I like the beauty of Linux, its so customizable. One can change every aspect of interface and behaviour that end-user want. Like the desktop environments and shells, which you can’t really change on Windows operating systems.

I myself belive in minimalism and not full of features products (which remains unused most of the time in my case). But I’m making this descision after using both of them for about a week.

KDE

Most Linux distro, by default is equipped with GNOME by default. This is a pretty good Desktop Environment to hang around with, to get a taste of Linux. I never made a switch to desktop environment unti now, although I made switch to many distros.

Continue reading “Making a Switch to KDE and zsh”

How would you exclude all extension-less executable from your repo?

In last post, I expressed how we can export a single file from a git repo the its own repo, preserving their commit history. In this post, I will tell how I dealt with extension-less file to ignore them in my repo.

I have recently started learning C++ from Udemy, it’s a free course. I encourage you to take it if you are willing to learn C++. I was following the instructions on Linux. And special thing about working with C or C++ in Linux is that the executable you get has no extensions in it, unlike Windows, which has .exe extension.

Continue reading “How would you exclude all extension-less executable from your repo?”

Extract a File from Git Repo to its own, Preserving the History

Today I will walk through how you can take out a single file from a git repository and create its own repository with all the file commit history preserved.

When I started working at my workplace I initialized Maya script directory to git. At that time one repo was looking enough for entire folder. But when I started working with a tool, I realized an entire repo would be good for that tool. But it was too late to create another repo because I had already made 12-15 commits on that tool and I don’t wanted to lose the changes I made.

Continue reading “Extract a File from Git Repo to its own, Preserving the History”

Merge more than one Commits before Pushing

When I first came to know about this, I was like:

What is Squashing?

The process of merging commits together is called squashing. There are many commands to do the same thing, but I will discuss the one I learned. There’s a read more section below if you want to know more about this topic.

Don’t go far Deep

One thing to keep in mind, before we start is, we should avoid merging our pushed commits. It will create a problem to other developers if you’re working in a team, and things will kinda mess up.

Codes and Explanations

Ariejan has already explained this in deep, so I will not do the same here but will do it for my reference. For merging last 3 commits, we can pass:

git rebase -i HEAD~3

This will open up your default editor configured with git with the following content:

pick hash Commit 1
pick hash Commit 2
pick hash Commit 3

The commits appear from older to newer. We’re probably gonna merge commit 2 & 3 into commit 1. In our code editor what we’ll do is replace pick from commit 2 & 3 lines to squash.

Sorry for the syntax highlighting. wordpress.com is preventing me from adding most external services like gist and all which has javascript embed (Twitter is working though).

What are your thoughts on this post? How do you squash your changes? I’m eager to know. Please leave comments.

Further Reading: