The Guy Who Keeps Coding While True Yavuz Ege Özcan's blog

Over-engineering is not engineering, it's worshipping July 12, 2020

I passionately hate over-engineering and trying to make things "future-proof". Future is your enemy: First of all, at some point in the future, you will be dead. And more seriously, it's impossible to know what's in it. I think my outburst (!) will sound very natural ...or you'll want to stab me after a few sentences because I have the impression that dogmatism has taken over our profession, especially when it comes to software design. When people are dogmatic, they go "WTF" on many pragmatic things that contradict their beliefs, follow a guideline immaculately, and also become more ferocious (which I exaggerate to murderous for the dramatic effect).

This (not the will to stab people, I mean being dogmatic) usually happens, when you reach a point in your experience and think that you've seen it all, and have the tendency to become an expert-beginner. You've seen a pattern, be it dependency injection through service containers, or connected components in the wonderful world of the Flux architecture, or leaning on the borrow-checking in Rust, or that the go statement being harmful, or that you should always have 100% coverage, or that all static methods need to die, or how important it is to normalize relational data, or how bad it is to use the NoSQL-de-jour, and decided it solves or summarizes all the problems in its context and all people should do as you do or they need to be stabbed? Well, you just started cargo-culting even when you seem to know what you are doing.

Over-engineering lives and breathes the dogmas, you refactor and refactor and read an article about how you did it all wrong (cough cough) and refactor again. Until it all becomes "immaculate" and "future-proof" and whatever.

I have a guideline to escape the tentacles of over-engineering:

  1. Unless "reasons", avoid developing libraries in isolation. Libraries should be born out of complicated-problem-solving code. Do not extract code from complexity, especially if it's self-imposed.

  2. Do not try to add options for being future proof. Add exactly the flexibility that is needed NOW. Know that code can be rewritten. Make stuff abstract, but don't flex the implementations.

  3. Do not try to be DRY for no reason. Repeat yourself sometimes, and have some fun.

  4. Try not to answer a technical question with answers like "Because that's how it needs to be done", or "Otherwise it wouldn't be clean".

In short: Trying to write code that you will never need to re-write is a fools errand.

Popularity Of Programming Languages On Hacker News November 10, 2013

Well, here is an interesting poll. In my opinion, the userbase of HN tends to be more open and experimental than the average programmer crowd and that makes these results even more interesting to me:

RankNameUpvotes - Downvotes
0Python2093
1C1629
2Go765
3SQL704
4Haskell691
5JavaScript683
6C#665
7Lisp635
8Clojure571
9Scheme523
10Ruby489
11Lua486
12Assembly371
13Erlang371
14Rust318
15Scala217
16OCaml203
17F#173
18Smalltalk144
19Shell131
20Forth128
21D88
22Other65
23R50
24Ada14
25Pascal11
26Rexx-53
27Delphi-94
28Tcl-98
29Fortran-132
30Groovy-155
31CoffeeScript-159
32Objective-C-215
33Perl-256
34C++-345
35Cobol-443
36ColdFusion-560
37Actionscript-661
38Java-931
39Visual Basic-957
40PHP-1360

ps. I used the following quick-and-dirty script to parse the results. You can get the current results by running this:

var scores = {}, name, sign;
[].slice.call($0.querySelectorAll("tr:not([style])"), 0)
    .forEach(function(row, i) {
        if(i%2 === 0) {
            var nameAndSign = row.innerText.trim().split(" - ");
            name = nameAndSign[0];
            sign = nameAndSign[1] === "Like" ? 1 : -1;
            return;
        }
        scores[name] = scores[name] || 0;
        scores[name] += sign * parseInt(row.innerText.trim().split(" ")[0]);
    });
var scoresArray = [];
Object.keys(scores).forEach(function(key) {
    var entry = {};
    entry[key] = scores[key];
    scoresArray.push(entry);
});
scoresArray.sort(function(b,a) {
    return a[Object.keys(a)[0]] - b[Object.keys(b)[0]];
});
scoresArray.forEach(function(a) {
    var name = Object.keys(a)[0];
    console.log(name, a[name])
});

Parsing Time Manually May 15, 2012

How do you get the minute difference between two 12-hour dates encoded in a string like

"12:05am-02:55pm"

?

Short Answer

You shouldn't. Get your data properly!

But Still...

I hate myself.

Seventh Problem On Project Euler March 14, 2012

The Problem

I hate clichés but there we go:

What is the 10 001st prime number?

The Solution

Let's try a one-liner this time:

var a=[],b;for(b=2;10001>a.length;b++)a.some(function(c){return 0==b%c})||a.push(b);console.log(a.pop());

yay.

Sixth Problem On Project Euler March 12, 2012

The Problem

Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.

The Solution

Supposed to be harder, or?