why handmade hero is important

Every keystroke in chrome causes 25000 allocations to occur .. wtf!

link

It's sad to think that most of our software today is written like this.

Thanks to Casey for doing this series, people may think its nuts to hand code everything, but I think its more crazy doing 25000 allocations per keystroke in an app.
Every keystroke *in the omnibox* (URL bar) causes 25,000 allocs.

But yeah, it's a problem.

Web browsers are hard. At this point they're kind of like little OS's all to themselves.

I'd love to see (or make :D) a spec-complete browser engine that's simple and readable. I don't even know if that's possible with the specs being how they are (i.e. not remotely simple or readable).

Edited by theinternetftw on Reason: improved link to visual aid
HTML/CSS/JavaScript is a lost cause. It's probably not possible to make a browser that isn't riddled with bugs and inefficiency (and security holes!), no matter how good the programming team is.

Too bad our whole world is built on this technology now :(

- Casey
Does the fact "Chromium is open source" have an impact on the introduction and/or removal of bugs?
I really like the low-level approach "hand code everything" apporach. Why? Because it helps you to understand how things work. But in reallity/enterprise applications one can not afford to hand code everything (i.e make its own SQL database etc). Memory is cheaper then engineer hours :-)

Nevertheless, this does not mean, that I agree with folks, that (either for ignorance reasons or lack of knowledge) treat such subsystems as "opaque" magic boxes with unlimited capability and no constraints.

Matra
I'm not a much expierenced programmer, but is the programming-philosophy really that bad today? I have to question it, if the majority only work with bad programming languages and poor design choices then why nobody want to change it? Of course if something used by the majority it doesn't automaticly mean it is reasonable but take for an example the programming language "D": from what I heard D is just like C++ without the garbage. Just by looking relatively (whether D itself is a good or bad language) why does everbody still use C++?
Maybe there are reasons to prefer C++ over D, I don't know much about C++ and D but I also wonder why we still use the over 25 years old C as the one and only reliable langauge for performance and control while the computer technology has drastically advanced since then? Why has nobody come up with a new language that has the same performance as C but more suited for modern technologies and don't lack on the "low level" stuff?

I'm serious, I don't know what the "right" thing is to learn from. I feel overwhelmed by the massive information you can find in books/internet/people who proclaim to be as "good programming". Even CS school doesen't really help me or make the situation more worse.

I don't even know if Casey do the "right" thing but what I really love about Handmade Hero is that he proves his sensible decisions by showing the progress step by step to make a high quality program. I think this is the most important point to actually write a real program and not just talk about how should it be written.

Edited by Flederfalter on
I have always wanted to be a programmer, having watched the field unfold the last thing I want to be is a developer.It's great to watch a programmer do their thing.

Edited by Christopher O Connor on
Flederfalter
I'm serious, I don't know what the "right" thing is to learn from. I feel overwhelmed by the massive information you can find in books/internet/people who proclaim to be as "good programming". Even CS school doesen't really help me or make the situation more worse.


I feel you. I'm not very close to the industry so I don't have a good feel for these things, but my current philosophy on this is as follows:

There are so many different ways to program effectively and so many different things to program, that there is no one right approach to it all. What might be good practice for making a desktop application could be totally different than making something for the web, or doing some embedded code somewhere, or making a game, or any of the myriad of other possible things to do. Each of these, and even different projects within each broad category, has different requirements and different constraints (sometimes obvious and sometimes subtle).

As if that weren't enough, you then have to consider that there's many different effective methods of achieving the same goal. Many different schools of thought, philosophies and disciplines which all can act like different paths to the same destination, the same goal. Which is: reliable, maintainable code that's correct and efficient (which priority you give these is the only different between some philosophies, see rise of the worse is better). What might work well for one combination of person and project might be totally different for another combination of person [or team or whatever] and project.

I think, as with all fields, you can't go too wrong by just starting with the fundamentals and history first. All knowledge is built on past knowledge. So, to learn how things have evolved and how they worked in the past is just a good general philosophy to life and learning.

But going from there as a starting point, one thing I've found is the more (different and varied) perspectives on things you can get, the more powerful you become. For years I've been programming at a high level of abstraction. So this low level stuff is very refreshing and enlightening for me. I grew up getting taught OO in all my classes, so this recent vogue of functional programming is likewise refreshing. The more ways you can look at things, like walking around an object to get different views of it, the more depth and nuance you see to whatever you're looking at.


But I guess I'm digressing a bit from the thread topic. I could go on at length about why HH is important but for now I'll just mention one simple example that kind of encapsulates [in the normal sense of the word, not the programming sense ;)] one of the main things I appreciate about the philosophy behind HH. In yesterday's stream (16), Casey checked his notes to look at some compiler options and saw the answer he was looking for. So many people (it's very natural) will stop there and just say "oh, it's -xad [or whatever], that's what it is." But what Casey did is then he says something like "oh but let me show you how you could know that." And that is what makes all the difference.

Edited by Nines Baobaberson on
Here is an interesting blog post by Bruce Dawson on Hidden Costs of Memory Allocation.
cmuratori
HTML/CSS/JavaScript is a lost cause. [...]
Too bad our whole world is built on this technology now :(

Hmm, I think no one intended websites to use <div>s and JavaScript to position elements (like http://mollyrocket.com/casey/ does). Something as basic as a blog shouldn't rely on JavaScript for visuals. I don't want to imagine what the thinking behind replacing purpose-built HTML elements like <h#> and <hr> with <div>s is. It makes it unprintable, that's for sure. Is that desired?