The Importance of Low-Level Languages?

  • (2 Pages)
  • +
  • 1
  • 2

17 Replies - 2205 Views - Last Post: 02 May 2012 - 10:29 AM

#1 LogicError  Icon User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 32
  • Joined: 05-November 11

The Importance of Low-Level Languages?

Posted 17 April 2012 - 03:49 PM

Looking around the internet, I keep hearing the argument about the importance of learning low-level languages over the higher-level languages. I have been learning Java for about 6 months now and am considering taking a break and moving over to C, and maybe Assembly Language if I really get into it.

http://thread.gmane....643/focus=57918

The above is a post by Linus Torvalds (Linux Creator) that argues pretty adamantly against high-level programming languages.

I've heard that you should become very comfortable in C and move into topic such as OS APIs and Network Programming. This is all very foreign stuff to me as I am fairly new to programming. (Just finishing up AP Computer Science).

I've also heard that massive programs such as Bloomberg are written in both lower level and higher level languages. All the behind the scenes code is in C and Assembly Code, while the front door GUI stuff is in higher-level languages, so it sounds like learning lower-level languages is definitely applicable in the "real world."

Anyway, I have no idea what I am talking about so just wanted your thoughts.

Thanks

Is This A Good Question/Topic? 0
  • +

Replies To: The Importance of Low-Level Languages?

#2 Lemur  Icon User is offline

  • Pragmatism over Dogma
  • member icon


Reputation: 1368
  • View blog
  • Posts: 3,443
  • Joined: 28-November 09

Re: The Importance of Low-Level Languages?

Posted 17 April 2012 - 04:50 PM

The lower the level the more direct control you have over the hardware. GUI doesn't need fine grained hardware control, making higher levels ideal and easy. Drivers, firmware, and other such software requires low level interface.
Was This Post Helpful? 0
  • +
  • -

#3 turboscrew  Icon User is offline

  • D.I.C Addict

Reputation: 100
  • View blog
  • Posts: 615
  • Joined: 03-April 12

Re: The Importance of Low-Level Languages?

Posted 17 April 2012 - 10:02 PM

All kinds of programming languages have their place. It's upto what kind of programs you are writing. Most languages have been developed to support something better than other languages.
Was This Post Helpful? 0
  • +
  • -

#4 jon.kiparsky  Icon User is online

  • Pancakes!
  • member icon


Reputation: 7744
  • View blog
  • Posts: 13,083
  • Joined: 19-March 11

Re: The Importance of Low-Level Languages?

Posted 18 April 2012 - 08:01 AM

I don't know about low level languages "over high level" but I do think that it's important to understand the machine pretty much all the way down, which to me means that you should start with C and in the process of learning C, get a sense of what the compiler output looks like in assembly, and how that works.

"Learning" assembly - by which I assume you mean being able to write a non-trivial application in assebmler instructions - seems to me like it might be insane, but if it turns you on, go for it. I'd be happy if programmers were able to think down through the floor of their source code and envision that for loop as a series of jumps, but I wouldn't ask them to write those loops unless they really felt that was what they wanted to do.

Likewise, a java programmer should be able to envision what it is their objects are doing, all the way down to the jvm code. Ideally, I'd like to see anyone programming write at least a major portion of a compiler for some real language, I think that would make for a better world of code.
Was This Post Helpful? 0
  • +
  • -

#5 baavgai  Icon User is online

  • Dreaming Coder
  • member icon

Reputation: 5826
  • View blog
  • Posts: 12,681
  • Joined: 16-October 07

Re: The Importance of Low-Level Languages?

Posted 18 April 2012 - 10:56 AM

View PostLogicError, on 17 April 2012 - 05:49 PM, said:

http://thread.gmane....643/focus=57918

The above is a post by Linus Torvalds (Linux Creator) that argues pretty adamantly against high-level programming languages.


That's pretty classic. Seen it a few times. Probably referenced it once or twice.

He later adds something interesting:

Quote

C++ is in that inconvenient spot where it doesn't help make things
simple enough to be truly usable for prototyping or simple GUI
programming, and yet isn't the lean system programming language that C is
that actively encourags you to use simple and direct constructs.
-- http://thread.gmane....643/focus=57918


The criticism is somewhat valid. It's also what C++ programmers enjoy about the language. Always being close to the metal while having infinite levels of abstraction. Personally, I have a love hate thing with C++.

When I see someone using C++.NET I just feel bad. You gain nothing but non standard pain from the exercise. You really might as well use C# at that point.

I like C. But I like Python, Java, and C#, as well. C# and Java give you typed OOP nirvana. C#, in apparent Python envy, also gives you non OO toys. Python allows for duct typed free form play time. C takes away the toy box and challenges you to use only the toys you build yourself.

Every language has strengths and weaknesses. Every language will teach you something. Don't limit yourself to a particular language. Rather, find out what people like about a language and how problems are solved in it. You'll be surprised how this will help in all the languages you know.
Was This Post Helpful? 2
  • +
  • -

