views:

437

answers:

7

According to this http://steve-yegge.blogspot.com/2007/06/rich-programmer-food.html article, I defnitely should.

Quote Gentle, yet insistent executive summary: If you don't know how compilers work, then you don't know how computers work. If you're not 100% sure whether you know how compilers work, then you don't know how they work.

I thought that it was a very interesting article, and the field of application is very useful (do yourself a favour and read it) But then again, I have seen successful senior sw engineers that didn’t know compilers very well, or internal machine architecture for that matter, but did know a thing or two of each item in the following list :

  • A programming paradigm (OO, functional,…)
  • A programming language API (C#, Java..) and at least 2 very different some say! (Java / Haskell)
  • A programming framework (Java, .NET)
  • An IDE to make you more productive (Eclipse, VisualStudio, Emacs,….)
  • Programming best practices (see fxcop rules for example)
  • Programming Principles (DRY, High Cohesion, Low Coupling, ….)
  • Programming methodologies (TDD, MDE)
  • Design patterns (Structural, Behavioural,….)
  • Architectural Basics (Tiers, Layers, Process Models (Waterfall, Agile,…)
  • A Testing Tool (Unit Testing, Model Testing, …)
  • A GUI technique (WPF, Swing)
  • A documenting tool (Javadoc, Sandcastle..)
  • A modelling languague (and tool maybe) (UML, VisualParadigm, Rational)
  • (undoubtedly forgetting very important stuff here)

Not all of these tools are necessary to be a good programmer (like a GUI when you just don’t need it) but most of them are. Where do compilers come in, and are they really that important, since, as I mentioned, lots of programmers seems to be doing fine without knowing them and especially, becoming a good programmer is seen the multitude of knowledge domains almost a lifetime achievement :-) , so even if compilers are extremely important, isn't there always stuff still more important?

Or should i order 'The Unleashed Compilers Unlimited Bible (in 24H..))) today?

For those who have read the article, and want to start studying right away :

http://stackoverflow.com/questions/41785/learning-resources-on-parsers-interpreters-and-compilers

+2  A: 

You do not need to understand compilers to be a good programmer, but it can help. One of the things I realized when learning about them, is that compiling is simply a translation.

If you have ever translated from one language to another, you have just done compiling.


So when should you learn about compilers?

When you want to, or need it to solve a problem.

Unknown
I only know the very basics, and for now I tend to agree, but I wouldn't there to state that here : http://steve-yegge.blogspot.com/2007/06/rich-programmer-food.html
Peter
Only learn it when yoou need it to solve a problem?You're not too way too late than?
Peter
@Peter Well if you think you might need it in the near future, you can start learning. You need to be prepared to drop in many years of experience to be competent compared to other people making compilers. Sort of like how you don't want to learn surgery unless you really want to.
Unknown
lol, and the same with surgery : learning it the sec you REALLY NEED it, seems a bit risky to say the least
Peter
Yeah but if you don't really like it, and you just learn about it for 1-2 years, you will also fail, but you will have wasted 1-2 years.
Unknown
+2  A: 

Compiler theory is useful, but not essential.

Although there are some techniques which come in handy, like lexical analysis and parsing.

Another one is error handling. Compilers need a lot of these. User input can contain anything, even the unexpected. And you need to deal with all of these.

Gamecat
+1  A: 

The compilers courses usually focus on how the high-level code is analyzed and translated into machine code. That's very interesting, but not crucial. It's more important to understand what is this machine code that is generated by the compiler so that you understand how a computer works and what is the cost of each language construct.

So I'd rather say that you should know an assembly language (I mean a limited subset of assembly language for one architecture) to understand how a computer works and the latter is definitely required for a competent programmer so that he understands what segmenation fault is, when to optimize and when not and other similar low-level things.

sharptooth
Can you recommand one? (an assembly language)
Peter
I would just learn one that your computer uses. For me that was Windows x86.
Unknown
It can be MASM if you most will develop for x86 processors. Doesn't really matter - assemblers are hardcore enough anyway and knowing any one will give you an edge in the long run.
sharptooth
txt to you all, any IDE's?
Peter
Disagree that the translation isn't crucial -- understanding compiling and linking is more helpful with resolving bugs. As for an assembly language to learn, what about the classic MIX (http://en.wikipedia.org/wiki/MIX)? I'm only partly tongue-in-cheek here...
Pontus Gagge
It's enough to have an idea of what compiling and linking is for resolving bugs, and one will definitely learn all of this while playing with the assembler.
sharptooth
+3  A: 

You should learn about compilers, for the simple reason that implementing a compiler makes you a better programmer. The compiler will surely suck, but you will have learned a lot during the way. It is a great way of improving (or practising) your programming skill.

JesperE
+2  A: 

If you're going to be working at a high-enough level where you're worrying over UML and self-describing code, you could easily go your entire career without wanting or needing intimate details of how the compiler works.

But, if you're an in-the-trenches coder and have no aspirations to manage your friends, it's likely that one day, you'll realize you're waging war with your compiler. It could be a random bug that comes along or a hallway conversation about while-verses-for loops. You'll realize the assembly (or IL, likely, in the coming years) is just a bit to the left of what you were needing and another universe will unfold.

So, I suppose my answer is, just be aware of the compiler for now, that it's doing quite a lot, but don't worry over it too much.

overslacked
+7  A: 

If you just want to be a run-of-the-mill coder, and write stuff... you don't need to take compilers.

If you want to learn computer science and appreciate and really become a computer scientist, you MUST take compilers.

Compilers is a microcosm of computer science! It contains every single problem, including (but not limited to) AI (greedy algorithms & heuristic search), algorithms, theory (formal languages, automata), systems, architecture, etc.

You get to see a lot of computer science come together in an amazing way. Not only will you understand more about why programming languages work the way that they do, but you will become a better coder for having that understanding. You will learn to understand the low level, which helps at the high level.

As programmers, we very often like to talk about things being a "black box"... but things are a lot smoother when you understand a little bit about what's in the box. Even if you don't build a whole compiler, you will surely learn a lot. You will get to see the formalisms behind parsing (and realize it's not just a bunch of special cases hacked together), and a bunch of NP complete problems. You will see why the theory of computer science is so important to understand for practical things. (After all, compilers are extremely practical... and we wouldn't have the compilers we have today without formalisms).

I really hope you consider learning about them... it will help you get to the next level as a computer scientist :-).

Tom
I'll add that if you want to know how to robustly process input, you'll also take compilers. And that is a common need, even in "run-of-the-mill" coding IMO.
Michael E
A: 

If you intend to write extremely time-critical real-time code, you will benefit from understanding how the compiler optimises your code. However, you will actually benefit more from understanding the underlying architecture of your hardware.

From my experience, if you understand how the hardware works, and how the compiler interprets your code, you will be able to write code that does exactly what you intend it to do. I have been caught on several occasions, writing code that got optimised away by the compiler and made the hardware do something that I did not intend.

All in all, understanding the entire software-hardware stack is not essential to write good algorithms and code, but it will most certainly help!

sybreon