Nearly 100 upvotes for a page that fails its stated goal and which spends 100's of lines to do something you could do with one system call (sys_write) and a string constant?
The stated goal is not the real point. The real point is to learn about how programs are executed on real systems. Unfortunately, the second half which would (hopefully) have completed the example does not exist.
What you linked to is great, but it uses a different approach to explain the subject. That approach presents the correct thing to do, and explains some of it. The benefit of this approach is that it's short and sweet, but the downside is it's easy to miss subtle points. For example, what you linked to never explains why you have to call sys_exit. Someone reading this would know that's the right thing to do, but they may never really understand why that's so.
An alternative approach - which the posted article does - is to try the obvious but wrong thing, then explain why it fails. Fix that problem, and try the next obvious but wrong thing and keep iterating. The problem with this approach it can be a long process, particularly if you just want to know how to do something and are less interested in the why. But the benefit is that by seeing how things fail, and then seeing the fix for them, the reader can gain a deeper understanding of what's going on.
In general terms, one is more of a reference, and the other is more of a lesson. I like the try, fail, fix iteration for explaining things. I've used it many times when teaching. I find that it matches well with what we would actually do on our own, and for that reason, tends to stick with people better than simply saying "this is how to do it."
I'd be more inclined to sympathize if it had actually worked. As it stands it is a perfect example of how little knowledge of what goes on under the hood is present with the current generation of programmers. That's sad, because even if you never use that knowledge in your 'day job' I think that such knowledge does make you a better programmer.
If you write a blog post about something like this at least finish the damn thing rather than to leave a bunch of obviously wrong snippets laying around to confuse whoever lands on that page.
There are plenty of good pages on introductory assembler on the web, this isn't one of those and I'm really surprised to see it this high on the homepage. Maybe it shows how much the HN crowd would like to get a little bit of insight of what actually powers their computers, the error is mine in assuming that such knowledge would be commonplace here.
scott_s|14 years ago
What you linked to is great, but it uses a different approach to explain the subject. That approach presents the correct thing to do, and explains some of it. The benefit of this approach is that it's short and sweet, but the downside is it's easy to miss subtle points. For example, what you linked to never explains why you have to call sys_exit. Someone reading this would know that's the right thing to do, but they may never really understand why that's so.
An alternative approach - which the posted article does - is to try the obvious but wrong thing, then explain why it fails. Fix that problem, and try the next obvious but wrong thing and keep iterating. The problem with this approach it can be a long process, particularly if you just want to know how to do something and are less interested in the why. But the benefit is that by seeing how things fail, and then seeing the fix for them, the reader can gain a deeper understanding of what's going on.
In general terms, one is more of a reference, and the other is more of a lesson. I like the try, fail, fix iteration for explaining things. I've used it many times when teaching. I find that it matches well with what we would actually do on our own, and for that reason, tends to stick with people better than simply saying "this is how to do it."
0x12|14 years ago
If you write a blog post about something like this at least finish the damn thing rather than to leave a bunch of obviously wrong snippets laying around to confuse whoever lands on that page.
There are plenty of good pages on introductory assembler on the web, this isn't one of those and I'm really surprised to see it this high on the homepage. Maybe it shows how much the HN crowd would like to get a little bit of insight of what actually powers their computers, the error is mine in assuming that such knowledge would be commonplace here.