#6 sepp2k  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2113
  • View blog
  • Posts: 3,235
  • Joined: 21-June 11

Re: The Importance of Low-Level Languages?

Posted 18 April 2012 - 11:19 AM

View PostLogicError, on 18 April 2012 - 12:49 AM, said:

http://thread.gmane....643/focus=57918

The above is a post by Linus Torvalds (Linux Creator) that argues pretty adamantly against high-level programming languages.


Actually he mostly argues against C++. He also argues against it in the context of "something like git, where efficiency was a primary
objective".

It should also be mentioned that Linus, being a Kernel hacker, has a very skewed perspective on these things and that there are plenty of equally accomplished programmers that have different opinions on this.

This post has been edited by sepp2k: 18 April 2012 - 11:33 AM

Was This Post Helpful? 0
  • +
  • -

#7 blackcompe  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1155
  • View blog
  • Posts: 2,533
  • Joined: 05-May 05

Re: The Importance of Low-Level Languages?

Posted 18 April 2012 - 02:40 PM

Long story short, you'll understand computers better. It bridges the gap between the software and hardware interface. Just like they tell you to read an algorithms book so that you can write code to solve large problems quickly, code in assembly and you won't be lost when people talk about heaps, stacks, registers, memory, etc. It'll give you more insight into how code is really doing what it's doing. You have explicit control over the hardware.

Honestly, coding in assembly hasn't made me significantly better in Java. I understand its implementation a lot better, but that's about it. Now I'm more likely to choose a byte over an int when I know its value won't exceed 2^7-1. Lol.

Assembly may just be another skill learned, but my perspective on computing has changed quite significantly and has enabled me to openly discus other topics with confidence. That's its worth to me.

Starting out with C isn't such a bad idea, although you can pretty much start assembly at any time. And no one in their right mind codes in assembly regularly, unless they have to.

If you can see yourself programming robots, microcontrollers, etc. then you should definitely get to it, but if you're more interested in creating software systems, there's really no reason to be overly concerned with learning assembly.
Was This Post Helpful? 0
  • +
  • -

#8 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 574
  • View blog
  • Posts: 2,989
  • Joined: 19-May 09

Re: The Importance of Low-Level Languages?

Posted 23 April 2012 - 01:02 PM

Quote

