Coffee Coder

Shubham Jain's Weblog

Blog Little Things

| Comments

John Carmack once speculated that StackOverflow might have added billions in productivity.

Quite rightly so. Imagine, the no of people that didn’t have to go through (maybe lousy) documentation, and long threads to seek solution for their problems. RTFM, many of programmers would be quick to point out but even the simplest questions, like, “How to read a whole file in python?”, “How to kill a process with its name?” must have saved thousands of programmers’ time. Thanks to rookies who didn’t feel embarrassed in asking them, that even experienced programmers can enjoy fruits of their answers.

Why Productivity Tricks Don’t Matter

| Comments

We’re living in an exciting century. The majority of today’s success stories trace its existence from few nerds hacking in their garage. Yet, majority of ambitious hackers, struggle to get going with any of the dozen of ideas that they have thought, most of which end up being un-fiddled in their favorite note-taking apps.

It seems very exciting to draw the plan for your side-project, its features, its technology and of course, how it could be a million-dollar thing but rarer is for someone to get started, and more rarer, to manage more than a few sittings on desk over it, eventually after, the enthusiasm dries up and its time to head back to browsing your favorite sites.

Almost everyone, knowingly or unknowingly, suffers from the same compulsion of doing activities that come under umbrella of “wasting time” but the scope is a lot different for hackers who don’t procrastinate over not doing their assignments, or presentation but shipping something that people might need.

What is procrastination?

Wikipedia defines Procrastination as:

a practice of carrying out less urgent tasks in preference to more urgent ones, or doing more pleasurable things in place of less pleasurable ones, and thus putting off impending tasks to a later time, sometimes to the “last minute” before a deadline.

The task which can be getting a hair-cut, writing an academic paper, or coding the first version of the application. Paul Graham, in one of his essays argues that procrastinating over the first isn’t necessarily bad if it serves a better purpose but the most common way people procrastinate is either by endlessly browsing social media sites, watching netflix, playing video games or any similar activity which echoes the sentiment of “doing nothing”. In short, procrastination is “wasting time” which could otherwise, be spent in a more productive manner.

Creating Side-scroller Game in HTML5 and Javascript

| Comments

Recently I completed my first game, Penguin Walk, with help of free art in Javascript and it gave me empirical experience of a known-fact surrounding game development – “The hardest thing about developing a game is finishing it.”

Although, the game is dead simple and code runs in only few hundreds of lines, it took a lot of effort to finish it. The reason? I believe the hard thing related to game development, is that you are attempting to build something complex out of very simple elements (pixels). The same reason why building a programming language is hard – you are trying to ensure that a stream of characters obeys formal grammatical rules and convert them into something that can execute. In this post, I will describe how I created my side-scroller game.

Is Game Programming hard?

Think about it. What does it take to project a bird from a slingshot, show it flying in projectile motion, hitting a set of object which are then animated to move accurately, in accordance to laws of physics? Well, a lot. You can only tell computer what to paint on the screen, rest of all the higher level abstractions, you build on your own.

Although, using a library might help a lot; after all, who can be expected to complete a desktop application if he has to program all controls on his own but if you compare the two, there are two complications that arise in game development –

Hackers Are the Real 10x Engineers.

| Comments

The notion of 10x programmer was first mentioned by John Brooks (of, Brook’s law fame) in his essay No Silver Bullet, according to which, ‘there is as much as a tenfold difference between an ordinary designer (programmer) and a great one’. The idea has been widely debated, sometimes refuted and many times defended which is unsurprising for it is impossible to accurately measure a programmer’s productivity.

Sadly, the idea of 10x coder is usually visualized as a screen glued junkie, moving fingers over keyboard without a break. While the picture may be popular for sci-fi films, it is hardly close to reality.

My Perfect Reason to Avoid PHP: Type Juggling

| Comments

If there was an award for the most hated language, the unanimous winner would be PHP. Lots of write-ups criticize it for its nonsensical function naming conventions, inconsistent parameters, sheer absence of what we call, “a well thought design”. However, people on the other side, suggest that writing good code is upto the programmer showcasing “Zend Framework”, they assert, PHP is a very reasonable language to write clean code. They say its easy to ignore the inconsistencies with a good editor or IDE and adopting good practices. True they are, I believed, until, I encountered something which is completely inexcusable, an ugly case of type juggling.

Type Juggling

Type Juggling (or, automatic type casting) is a PHP mechanism which transforms one type to another depending upon the context. As the manual explains, if you add a string to a number, the string will be type casted to a number and not the other way round which results in something like this.

20 + "10Hello World" = 30