×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

Learning Computer Science via Assembly Language

CowboyNeal posted more than 10 years ago | from the unconventional-approaches dept.

Programming 1328

johnnyb writes " A new book was just released which is based on a new concept - teaching computer science through assembly language (Linux x86 assembly language, to be exact). This book teaches how the machine itself operates, rather than just the language. I've found that the key difference between mediocre and excellent programmers is whether or not they know assembly language. Those that do tend to understand computers themselves at a much deeper level. Although unheard of today, this concept isn't really all that new -- there used to not be much choice in years past. Apple computers came with only BASIC and assembly language, and there were books available on assembly language for kids. This is why the old-timers are often viewed as 'wizards': they had to know assembly language programming. Perhaps this current obsession with learning using 'easy' languages is the wrong way to do things. High-level languages are great, but learning them will never teach you about computers. Perhaps it's time that computer science curriculums start teaching assembly language first."

cancel ×
This is a preview of your comment

No Comment Title Entered

Anonymous Coward 1 minute ago

No Comment Entered

1328 comments

Linux x86 assembly? (3, Insightful)

agm (467017) | more than 10 years ago | (#8195896)

Is "Linux x86 assembly" any different to any other kind of "x86 assembly"?

Re:Linux x86 assembly? (5, Informative)

shaitand (626655) | more than 10 years ago | (#8195919)

It is in the same fashion that win32 asm is different from linux asm. The core is the same but knowing the core of x86 assembler is going to get you far if what you are wanting to do is talk to the kernel.

Re:Linux x86 assembly? (0)

Anonymous Coward | more than 10 years ago | (#8195974)

Two different subjects. Asm is tha car, the kernel is the road.

Re:Linux x86 assembly? (3, Insightful)

dysprosia (661648) | more than 10 years ago | (#8195960)

I think what is meant is programming in assembly under Linux. Programming in assembly under Linux is different than say programming in assembly under DOS/Windows, for example.

Re:Linux x86 assembly? (1)

gangien (151940) | more than 10 years ago | (#8195982)

aren't the interrupts different? Everything all the other instructions would be the same tho I think. But i thought interrupts were OS instructions.

Re:Linux x86 assembly? (0)

Anonymous Coward | more than 10 years ago | (#8195991)

Assembly language is not machine language.

The difference between "Linux x86 assembly" and any other kind of x86 assembly is that linux assemblers generally use an AT&T like syntax and other x86 assemblers use a MASM like syntax - the only difference being syntax.

Re:Linux x86 assembly? (1)

dysprosia (661648) | more than 10 years ago | (#8196037)

Uhh, the system calls will be different if you're coding assembly under anything else than Linux.

Re:Linux x86 assembly? (1)

jhoger (519683) | more than 10 years ago | (#8196003)

The OS calls available are different from other platforms, obviously.

Also, more importantly, the syntax of the GNU assembler is very different if you're used to the Intel syntax.

-- John.

Re:Linux x86 assembly? (1)

AndroidCat (229562) | more than 10 years ago | (#8196031)

Sure. While the machine code generated might be the same, there are lots of ways to get there. An assembler might use non-standard mnemonics, or one might be a macro assembler. One might allow structures. (Object oriented assembler is a lot of fun.)

Syntax, OS interfaces... (5, Interesting)

Cryptnotic (154382) | more than 10 years ago | (#8196035)

Well, for starters the syntax for assemblers is different. There are two standards, the AT&T standard (which is used by the GNU assembler) and the other one that is more familiar to DOS/Windows x86 assembly programmers (which is used by the NASM assmebler).

Second, OS interfaces for making system calls (e.g., to read files, open network connections, etc) are different in Linux versus DOS or Windows).

Re:Linux x86 assembly? (5, Interesting)

pla (258480) | more than 10 years ago | (#8196049)

Is "Linux x86 assembly" any different to any other kind of "x86 assembly"?

Yes. Although it requires understanding the CPU's native capabilities to the same degree, Linux uses AT&T syntax, whereas most of the Wintel world uses (unsurprisingly) Intel/Microsoft syntax.

Personally, although I far prefer coding C under Linux, I prefer Intel syntax assembly. Even with many years of coding experience, I find AT&T syntax unneccessarily convoluted and somewhat difficult to quickly read through.

The larger idea holds, however, regardless of what assembler you use. I wholeheartedly agree with the FP - People who know assembly produce better code by almost any measurement except "object-oriented-ness", which assembly makes difficult to an extreme. On that same note, I consider that as one of the better arguments against OO code - It simply does not map well to real-world CPUs, thus introducing inefficiencies in the translation to something the CPU does handle natively.

Assembly Language (-1, Funny)

Klerck (213193) | more than 10 years ago | (#8195898)

Assembly Language. What's it all about? Is it good, or is it whack?

Re:Assembly Language (0)

Anonymous Coward | more than 10 years ago | (#8195975)

lol. only a low slashdot id can get away with posting that as a non-AC.

got modded up to boot.

ahhh. today's been a good day. didn't even have to use my A-K.

Re:Assembly Language (0, Redundant)

Valar (167606) | more than 10 years ago | (#8196000)

That's a low ID? Youngins'

Re:Assembly Language (0)

Anonymous Coward | more than 10 years ago | (#8196050)

Low as in lower than 50% of the 'unwashed masses.'

It's like a 102 year old calling a 97 year old a spring chicken.

Re:Assembly Language (0)

Anonymous Coward | more than 10 years ago | (#8196007)

For some reason this tired joke always makes me laugh.

Not So New Concept (5, Insightful)

andyrut (300890) | more than 10 years ago | (#8195902)

Although unheard of today, this concept isn't really all that new -- there used to not be much choice in years past.

While starting Computer Science students off with assembly (without first introducing them to a high-level language) may be a relatively new concept these days, the idea of teaching low-level languages to Computer Science students is not a revolutionary technique whatsoever. Every decent Computer Science curriculum includes several semesters of courses in which assembly language is required, to demonstrate their knowledge of basic computer processes.

That reminds me of a great fortune:

"The C Programming Language -- A language which combines the
flexibility of assembly language with the power of assembly language."

Re:Not So New Concept (2, Informative)

gid13 (620803) | more than 10 years ago | (#8195950)

I'm not even a CS student (I'm Engineering Physics), and I still had to learn some microcontroller assembly language.

While I admit that it helps you understand the device more, I have to say it's much less intuitive and enjoyable than high-level programming (not that I'm the type to find scripting fun, but you know what I mean).

Re:Not So New Concept (1)

andyrut (300890) | more than 10 years ago | (#8196018)

I'm not even a CS student (I'm Engineering Physics), and I still had to learn some microcontroller assembly language.

It's amazing how often Computer Science bleeds over into other disciplines. It seems to rear its head quite often in Mathematics (and some would argue that Computer Science is nothing more than an extension of Mathematics) and other science-based majors.

At my university, the poor engineering students had to learn Fortran. Now there's a language that's not too different from assembly.

Re:Not So New Concept (4, Insightful)

rblancarte (213492) | more than 10 years ago | (#8196051)

I was about to say the same thing. I don't think that it is some new "mystical" idea of teaching assembly to students. I am currently taking my THIRD assembly class at the University of Texas. And I know that there are others to take.

I will agree with the parent post, this is not a new concept. Now teaching assembly to beginners, that might be new.

And I don't know if "great" coders know assembly, but I think knowing assembly is a useful tool in being able to program efficient code. If you understand concepts like division, how bad it is, what the computer is actually doing when your C/C++ or whatever language (that is not interpreted) is compiled, then you are well on your way to being able to produce efficient code.

Re:Not So New Concept (1, Interesting)

Anonymous Coward | more than 10 years ago | (#8196053)

I've often wondered about this... I'm a meager 14 year old, and I've learned (and a good deal more then just a "hello world..." program) numerous "high level" languages - C/C++, a little bit of JAVA, and a good deal of PHP... However, I'm somewhat mystified by the concept of low level languages. I've never really taken the time to learn them, namely due to the fact that they are mostly useless in actual practice (as far as I can tell.) Nevertheless, I feel that I have missed out on learning how the computer works below the surface and what is actually happening when the code I write is compiled and run. It sort of produces an artificial barrier to my code - I know what it's doing, but not how and why. I feel that I could code much better if I understood what was going on, and yet I'm not sure if I'll ever really be able to learn a language like assembly due to the fact that I'm used to higher level languages and have been somewhat spoiled by them.

Does anyone else feel this way, or am I just an oddball? (which is most likely the case ;)

Knuth (4, Informative)

red floyd (220712) | more than 10 years ago | (#8195909)

Isn't that what Knuth did with his ASM language? I believe it was a synthetic assembler for a hypothetical stack machine -- hence the name ASM - Abstract Stack Machine.

Somewhere in the middle... (4, Insightful)

shakamojo (518620) | more than 10 years ago | (#8195912)

My Grandfater worked for IBM in the 70's and 80's. He did all his coding in assembly and machine language. His motto is "Anyone who doesn't know machine language has no business using a computer."

There has to be a happy medium IMHO, and I think this is a great start. While my Grandfather was on the cutting edge of the PC revolution, he now has trouble figuring out email, etc, because he operates at too LOW a level (and I feel that he now has no business being online!). Then you have the users who have the same problems because they operate at too HIGH a level (AOL, etc...). The majority of programmers nowadays fall about smack in the middle of these two groups, but I'd argue they should be a little closer to the lower levels than they currently are.

I learned LOGO and BASIC as a kid, then grew into Cobol and C, and learned a little assembly in the process. I now use C++, Perl, and (shudder) Visual Basic (when the need arises). My introduction to programming at a young age through very simple languages really helped to whet my appetite, but I think that my intermediate experiences with low level languages helps me to write code that is a lot tighter than some of my peers. Let's hope this starts a trend, it would be great if more young (and current) programmers appreciated the nuts and bolts!

Re:Somewhere in the middle... (1)

CaptainCarrot (84625) | more than 10 years ago | (#8196033)

I now use C++, Perl, and (shudder) Visual Basic (when the need arises).

Allow me to paraphrase Jack Handey here:

It takes a big man to admit to using Visual Basic. It takes an even bigger man to mock him mercilessly for it.

Re:Somewhere in the middle... (1)

digital bath (650895) | more than 10 years ago | (#8196038)

My introduction to programming was similar to yours. I used some simple scripting languages (hypercard/javascript), then learned Basic. My first induction into assembly was through the TI-83+. Yes, the calculator :) I began programming z80 assembly for the 83+ over three years ago, and have since learned C/C++, Java, 68k assembly, PHP and a few other languages.

I found that knowing an assembly language (even if it was for a relatively simple 8-bit processor like the z80) helped immensely when learning higher level languages (C++ especially).

Re:Somewhere in the middle... (2, Funny)

Supp0rtLinux (594509) | more than 10 years ago | (#8196081)

Your grandpa just clicked on the attachment I sent him inadvertently after I got the MyDoom virus after my wife clicked on the attachment her mom sent her after her husband opened the attachment your grandpa's system sent him.

Ouch (1, Funny)

Anonymous Coward | more than 10 years ago | (#8195913)

This is akin to learning medical science by practicing on yourself :)

Re:Ouch (0)

Anonymous Coward | more than 10 years ago | (#8195967)

This is akin to learning medical science by starting with learning biology :)

Re:Ouch (0)

Anonymous Coward | more than 10 years ago | (#8196030)

This is akin to arguing by bad analogy.

Uh, (-1, Offtopic)

Anonymous Coward | more than 10 years ago | (#8195914)

where are all the white women at?

Not necessarily the mark of a great programmer (1)

aligma (682744) | more than 10 years ago | (#8195916)

The best programmer I know knows C, C++, and Java. He got Class 2 Dvision 1 honours (UOW, Australia) in his degree for programming a digital watermarking system in C++ ... Pretty much a genius, but I don't think he knows assembly.

Re:Not necessarily the mark of a great programmer (3, Funny)

s20451 (410424) | more than 10 years ago | (#8195984)

I'm not a great programmer, but I never really understood programming -- especially C programming -- until I took 68000 assembly. It also took a digital logic course so I could imagine how a processor was built. It's just abstract manipulation of symbols until you can imagine exactly how your printf("Hello World!\n"); gets broken up into neat little binary chunks.

ps. Don't make them learn x86 assembly. I think that's banned under the Geneva convention.

Re:Not necessarily the mark of a great programmer (0)

Anonymous Coward | more than 10 years ago | (#8196006)

but i bet he understands computers at a very low level.

Re:Not necessarily the mark of a great programmer (0)

Anonymous Coward | more than 10 years ago | (#8196010)

He's talking about computer science, not programming. Anyone who has only used those 3 tools, is missing a lot of knowledge. Stuff like: how do malloc() and free() work? Does does gcc actually do?

No, but... (1)

Svartalf (2997) | more than 10 years ago | (#8196029)

...it's a way to make better programmers out of the ones that aren't prodigies.

If you understand how the CPU does things and understand something about how that compiler for your preferred higher-level language does things to the CPU, you're likely to produce vastly better code than someone that doesn't understand WHY it's not as good an idea to increment a number in C/C++ with something like:

i = i + 1;

as opposed to:

i++;

assuming that 'i' is an 'int' sized integer...

Programming or CompSci (4, Insightful)

Sebastopol (189276) | more than 10 years ago | (#8195918)

Sounds more like a programming book than compsci book.

writing an RB tree or an A* search an assembly would be a huge pain in the ass, if you ask me.

compsci is a large part about data structures, how to choose the right datastructure, how to get the most out of an algorithm by picking the best datastructure, etc...

but i didn't read the book, so i'll just go back to my websurfing now...

Re:Programming or CompSci (1)

addaon (41825) | more than 10 years ago | (#8196032)

A* isn't so bad in assembly. RB is more of a pain. Working on a rendering engine (well, geometry generator, rendering in HW) in assembly now.

CompSci's about more than that... (2, Insightful)

Svartalf (2997) | more than 10 years ago | (#8196084)

It's about optimal instruction usage, language design, automata, and a lot more. It's about optimal computing all the way around.

Not new (2, Informative)

El Cabri (13930) | more than 10 years ago | (#8195922)

Knuth's The Art of Computer Programming was illustrating the algorithm in an imaginary assembly language.

Good idea, Bad Idea (3, Insightful)

lake2112 (748837) | more than 10 years ago | (#8195927)

Good Idea: First teaching simple programming fundamentals through a simple to understand language. Then, confuse the hell out of a student with assembly Bad Idea: Teaching CS by starting with one of the most cryptic languages around, and then trying to teach basic CS fundamentals. There are already problems with people interested in CS getting turned off by intro/intermediate programming classes. Imagine the retention rates once my CS100 class is taught in assembly.

Re:Good idea, Bad Idea (0)

Anonymous Coward | more than 10 years ago | (#8196016)

1. Encourage starting CS students in assembly
2. The I-wanna-learn-Visual-Basic-so-I-can-code crowd drops out after first semester, lowering the density of IT employees
3. There is no ???
4. Profit!!!

Re:Good idea, Bad Idea (1)

tickticker (549972) | more than 10 years ago | (#8196039)


Your Bad Idea is actually the better idea. It's called a weeder class for a reason.

--

This sig is a good sig

The Art of Assembly book (1, Interesting)

Anonymous Coward | more than 10 years ago | (#8195931)

AoA [ucr.edu], a worthwhile read

Democratic Party Platform (-1, Troll)

Anonymous Coward | more than 10 years ago | (#8195935)

Bush Lied!
BUSH=HITLER!
Selected NOT elected!
illegal immoral war
HALLIBURTON!
Ashcroft=Himmler!
Fascist!
fi ll in the rest

New? (5, Insightful)

Sloppy (14984) | more than 10 years ago | (#8195938)

A new book was just released which is based on a new concept - teaching computer science through assembly language
Uh, assembly language for teaching isn't exactly a new idea. Knuth's AoCP books used MIX, a "fake" assembly language, even though easy-to-read languages (e.g. ALGOL) were already around at the time. And he wasn't even trying to teach fundamentals about computers work -- he was teaching higher-level stuff, algorithms in those books. Think about just how weird that is.

Perhaps this current obsession with learning using 'easy' languages is the wrong way to do things.
That depends on what you're trying to learn. I think someone with a CS degree should have a deep understanding of things, and should have at least some experience working in assembly language, managing memory, writing compilers, etc. But that doesn't mean that high-level languages are a bad idea when they're learning higher-level concepts. Do you want someone wasting their time remembering what is being stored in what register, when they're learning how to write a web browser? Of course not: you want them to be thinking about the real issues at hand.

well, (0, Troll)

ak3ldama (554026) | more than 10 years ago | (#8195941)

for one thing, it would certainly knock a lot of people out of the profession if the first language that they tried to learn was assembly ... though this might mean that eventually the only people writing code at least know what they're doing, therefore producing better products for the users

Re:well, (0)

webmonarch (523411) | more than 10 years ago | (#8196048)

though this might mean that eventually the only people writing code at least know what they're doing, therefore producing better products for the users

knowing how to write good code, and writing better products for the user are completely two different skills. In my experience, making it work just like the user wants it to is a back-and-forth process that rarely requires coding skill, but more listening and interpreting skills.

What, no Real Programmers anymore? (0)

Anonymous Coward | more than 10 years ago | (#8195943)

I thought schools, at the very least, would teach assembly as introductory!

Wussies (4, Funny)

mikeophile (647318) | more than 10 years ago | (#8195947)

Real programmers learn machine code.

Re:Wussies (0)

Anonymous Coward | more than 10 years ago | (#8196056)

Well, real manly programmers program bit slices.

Your book? (5, Informative)

Tet (2721) | more than 10 years ago | (#8195948)

A new book was just released

What you meant to say was that your new book has just been released. If you're going to pimp your wares on Slashdot, at least put an appropriate disclaimer on. That said, I completely agree with the premise of the book. I've met a lot of mediocre programmers, and a few good ones. But I've never yet met a real star that didn't have some background in assembly language programming. Personally, I haven't written anything in assembly in well over a decade. But that fact that I can do so if needed makes me a better programmer, and I'd recommend it to any aspiring coder as a key skill to learn. I wouldn't say IA32 is a particularly nice introduction (I'd start with a cleaner, simpler architecture, such as 6502), but it is at least widely available to anyone that wants to study it...

Re:Your book? (5, Interesting)

FreshFunk510 (526493) | more than 10 years ago | (#8196052)

Ugh. Johnnyb should've wrote a disclaimer that he was promoting his own book. This type of action turns me away from wanting to support such an individual. Sorry, nothing personal.

nah (2, Insightful)

galacticdruid (569137) | more than 10 years ago | (#8195953)

I don't think that's necessary. Unless you need assembly, why spend the time? I think your time would be better spent working on object oriented concepts and the guts of programming in general, ie: variables, conditionals, types, etc. etc.

just my 2 cents

Assembly language IS EASIER (3, Insightful)

Anonymous Coward | more than 10 years ago | (#8195955)

The think concepts of registers and memory locations and stack pointers and branching is easier to understand in assembly. You can teach a simple subset of instructions. It was the way I started back in the day. I scratched my head more later learning C, etc. I guess its just the opposite to kids these days.

Development cycle (1)

rteunissen (740645) | more than 10 years ago | (#8195959)

If i start getting a program together i want it to do what i want, and i don't want to spend to much time on hacking it together. Sure using assembly to create a program will make it faster (when used correctly) but it will take ages to develop. A language which takes this out of my hand and makes my development cycle shorter so i have more time for design and testing is more preferable over the time consuming task of programming it in assembly. Especially since most time spent on software is in design and testing, implementation needs to be as fast as possible. And with the new computers having processing power beyond anything even imaginable 10 years ago the use for assembly is quickly deminishing.

Been there (0)

Anonymous Coward | more than 10 years ago | (#8195962)

I go to the Milwaukee School of Engineering as Computer Science... One of the first things we had to learn was Assembly and we have to build an OS using it for a small car project before the end of our junior year. In addition, we have several courses dealing with the MC68HC11 processor that are helpful.

Assembly should be known by anyone programming a computer, otherwise you can never really know what your code is actually doing.

Highschool Systems (1)

HappyCitizen (742844) | more than 10 years ago | (#8195970)

should look at this book. At the highschool level, atleast around here, Algonquin (one of the better public high schools in Mass), does barely any Computer Science beyond the basics. They teach enough C++ to print messages on the screen and write files. I doubt they get to the API although they may. The also have your basic Java and VB courses. I think, not only should they teach low level programming, but our public schools need better and more programming courses. For example, you shouldn't be required to take C++ 1 Printing the screen to take C++ 2, etc. You should be able to start at your own level. Sorry if I'm ranting, I'm just annoyed at the schools CS courses and think that they should have more in the way of that. Especially assembly. I think this book would be great for it.

Hooray!! (0)

Anonymous Coward | more than 10 years ago | (#8195978)

Bloody time students learn the basics before building horrid Java 2 Swing GUIs. Not that the easy interface builders and very high level languages aren't nice or useful (Perl lets you get many complex things done in a hurry).

This is a book for the home library as well as University book stores!

Probably a bad idea (2, Insightful)

Geeyzus (99967) | more than 10 years ago | (#8195979)

I think this is a bad idea, for a couple reasons.

1) Difficulty - Assembly is harder to learn (and create meaningful programs with) than C++, or Java, which is replacing C++ in a lot of college curriculums. This means that students will be spending more time learning assembly, and less time learning about complicated algorithms and the things you really should be learning about (since languages change but algorithms are standard).

2) Job practicality - 99% of CS grads aren't going to use assembly in their day to day jobs. They will most likely be programming in Java, or VB, or some web language (PHP/ASP/etc). Maybe some C++. But unless you are doing something that requires the control that assembly can provide, like real-time software or game engine development, you simply aren't using assembly at work.

If it's harder to learn/teach, and you won't use it after you graduate, I can't see the point in teaching it at universities.

Mark

No Way! (1)

Spaceman40 (565797) | more than 10 years ago | (#8195983)

Hey, this is what I've been saying: Learn ASM structure (x86, but MIPS would be easier) Learn High-Level structure (C/BASIC/Pascal/etc) Learn OOP structure (C++/Java/Python) Instead of this stupid data structures core all the colleges are going with. Then set up a bunch of in-depth language classes, ex. on Perl, or Lisp, or whatever to actually learn the languages. They were teaching Pascal a little while ago in CS, but who ever uses it now? Why teach a language that is going to be obsolete when you could teach the structure, making learning the languages easier later on. Every job I've had has required me to learn a new language: I had to learn VRML (remember that?) a couple years ago, and I haven't used it since. Hmm.. Should probably read the article now, huh?

Knowing assembly language is vital, mostly (2, Interesting)

dysprosia (661648) | more than 10 years ago | (#8195989)

I agree with the sentiment that knowing assembly language maketh a programmer, in some circumstances. It allows a deeper understanding of how certain languages work "under the hood", and how to debug errors that may not be so easily detected by than just staring at code. Knowing C and assembler, for instance, is a good match in my eyes.

It may not be so important though, if you're a database programmer, or if you're dealing with high-level languages such as Java or something.

assembly? bah - real men program with punchcards (2, Informative)

WankersRevenge (452399) | more than 10 years ago | (#8195994)

assembly is the great monster that requires fresh blood every year, or the great darkness will fall upon the land. i myself have never dabbled in assembly because i don't like living in an hp lovecraft nightmare.

For those of you insane enough to take the plunge, check out this FREE online introduction course [ccsu.edu] (no reg, don't ya love it). The guy who wrote it is pretty wacky. I took his java introductory course [ctstateu.edu] and it was hip as well as very educational.

From the linked page (5, Funny)

LineNoiz (616971) | more than 10 years ago | (#8196001)

Get it to your Valentine on time! Choose UPS 2 DAY and pay the price of Ground.

Yeah. Give my GF a book on Linux Assembly programming. That should get those panties off in a hurry.

What about the non-developers? (1)

lake2112 (748837) | more than 10 years ago | (#8196004)

What about all the engineers who may need a basic understanding of CS for whatever applications they may have to modify, use, etc.? Engineers need very little knowledge of machine code as they often just need to create some Excel Macros, small scripts, etc.? Assembly would provide no benefit in this case, only prolong the learning process. Just because I use a car doesn't mean to drive it I have to be a mechanic ....

self published, no review?DO NOT BUY THIS BOOK (0)

Anonymous Coward | more than 10 years ago | (#8196005)

wtf?!?! There is no review here of an unread unreviewed book. This whole article is a sham. Do not buy this book. This book is the submitter's self published ego project!! Warning!!

Computer Science Curriculums (3, Interesting)

pointzero (707900) | more than 10 years ago | (#8196009)

Perhaps it's time that computer science curriculums start teaching assembly language first.
Here at University of New-Brunswick (Canada), they may not teach assembly language "first", but we do have a second year course dedicated to assembly and the inner workings of computers. My only problem though at the school is that we learn the Motorola M68HC11 cpu and not current ones. Sure it's easier to learn and understand, but most computers we work on today are x86 based.

My 2 cents.

A good idea (2, Insightful)

swtaarrs (640506) | more than 10 years ago | (#8196014)

I agree that assembly language should be taught, but not necessarily as the first language. BASIC is a good tool for teaching higher level programming ideas like conditional statements, loops, etc... Once those concepts are understood, C should be taught. I was a fairly proficient C programmer before I learned assembly (68k), but even then assembly helped me understand much more about the inner workings of C and what lines of code do. Instead of just knowing that code I write works, I now know why it works and I am able to do much more advanced things with a low-level knowledge of programming.

That's good and all but... (1)

ejaw5 (570071) | more than 10 years ago | (#8196015)

It's good to know assembly to understand the operations of a computer, but assembly isn't practical for production use. You could design your system with a specific microcontroller and write your microcode with assembly. But if for some reason you have to change chips, you may have to re-write your code. On the flip side, if you used C or some other portable language, you could compile it to other chips...perhaps with just a few chip-specific changes.

Why not just use an HP calc? (1)

teambpsi (307527) | more than 10 years ago | (#8196017)

if you really want to teach them, start even simpler -- RPN arithmatic is pretty much all you need to know about pushing and popping :)

I was in a Intro CS course... (0)

Anonymous Coward | more than 10 years ago | (#8196021)

at the University of Michgan that started off with a description of logic gates, moved up to the ISA, and then started us programming in actual binary (yes, we manually programmed the memory with 1's and 0's).

We then (quickly, thank god) moved up to assembly, and finally a bit of C. Our last program involved writing it first in C, and then acting as the compiler and translating the code into assembly.

It wasn't on x86, but a much simpler ISA that ran in simulation on a PC. It was pretty cool, figuring out hacks to re-use registers and cut down code.

Alas, the year I took the class was the last year they offered it. Now all CS majors and engineers start off with C++ and Matlab, taught in a hackneyed fashion.

For the record (5, Interesting)

pclminion (145572) | more than 10 years ago | (#8196025)

The CS program at Portland State University starts with assembly in their introductory classes. At the time I was there, it was x86 assembly, but I've heard that some professors are using Sparc assembly as well -- not a good idea in my opinion, simply because of 1) the delay slot and 2) the sethi instruction, both of which are a little confusing for someone who's never coded before, let alone never coded in assembly language.

I think it's a little weird to call this "Learning Computer Science via Assembly Language." It's programming, not computer science. Computer science is really only marginally about computers. It has to do more with algorithms, logic, and mathematics.

You can study computer science, and produce new knowledge in the field, without ever touching a computer.

This misunderstanding is, I think, part of the reason so many students drop out of CompSci. They head into it thinking it's about programming, and are startled to find that computation and programming are not equivalent.

That's why the Compilers course at PSU is considered the "filter" which kills all the students who aren't really interested in computer science. They really need to spin off a seperate "Software engineering" school for these students, since what they really want to study is programming.

So if I read that (0)

Anonymous Coward | more than 10 years ago | (#8196027)

can I pass my MCSE?

Teach architecture, not assembly (2, Insightful)

wan-fu (746576) | more than 10 years ago | (#8196034)

It's pointless to teach assembly as a method of creating "star programmers" -- all you'd do is teach people how to write a for-loop but in ten lines instead of three (in a higher level language). The real benefit that people get from being good assembly programmers is understanding the inherent problems/benefits of a certain processor architecture and that's what lets them generate good, optimized code for the platform they are engineering for. Teaching assembly may provide some insight into that but all it really does is teach a new language. Teaching the architecture would give the student real appreciation of what's going on and how to build efficient code. Because think about it: assembly only describes what the architecture is capable of doing.

Disclosure: The submitter is the Author. (4, Informative)

Wise Dragon (71071) | more than 10 years ago | (#8196041)

I think the article should have disclosed that the submitter (johnnyb) is also the author of the book, Jonathan Bartlett. So rather than saying "A new book was just released", I would rather see something like "I wrote this new book." Here is johnnyb's website. http://www.eskimo.com/~johnnyb/

Buffer Overflow (1)

Supp0rtLinux (594509) | more than 10 years ago | (#8196042)

I've always wanted to know how a buffer actually works in terms of memory, etc. I just bought a copy. Perhaps I'll graduate to being a real hacker after all...

Most do require... (0)

Anonymous Coward | more than 10 years ago | (#8196046)

Most accredited institutions do require atleast two or more semesters being exposed to assembly. I personally learned it at my univeristy (Univ. of Nebraska-Lincoln) during my second semester of college. First semester was basic Java, drawing pretty colored circles, string manipulation, console args, etc. Then moving to basic computer hardware/software interaction with a emphasis on MIPS assembly.
I couldn't see how one could earn a degree at all without knowing assembly. How do you expect to grasp fully the ins and outs of computer programming in a high-level language without first knowing how all those ints, char and arrays are stored in memory and arithmetic moves around those values stored from processor to coprocessor, ALU, etc.

real men (0)

Anonymous Coward | more than 10 years ago | (#8196047)

Real men type in opcodes on a hex keypad. These assemblers kids use these days - pfah!

A nice exercise... (1)

DrCode (95839) | more than 10 years ago | (#8196054)

An interesting thing for programming newbies to do is to write a small piece of code in C or C++, then study the assembly output.

Great concept. (4, Insightful)

shaitand (626655) | more than 10 years ago | (#8196060)

I started out learning to code in asm on my c64 and I'd have to say it was a very rewarding experience.

Anyone who disagrees with this probably doesn't have much experience coding in assembler to begin with. Asm really is fairly easy, the trick is that most who teach asm actually spend too much time on those computer concepts and not enough time on actual real coding. It's wonderful understanding how the machine works, and necessary to write good assembler but you should start with the 2 pages of understanding that is needed to "get" asm at all.

Then teach language basics and THEN teach about the machine using actual programs (text editor, other simple things) and explaining the reason they are coded the way they are in small chunks. Instead of handing a chart of bios calls and a tutorial on basic assembler, introduce bios calls in actual function in a program, most of them are simple enough that when shown in use they are quite clear and anyone can understand.

After all assembler, pretty much any assembler, is composed of VERY simple pieces, it's understanding how those pieces can be fit together to form a simple construct and how those simple constructs form together to create a simple function and how those simple functions form together to create a simple yet powerful program that teaches someone programming. Learning to program this way keeps things easy, but still yields a wealth of knowledge about the system.

It also means that when you write code for the rest of your life you'll have an understanding of what this and that form of loop do in C (insert language here) and why this one is going to be faster since simply looking at the C (insert language here) concepts doesn't show any benefit to one over the other.

Bah (1)

be-fan (61476) | more than 10 years ago | (#8196069)

A computer scientist doesn't necessarily know anything about computers. Computer science is about the theories of computation, not about the details of programming.

Now, there is a certain benefit to knowing how the computer works at a low level, but its becoming less and less important. Especially considering that x86 assembly is completely different from how the CPU actually works at the lowest levels! I'd be much happier with a programmer who had a good grasp of the abstract theories of computation and didn't understand hardware at a low level, than one whose knowledge was the other way around.

Believe it! (1)

mgrennan (2067) | more than 10 years ago | (#8196070)

I'm one of those "Wizards". My first computer was a 4004. All I had was assembler. Today my resume reads "And me the right chips and I'll hand you back a general ledger."

After owning my own computer company several years creating ZDOS (an OS) for Micronics Systems. I went to work for someone else and I was shocked to learn how little the programmers know about the systems they wrote for.

I think besides learning assembler real programmers should design, or at least interface, a little hardware.

im taking asm right now... (1)

drwhite (456200) | more than 10 years ago | (#8196072)

I am taking an intro course on asm and I am confused as hell...I started out w/ c++, then cobol(shudder) and now assembley...the book we r using is horrible plus we are using assembley on windowz...

Grounding in the basics (1)

Ra5pu7in (603513) | more than 10 years ago | (#8196073)

What's so amazing and revolutionary about this? Of course those cheap "get a degree in computer science" curriculums teach only specific languages at the expense of putting out truly capable programmers. But many regular colleges and universities have had more complete studies including assembly language all along.

The only real positive I can see in this - a lessened dependence on the OS and pre-developed libraries to do all the work for them.

Assembly language is still relevant today (1)

mpthompson (457482) | more than 10 years ago | (#8196074)

I learned 6809 assembly language on a TRS-80 Color Computer as a kid back around 1978 and I feel that an early start in understanding CPUs from the ground up has given me a leg up on many of my peers over the years. 25 years later I can still tell the difference between programmers who have a basic understanding of how assembly language relates to CPUs and higher level languages and those who don't. It may not make much of a difference when writing Perl scripts or Java apps, but it makes a world of difference in being able to write robust and efficient C code.

self published, no review? Do not buy this book!! (0)

Anonymous Coward | more than 10 years ago | (#8196076)

There is no review here of an unread unreviewed book. This whole article is a sham. Do not buy this book. This book is the submitter's self published ego project!! Warning!!

Assembly has got nothing to do with cs (1)

Erik Hensema (12898) | more than 10 years ago | (#8196078)

Assembly programming is almost hardware programming. If you want to learn about programming real computer programs, you'll have to learn about algorithms. And algorithms are best implemented in higher level languages. Assembly is only used when all other options fail.

Back in my day... (1)

Colonel Cholling (715787) | more than 10 years ago | (#8196079)

I can hear my dad now: "We didn't have these fancy-schmancy high-level programming languages... sure, there was FORTRAN, but that was just for the wimps who couldn't handle real programming. When I was your age I wrote assembly programs on punched cards, and it took three days just to feed "Hello, World" into the card reader. I had to push an IBM 360 uphill to and from work everyday in a snowstorm. Kids these days with their VisualBASIC and their HTML, they don't know what real programming was."

I'm glad to see this. Today's web-server script kiddies won't have anything to be curmudgeonly about unless they learn to go under the hood.
Load More Comments
Slashdot Account

Need an Account?

Forgot your password?

Don't worry, we never post anything without your permission.

Submission Text Formatting Tips

We support a small subset of HTML, namely these tags:

  • b
  • i
  • p
  • br
  • a
  • ol
  • ul
  • li
  • dl
  • dt
  • dd
  • em
  • strong
  • tt
  • blockquote
  • div
  • quote
  • ecode

"ecode" can be used for code snippets, for example:

<ecode>    while(1) { do_something(); } </ecode>
Sign up for Slashdot Newsletters
Create a Slashdot Account

Loading...