Funny Excuses that Devs Give

Devs are very brilliant and also they come up with super weird reasons when you catch a bug in their work. I’m a dev too and it was absolutely hilarious to see that I myself use the same excuses sometimes. I came across a meme and I forgot to screenshot it. I remember a few points from it. If you are a web dev, I’m sure you could relate to most of these excuses. Give it a read also a thumbs up if you could relate to any one of these points 🙂

  • It worked yesterday – Yeah, it was the compilers birthday yesterday and hence it compiled the code perfectly. Today it’s not in the mood to compile and hence it is throwing the error. Maybe you should try running the program when the compiler is in good mood.
  • Caching – Did you hard refresh? Did you clear your cache? I think the cache in your browser can’t be cleared, please use a different computer. Let me clean your cache, I’m an expert in clearing. I think the program is cached in the cloud, let me clear that as well.
  • That is weird! – Yes, that’s weird, you expected it to run, but when the QA runs it, it becomes weird. Guess your program is allergic to other people who wanted to see your code working.
  • How is that possible?? It never occurred to me – Exactly, How is that possible?
  • That is an issue with the 3rd party library that we are using – Lemme raise an issue in GitHub. Hopefully they will fix this issue within this year until then we’ll push this bug to the backlog.
  • What is the version of Chrome that you are using? Is it v79.0.3945.117? – No, It’s v79.0.3945.116. That’s exactly why you are getting this error. Could you please update your chrome?
  • I’ve not touched the code in weeks – Yeah, it could be some junior dev trying to figure out what exactly this piece of code does.
  • Did you restart your computer? – Bugs get accumulated if you don’t restart your computer everyday. So just restart and run the program. The error would be resolved (And most of the time it works!! Don’t know how.. )
  • Even-though it doesn’t work, how does the UI feel? – Like crap 🙂
  • The user wouldn’t do it that way – You QA people how do you find some creepy steps to reproduce the bug. Once I had a bug reported that occurs only when you perform certain steps after 37 seconds (seriously??).
  • This is very minor, the user wouldn’t even notice it – Absolutely yes, the user won’t notice if the login page doesn’t show up 🙂
  • Finally, the most used excuse – It works on my machine!! – Yeah, we’ll ship your machine along with the product so that there is no error thrown.

Those were the most common excuses that a dev would give to the QA or the manager. Hope that most of us would have used these or heard people using these. If yes, hit like, share it with your fellow colleagues who give excuses like these. For more tech related posts follow this blog. This is SamuelLawrentz, do connect with me on LinkedIn for more updates.

Happy Coding!

The Debouncing technique

Event Listeners are really a great bonus for JavaScript. They help in improving the user’s experience and interaction with the web page. JavaScript has a lot of event listeners, a whole lot of them. These event listeners are very active and they keep watching your every move on a webpage (Beware! They are watching you!). When the desired action/event occurs, they immediately call the function that is attached to them.

As you know, computers are very fast, incredibly fast, a simple event can be fired a zillion times. For example, a scroll event listener will fire a million times for every scroll that you do, the same goes for the resize event. Just imagine how much load it can put on browsers if a function is called million times continuously? Phew! Poor browser 😔 Here comes our savior and hope “The debouncing and throttling function”.

Debouncing is a technique that is used to limit the rate of execution of a function. This drastically improves the performance of a browser, when a tedious function is attached to an event Listener like onScroll, onResize, etc. A debounce function in minimum takes two parameters – the function to be debounced and the wait time in milliseconds and in turn returns a debounced function. Now with this returned function you can debounce a scroll/resize event handler to be fired once for every specified wait time. A simple debounce function as taken from Underscore.js is given below, it is very simple, it simply calls the function passed to it at regular intervals using the setTimeout and clearTimeout functions.

// From Underscore.js library
function debounce(func, wait, immediate) {
    var timeout;
    return function() {
        var context = this,
            args = arguments;
        var later = function() {
            timeout = null;
            if (!immediate) func.apply(context, args);
        };
        var callNow = immediate && !timeout;
        clearTimeout(timeout);
        timeout = setTimeout(later, wait);
        if (callNow) func.apply(context, args);
    };
};

 

You have read till here and still clueless about what a debouncing function is? I have an analogy for you 😃 Read until the end!I know a teacher back in my school, she was very good in teaching but at the same time, she had eyes all-over the school, in the walls, canteens, classrooms and literally everywhere. She used to watch all my mischiefs and report them back to my parents immediately. In short, she was a mischief listener (a kind of event Listener). As soon as I do a mischief and before I could reach home, there would be a great welcome ceremony organized by my mom with dad as a chief guest along with spicy scoldings and sometimes with more delightful trashings.

Let me write the above in JavaScript using JQuery

$('Samuel').on('mischief', reportHisParents());
As days went by, I became naughtier and thus she had to often report back to my parents. This was going on until one day, my parents became tired and annoyed by my mischiefs and her reportings. So, one day they visited my school and told her “Hello madam, It is good that you report our sons mistake every now and then, but we are tired of hearing them every day, can you please report them on a monthly basis, during every parents-teachers meet up?”. She replied “I would be glad to”, with an evil smile. From then on, my mischiefs were not reported immediately to my parents but only once in a month, during the Parents-teachers meetup. 😃
Then it became
var reportMonthly = debounce(reportHisParents(), 2629800000); 
// 2629800000ms = 1 month

$('Samuel').on('mischief', reportMonthly);

This is what debouncing does, it does not fire a function as soon as it is invoked, instead, it waits for the specified time and then fires the function.

Hope you understood the concept of debouncing. If you like this post and want more posts like this on the web and tech-related topics, please subscribe (there is a button in the bottom right corner). Also feel free to share your thoughts in the comment section 😃

Meet you with a next post about throttling function!

PS: I was a very good kid during my school days. You can find me on the first bench, doing all my homework on time and laughing at all the silly jokes that my teachers would crack. The story above was made up just to illustrate the concept of debouncing 😃 To know more about me visit my blog.

References:
JavaScript Debounce Function