And no one in their right mind codes in assembly regularly, unless they have to.
People who get good at it tend to prefer it. One of my brothers specializes VTAM customizations (meaning, he's a stone expert in Assembly, and only uses C/C++ when he has to), and he has always asserted that his knowledge of Assembler allows him to spot errors in any other language pretty easily.

I personally learned how to use Assembler to print an asterisk on a DOS screen about 25 years ago. I was impressed with the simple elegance of Assembler. Then I quit using it. :lol:

This post has been edited by BobRodes: 23 April 2012 - 01:04 PM

Was This Post Helpful? 0
  • +
  • -

#9 blackcompe  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1155
  • View blog
  • Posts: 2,533
  • Joined: 05-May 05

Re: The Importance of Low-Level Languages?

Posted 23 April 2012 - 01:48 PM

Quote

People who get good at it tend to prefer it. One of my brothers specializes VTAM customizations


It doesn't surprise me one would prefer to when you're working on that kind of software. I would imagine that software would need to be as basic and efficient as possible. The best kind of code!

Quote

he has always asserted that his knowledge of Assembler allows him to spot errors in any other language pretty easily.


Definitely. C becomes much easier to understand and debug. Pointers become second nature when you realize that's how objects are passed around in assembly.

This post has been edited by blackcompe: 23 April 2012 - 01:50 PM

Was This Post Helpful? 0
  • +
  • -

#10 sepp2k  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2113
  • View blog
  • Posts: 3,235
  • Joined: 21-June 11

Re: The Importance of Low-Level Languages?

Posted 23 April 2012 - 06:30 PM

View PostBobRodes, on 23 April 2012 - 10:02 PM, said:

he has always asserted that his knowledge of Assembler allows him to spot errors in any other language pretty easily.


Any other language? That's a pretty bold claim. And one I'm pretty sure he wouldn't have made if he knew many other languages. I mean I can buy that for C¹ and (to some degree) C++, but I completely fail to see how knowledge of assembler would help with say Haskell or Prolog or other similarly high level languages.

Speaking of those languages: Earlier in this thread someone mentioned how knowing assembler will help you know what the code you're writing in higher level languages compiles to (even for languages like C++ that's not always true though - the amount of optimizations that some compilers perform is amazing - that's beside the point though), giving you a better understanding of how things work. This is also something that only applies up to a certain level of abstraction. If you try to reason about Haskell code in that way, you'll get a severe headache fast (plus it won't help - understanding about laziness vs. strictness and when GHC optimizes what is much more important to writing efficient Haskell than understanding assembler is).

¹ On second thought: No, I can't. In fact I believe that knowing Assembler well could easily hide UB errors from you because you know how the naively compiled assembler for that code would act, and you assume that the C/C++ code will act the same way.

This post has been edited by sepp2k: 01 May 2012 - 11:24 AM

Was This Post Helpful? 0
  • +
  • -

#11 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 574
  • View blog
  • Posts: 2,989
  • Joined: 19-May 09

Re: The Importance of Low-Level Languages?

Posted 01 May 2012 - 11:03 AM

Well, I should have said "other languages". He made the assertion 30 years ago, when there wasn't any C++, and I can't say that I'm quoting him exactly.

Since we're demanding precision here: "besides the point" should be "beside the point." :lol:

This post has been edited by BobRodes: 01 May 2012 - 11:04 AM

Was This Post Helpful? 0
  • +
  • -

#12 sepp2k  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2113
  • View blog
  • Posts: 3,235
  • Joined: 21-June 11

Re: The Importance of Low-Level Languages?

Posted 01 May 2012 - 11:22 AM

View PostBobRodes, on 01 May 2012 - 08:03 PM, said:

Well, I should have said "other languages". He made the assertion 30 years ago, when there wasn't any C++, and I can't say that I'm quoting him exactly.


There were plenty of languages that are farther removed from assembler than C++ though (various Lisps, Smalltalk, ML, ...). And, as I said, even in C reasoning in terms of assembler can hurt you as often as it helps (though admittedly that may not have been true to the same degree thirty years ago).

Quote

Since we're demanding precision here: "besides the point" should be "beside the point."


Noted and fixed.

This post has been edited by sepp2k: 01 May 2012 - 11:29 AM

Was This Post Helpful? 0
  • +
  • -

#13 jon.kiparsky  Icon User is online

  • Pancakes!
  • member icon


Reputation: 7744
  • View blog
  • Posts: 13,083
  • Joined: 19-March 11

Re: The Importance of Low-Level Languages?

Posted 01 May 2012 - 11:54 AM

Sepp, I'm not sure exactly what your point is here. Not that I don't think you have a good point, you usually do, but I'm not sure what it is you're getting at.
I suspect you might be missing the point of the "knowing assembler helps you understand other languages" idea. It's not that you translate the other languages into assembler, it's that you have a better understanding of what the machine is actually doing with that source ultimately, so you have a better reference for what that source is ultimately up to. It's all machine instructions (or virtual machine instructions) in the end, after all. The further down into the machine you can see, the better you can understand any one part of it - this seems to me to be simple common sense.
Was This Post Helpful? 0
  • +
  • -

#14 sepp2k  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2113
  • View blog
  • Posts: 3,235
  • Joined: 21-June 11

Re: The Importance of Low-Level Languages?

Posted 01 May 2012 - 12:21 PM

View Postjon.kiparsky, on 01 May 2012 - 08:54 PM, said:

Sepp, I'm not sure exactly what your point is here. Not that I don't think you have a good point, you usually do, but I'm not sure what it is you're getting at.
I suspect you might be missing the point of the "knowing assembler helps you understand other languages" idea.


If you're referring to my most recent post, I'm not talking about that idea - I'm talking about the assertion that "knowledge of Assembler allows [one] to spot errors in any other language pretty easily".

If you're referring to the second paragraph of my previous post (where I did talk about that idea):

Quote

It's not that you translate the other languages into assembler, it's that you have a better understanding of what the machine is actually doing with that source ultimately, so you have a better reference for what that source is ultimately up to. It's all machine instructions (or virtual machine instructions) in the end, after all. The further down into the machine you can see, the better you can understand any one part of it - this seems to me to be simple common sense.


I just can't see how that is true for languages like Haskell. Just knowing assembler won't help you in understanding how the machine executes your Haskell code at all. For that you primarily need to understand how thunks work (which by itself is already implementation-specific, so you should keep that in mind) and how the IO monad is translated (ditto). Once you understand that, understanding assembler will give you little additional understanding.

And the only reason why understanding such implementation details as thunks is useful is to reason about performance. It is not at all useful for reasoning about semantics. That is to say if you try to understand how a program works by trying to understand how the machine will execute it, you'll have a very hard time with that. You should first understand what the program does and then (if the performance turns out to be poor) reason about its performance by using your knowledge of how the compiler compiles the code. But even then the vast majority of performance improvements will come from your understanding of laziness and compiler optimizations, not from your understanding of assembler.
Was This Post Helpful? 0
  • +
  • -

#15 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 574
  • View blog
  • Posts: 2,989
  • Joined: 19-May 09

Re: The Importance of Low-Level Languages?

Posted 02 May 2012 - 06:40 AM

Quote

I just can't see how that is true for languages like Haskell.
Neither can I. Nor can I see how the fact that some black bears are brown refutes the assertion that most of them are black.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2