Sponsored by Travelzoo
Take Advantage of Ridiculously Low Holiday Airfares view!
travelzoo.com - Flights $52 and up for Thanksgiving, Christmas & New Year. But move on it now.
78 Comments
- afx1, on 10/12/2007, -5/+66Assembly is the new punchcard.
- simpleid, on 10/12/2007, -3/+56Shame, pcgeek101, basically you're proving yourself to be a person with utter disregard for sanity and logic. Keep up the comments with shallow intent and you just might be the next 'anicejew.' (Unless that's you in disguise.)
On another note, why are blogs with such little content (rather lack of useful information) hitting the front page? This isn't actually contributing much. And if any of you really believe C(or C++) is some kind of 'new assembly' you must have only learned C/C++ in the past year and likely only read a website briefly describing what Assembly even is. ASM is far from unusable, in fact it's quite necessary for specialized tasks even today, (for example) in game development Assembly is used to do specific tasks in rendering graphics. What about hardware? robotics? assembly language is the foundation of practically every language we use and is how we a lot of hobbyists develop new languages with specific intent and features in mind, you can't even really compare it to C/C++. ASM is a gateway to being able to do ANYTHING on a machine, and if you ever needed more features available it's by means of ASM to create those specialized and most accelerated methods.
It sounds like the person who wrote the blog is just a web developer with some programming interests, so of course it SEEMS like you can say ASM can be replaced by C, but that notion is actually quite -insane-.
If you think the world of computers and development is peaking with high level languages, you're insane. There's probably a far larger future in low level worlds, merging real life effects with computation abstraction. ASM is absolutely necessary, and will always be there as a fundamental base to extend features and give high level programmers the power they need.
ASM demands respect. :) - Detritus, on 10/12/2007, -4/+51ASM will always be the Latin of computer languages. Yea C gets you used to pointers and such, but ASM is vital for really understanding what the machine thinks it is doing.
If you learn Latin, learning most western languages is a lot easier and allows you to debug the building blocks which is necessary for building new grammatical nuances. If you learn ASM, learning most languages is a lot easier (save for OOP concepts) and allows you to debug at the machine level which is necessary for hax0ring everything from consumer electronics to copy-protection.
I understand where the author is going with this in terms of performance vs. time invested, but that is just one facet of the packet. - NotEvenClose, on 10/12/2007, -3/+30The programming languages have not "moved to a higher plane." The hardware has. Advances in CPUs, memory, drive speeds, etc (along with newer easier programming languages) have all made for many allowances in lazy programming. Many developers probably have never even taken an algorithms course or conducted an analysis on code performance. As Alan Kay said, many of the "computer science" curriculum these days are nothing more than glorified Java certification programs. The truth is that assembly (for machines or virtual machines) will always be there even if it is so far abstracted away that the developer cannot see it. Developers can pretend that this is some wonderful evolution to a "higher plane", but the truth is that it is just easier to program without having the foundation or discipline that those "older" languages required.
- Berkana, on 10/12/2007, -10/+33I'd say that C isn't the new anything. C is C; too low level to take advantage of the powerful abstractions provided by OOP and FP, but just high level enough to be barely portable. If C is the new assembly, this is a long overdue observation; it's been so since the late 90's.
- skymt, on 10/12/2007, -2/+23C++: an octopus made by nailing extra legs onto a dog.
-- Steve Taylor
In C++ it's harder to shoot yourself in the foot, but when you do, you blow off your whole leg.
-- Bjarne Stroustrup (the creator of C++)
Within C++, there is a much smaller and cleaner language struggling to get out.
-- Bjarne Stroustrup - VargVikernes, on 10/12/2007, -1/+15"I invented the term object-oriented, and I can tell you I did not have C++ in mind."
-- Alan Kay
"For the future of C++, I think Qt is a good solution. It doesn't do anything in particular really well, but it does do something of everything. Just like C++."
edit: and a few more:
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
"Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems." - inactive, on 10/12/2007, -4/+17A digg post, about a blog post... about a blog post... about a dumb opinion.
/buried. - nayr, on 10/12/2007, -2/+14for some things, high level languages work, but for others (i.e. a vector class), only c/c++ will work. C will always be more than assembly language because it's not that hard to learn and use. It's quite readable and it's FAST.
- inactive, on 10/12/2007, -5/+17The fact is today's hardware has enough power that it could run code produced by beaten and tortured monkeys (I see that all the time), but C/C++ and assembler will never die. Anything pushing the limits of present day tech needs it. Device drivers, graphics apps, interpreters for higher level languages.
Most Java and Python programmers have lived all their lives on a layer above making time sheets and "enterprise" software that is generally disgustingly slow and bloated. So long as you can still meet requirements that's fine, really who cares if the page loads in 10 seconds at work, but C and assembler built and continue to support your fat ass languages up there in your utopia of limitless memory. It isn't going away anytime soon. - technogenius, on 10/12/2007, -11/+22@pcgeek101.... maybe you never learnt how to search a dictionary
http://dictionary.reference.com/browse/learnt
v. learned also learnt (lûrnt), learn·ing, learns
v. tr.
1. To gain knowledge, comprehension, or mastery of through experience or study.
also.. people can't handle programming in C. If you only learn high level languages you won't understand the basics of memory allocation and pointers. - speedballtucker, on 10/12/2007, -2/+13I strongly disagree. C is for Cookie.
- Otto, on 10/12/2007, -2/+13That pretty much nails it right on the head. If you're programming an application and such, yes, you'd be an idiot to do it in C/C++ when other languages have tons of libraries to do all the little stuff for you, like drawing windows and high-level networking and such.
But C/C++ will never, ever die because it's fast and efficient. It's also highly readable, despite what people say. Sure, you can program unreadable crap in it, but you can do that in any language. People who write with it regularly tend to write readable code because they're not the only people hacking on it. C/C++ is the language of choice when describing low-level algorithms. All device drivers are written in C. Anything that talks directly to hardware or networking is C.
There are always cases where you need to code for speed and you don't need all the pretty GUI, and you do those in C, or sometimes, C++. And those still end up being like 30% of the code that gets written. The other 70% of the time, use whatever you want. - johnsto, on 10/12/2007, -4/+14Gotta say that Python + C is my preferred combination. Do the high-level stuff in Python, do the low-level stuff in C, and join the two together. It's especially easy with things like PyInstant and Psyco...
- icepack12, on 10/12/2007, -1/+9I just got the k&r ANSI c book in the mail no more than 10 minutes ago.
what are the chances of that. - psylence, on 10/12/2007, -2/+9That's good enough for me.
- inactive, on 10/12/2007, -2/+9C doesn't have OO built into it, though C++ does. While sometimes this is nice to have, most of the time C++ just adds unwanted complexity.
Take a peek at a few pages of C code from different sources, then take a look at C++ code from different sources. Hardly any difference with C, but C++ can be obfuscated simply through the style of the programmer.
Keep it simple. - Sirocco, on 10/12/2007, -1/+8Yep, ain't that the truth. When Microsoft says their next OS will be coded from the ground up in Python, I'll believe that C is antiquated.
- pak314, on 10/12/2007, -2/+9My work involves embedded firmware development. The ASIC has an 8-bit processor but there is some custom hardware too because it is performance critical. For the custom hardware I write the code in assembly because a compiler doesn't exist. For the 8-bit processor much of it is written in C. There are some inner loops and tricky code that I write in assembly but the majority is in C. I inherited the code from others and there are spots where they wrote the code in assembly with no obvious benefit. I convert the code back to C and in many cases the compiled code is smaller and faster and most definitely more readable. Knowledge of assembly is important too because a) it helps track down compiler bugs which are not uncommon in non-mainstream compilers and b) it helps you identify C code that could be further optimized.
- itistoday, on 10/12/2007, -2/+9@beotch: I don't know why people are digging you up, I can only guess they have never programmed in assembly before and probably know very little about it. The idea that you should write in assembly to get significant speed boosts is a myth today; it was only true back when compilers were bad. You were right when you said that for most things optimized C compilers will beat human assembly coders, but you should have stopped there.
Complicated algorithms are rarely written in assembly precisely for the reason that they are complicated. Nowadays assembly is mainly used by inlining it within C code, and this is usually done for "one-liners", like making a few syscalls that can only be done from within assembly. Very few people alive today have the patience or the expertise necessary to write long, complicated assembly code better than what can be generated by a compiler from C. I challenge you to produce modern benchmarks saying otherwise. - Comatose51, on 10/12/2007, -3/+9@simplied: I disagree with you on some of that. It is actually not necessary to know ASM to write a compiler. You can always compile to C first or some other intermediate language just like the way C# and Java does. Compiling is just a series of parsing and generation of trees and then finally tiling the leaves with ASM or another simpler language of your choice. Instead of going all the way down to ASM, you can always stop higher up in that process. Furthermore, ASM itself is not the end of that process. ASM still needs to be parsed using an assembler to get the final product.
My point is that ASM is only one point in a series of steps in compiling code. Sometimes its necessary to use ASM to really fine tune some stuff but in doing so you sacrifice the higher level picture and possibility some portability. This is why only small portions of projects ever have direct ASM involved. Where you want to start, be it Javascript, C#, C/C++, ASM, etc. really depends on what you're doing. However, nowadays it's pretty uncommon to have to deal with ASM directly. I'm willing to bet that even in a big gaming project that might need ASM, they only have a few guys who deals with that and only occasionally. - Comatose51, on 10/12/2007, -1/+6One last comment about ASM and languages: I think some people get mesmerized by the prospect of getting down into the nuts and bolts of a machine that ASM offers. Yes there are definitely occasions when ASM style nuts and bolts optimization is needed. However, if you're down to optimizing the ASM then I can only assume either:
1. You work with specialized hardware where no good optimizing compiler exists.
2. Your code is so damn good and optimized that you need to tweak ASM to get the last bit of performance out of it.
1 is possible and 2 is highly unlikely. If 1 and 2 doesn't apply and you're tweaking ASM then you're looking at the wrong place. Performance hits rarely ever come from somone using the wrong language. I've seen more performance hits from people simply writing bad code. Bad code is independent of language. When you use only an array when a hashtable is much more appropriate, you're taking a huge performance hit. Tweaking ASM when neither of the above conditions apply is like shaving grams off of your rims when you have a parachute hooked to your car. I doubt situation 2 occurs that often, unless your name starts with "D" and ends with "onald Knuth". - rompom7, on 10/12/2007, -1/+6Because computers have more power these days, you can use even the most inefficient scripting language and it still be acceptable for a lot of things. Also, 90% of scripting languages probably go towards web development.. Where performance is usually incredibly less than the time it takes for a user to download the page. Theres also things like when using XML... It doesn't matter how fast you can parse the XML, getting it is going to take longer (in most cases).
But still, for your run of the mill project, that doesn't need to be super fast, scripting languages are fine.
Someone (bah! can't remember name) said something along the lines of "Perl is to C as what C is to Assembly".
If I remember correctly, a lot of diggers don't like Perl (maybe because it's older, or because they are caught up in the Ruby buzz... Ruby btw is excellent, but it's not going to make me _hate_ another language.) - Bakkster, on 10/12/2007, -1/+4Or minimize code size. Or do something so low level in HW that it's just as easy to do in ASM.
Assembly is best used on micro controllers that don't have much ROM. You can easily halve your code with just a little knowledge of assembly. - nadadingsda, on 10/12/2007, -1/+4I agree with that, Python and C is a powerful combination. I use it for image and video processing which is computationally intensive and Python can be too slow for some tasks, however it is great to glue everything together. But there is still a place for assembly, for some task (like digital filtering, vector operations) it is more efficient to use hand optimized assembly functions than write the same thing in C. However, most of the time you can buy a library with these functions (like the Intel IPP library) and you don't have to program the assembly yourself. On some architectures it can be pretty amazing how much faster hand optimized assembly can be than C. I have seen examples on TI DSP's that were about 50 times faster than the equivalent C code, because the compiler usually fails to use the pipelined architecture of the processor efficiently.
- Ademan, on 10/12/2007, -1/+4I just observed a quite lengthy arguement regarding whether or not c is object oriented or not. If you've had the (misfortune) of looking at any C code, you'll notice that much of it is something like this:
struct Foo
{
//blah
};
void Foo_Member_Method_Of_Foo(Foo *, ...)
(of course i simplified this a bit since, in the name of data hiding, the header file doesn't usually contain the actual struct's definition)
which of course is the equivalent of c++'s
class Foo
{
public:
void Member_Method_Of_Foo( ...);
//blah
};
And of course adding things like virtual functions are fairly easy to do with a home made vtable (more trouble than it's worth) or with function pointers (that belong to said object). That said, it's less than ideal, but it's far from being a total pain in the ass, and it's how much C code is written. So to claim C isn't an Object Oriented Language is (in my opinion) only half right, since without (too much) extra trouble C can have many of the features that modern object oriented languages have, but the language itself doesn't really have those as language features, instead you have to essentially implement them yourself.
But another part of the question is, WHAT IS OBJECT ORIENTED PROGRAMMING? If 5 of you who know what you're talking about all gave me a definition, most likely they'd all be different, they'd probably agree on a few core things, which is grouping of data and method, which C supports quite well. Someone said "in C structs and functions are members of files rather than objects" which suggests that they are in fact grouped.
I've managed to ramble, but I guess my point more than anything was just that the answer to the question "Is C object oriented?" the answer isn't a simple "no" and it really depends on who you ask. - dgendreau, on 10/12/2007, -1/+4I agree, however knowledge of assembler is essential if you have to do any serious debugging.
- kokorhekkus, on 10/12/2007, -2/+5@rompom7
"In Australia and England it is indeed incorrect to spell 'learned' as 'learnt'. Even the Firefox spell check (US Dictionary) picks up 'learnt' as being incorrect."
No... it's you and pcgeek that are wrong. Search for learned respectivly learnt on news.bbc.co.uk an you get 2/3 learned and 1/3 learnt. Learnt was apparently the older version and learned is newer but steaidly getting more popular. (see
http://www.bbc.co.uk/spanish/specials/1125_questions/page6.shtml)
Oxford Dictionaries on http://www.askoxford.com/asktheexperts/faq/aboutspelling/learnt says:
"What is the difference between 'learnt' and 'learned'? - These are alternative forms of the past tense and past participle of the verb learn. Learnt is more common in British English, and learned in American English. There are a number of verbs of this type (burn, dream, kneel, lean, leap, spell, spill, spoil etc.). They are all irregular verbs, and this is a part of their irregularity."
Please stop spreading disinformation. - inactive, on 10/12/2007, -6/+8For most code it may well be true that optimizing compilers win over hand coded assembler, but for complex algorithms no machine can currently outwit a practiced and clever human who knows exactly what he wants. Compilers can only guess at your intentions and can't take many shortcuts to reach the result your code describes.
- Jonny0stars, on 10/12/2007, -2/+4I dont think C is the "new assembly" assembly was never new it simply came into being so you did not need to be a human binary converter, its always going to be there unlike more higher level languages which will evolve and some possibly die.
- Ademan, on 10/12/2007, -1/+3I would have dugg you down, but you said "In 90 Percent of cases", saved your butt :-)
You're totally right, assembly isn't nearly as useful as it used to be, and with good optimizing compilers it's becomming even less and less useful. Unfortunately compiler support for vectorization (using SSE based instruction sets) is still rather abysmal, and ASM snippets are often found in those places.
Note: my comment about compiler optimization was kind of a blanket statement, the intel C compiler is AMAZING (but also expensive) - rzalegend, on 10/12/2007, -0/+2@Ademan
I believe that OOP is just programming and design style. It has nothing to do with a programming language you use.
Yes some languages has direct support for the OOP and some don't have but that's not a problem. Like Steve McConnell said you should be programming to the language and in the language. As far as the language is turing complete you can do anything you want in it (maybe it will be inefficient as hell but i hope you know what i mean).
Look at WinAPI32+C that's pretty much an OOP. - h0dg3s, on 10/12/2007, -3/+5When is there going to be a bury:Blog option?
- danielpunkass, on 10/12/2007, -0/+1Great idea! I'd encourage you to do so with my blog if it would improve comment quality when it gets dugg.
- mentor, on 10/12/2007, -0/+1(That may well have been my point. For the record, PHP is an evil, useless excuse for a 'language' that's only redeeming feature is that it's not ASP.)
- inactive, on 10/12/2007, -0/+1Apologies, I was a dick and wrote the above in a hurry. What I meant to say was: "it just isn't efficient to code in *assembler* any more apart from for speed/size critical stuff. Plus there are so many optimisations that a compiler can apply to *assembly* code..."
- gunbuster, on 10/12/2007, -0/+1Java is the new COBOL....
Don't believe me? First there's the buzzwords: "mission critical", "enterprise", and "best of breed". Then you look who's making money with Java - IBM - check. Big consultancies - check. Finally, are people selling lots of hardware for Java? You bet. Someone needs to find a way to move those 8-way servers.
Things really haven't changed all that much, we've just switched out one platform for another. - tomarocco, on 10/12/2007, -0/+1I just got mine in the mail yesterday...movin' on down to the embedded world.
- inactive, on 10/12/2007, -3/+4bool is_c_the_new_assembly() {
throw Exception("Invalid Question");
}
What's lost on most people is that the author is talking about the new Python and Ruby bindings in OS X 10.5. Presumably developers can write their applications in Ruby and re-code the slow parts to Objective-C. In that sense, C is the new Assembly.
In reality, there are lots of good reasons why you wouldn't want to write a large-scale application in a scripting language. But it's perfectly acceptable and desirable to do rapid prototyping in a scripting language before moving to a compiled language, and there's no reason why you couldn't continue to use a scripting language to implement the GUI parts. - martypal2005, on 10/12/2007, -3/+4Compilers are so superior these days.
No need to do assembly anymore.
In 90 percent of cases.
Now digg me down. - dgendreau, on 10/12/2007, -1/+2Exactly.
/curmudgeon mode=on
I tell ya. Kids these days with their fancy virtual machines and garbage collection.
How many of them can read the assembler dump in a Dr. Watson log and decompile it to figure out exactly what module and function caused the crash?
/curmudgeon mode=off - concertina, on 10/12/2007, -2/+3"If you need high performance, you should generally use C, and if you don't, you should be using something even higher level -- Python or Perl."
There, fixed that for you.
The only legitimate excuse for coding in php is needing a web-based solution within a framework already based in php to be written by a staff already knowledgeable in php under a tight timetable.
PHP is a godawful sorry excuse for a language. - grumpyrain, on 10/12/2007, -1/+2I have avoided commenting on this article until now because in one part I agreed with the sentiments and in another part it is off base factually. The main thing to know about ASM is that it has some very important uses which higher level languages can not replicate usually through inefficiencies in the optimiser. But it is certainly not something that automatically makes everything faster. A perfect compiler can make a program run just as quickly. Likewise, C is not inherently superior to higher level languages.
Performance is an important aspect for most software, but it is only one aspect. So is development speed, portability, security, maintainability and computer resources. Depending on software to software, each of these factors is either more or less significant. For our specific applications, the possible performance advantages of porting to a lower level language do not offset the additional costs of doing so. But that does not apply to all software. - tomarocco, on 10/12/2007, -0/+1Your PHP is written in C. So is you OS and the drivers for that $400 graphics card you game on...and most of the game, too (the part that isn't written in assembler)!!!
- inactive, on 10/12/2007, -1/+1I agree - C is the new Assembly. Programmers used to flip switches to code in binary. Things move on, as computing platforms move on. Evolution breeds efficiency, it just isn't efficient to code in C any more apart from for speed/size critical stuff. Plus there are so many optimisations that a compiler can apply to C code, you actually get faster leaner code generated by programming in C rather than assembler. And of course in this multi-platform world, C code is portable, assembly is not usually.
FWIW I've been programming for 23 years in assembler, basic, pascal, C, javascript, php, html, sql and some other stuff. - inactive, on 10/12/2007, -1/+1Everyone is putting their 2 cents in about a FA that is only about... 2 cents.
This really is a metaphorical point of C and assembly, but a weird one to make being that *C* produces *ASSEMBLY* code which is why it is so similar....
Compiler produces in this order (just google Compiler or Compiler theory): High level language -> Intermediate level language -> machine code
For example:
C -> Assembly -> Machine code (eg: 1101 1110 1101 0111)
Java -> some intermediate language like asm -> byte code
(and java ain't the best example but FYI... byte code is like machine code but the Java Runtime Environment interprets it before launching inevitably machine code into memory)
So this metaphor isn't really a good one being how most people understand C and Assembly and by comparing them (metaphorically as this Article is) you make a poor comparison. - etnu, on 10/12/2007, -2/+2No, C is nothing like Assembly. When C started getting popular, there were already other high level languages available (FORTRAN, COBOL, etc.). The gap between Assembly and C is huge, whereas the gap between C and C#/Java/whatever is relatively small. The newer languages have garbage collection (which is a crutch for lazy programmers), better package management (I hesitate to say "good", but it's a damn sight better than what you can do with C or C++), and, instead of being compiled to machine code at compile time, they're compiled at install or runtime (which helps portability somewhat, though a good C program is usually more portable than Java or C#, since everything has a C compiler, but only a small subset of devices have a JVM, and even fewer have a CLI implementation).
Beyond that, the differences are mostly syntactic in nature.
C is only "the new assembly" to people who don't know C.
As long as there are embedded devices and video game consoles with highly limited amounts of RAM, C will continue to be a popular language. For all Microsoft & Sun's claims, every video game with high-end graphics that performs reasonably well is written in C (or C++).
Honestly, I think Java, C#, etc. are mediocre languages which are just a stop-gap solution. If you need high performance, you should generally use C, and if you don't, you should be using something even higher level -- Python or PHP.
I like Objective-C, in principal, but I find the weird syntax inventions somewhat annoying. It probably would have beaten C++ if they had used more common conventions. - nazsco, on 10/12/2007, -2/+2And where C is so diferent from assembly?
If just hide most of the register stuff. but the rest is much like it.
I never touched assembly (even for performance) if a good C compiler was available.
"C to machine code" gets you as far as "assembly to machine code". If you code in C, you only need to touch assembly if the compiler messes up.
So, C is the good old C. - Daiken, on 10/12/2007, -2/+2As a computer engineering student who regularly uses both, I'm pretty happy with these comments. Assembly just annoys the **** outta me.
-
Show 51 - 79 of 79 discussions



What is Digg?
Browsing Digg on your phone just got easier with our enhancements to the