3 ms·
I beg to differ. Going to lower level code usually results in much simpler codebase for things like implementing coroutines, threaded code etc. Take z-machine
by terminalcommand 5y ago
I beg to differ. Going to lower level code usually results in much simpler codebase for things like implementing coroutines, threaded code etc.
Take z-machine for example. It was apprarantly so much easier to code a z-machine interpreter in Assembly for each architecture and run bytecode on it.
Who says assembly doesn't have code reusability. You can easily translate between architectures if you stay away from instruction set specific tricks. For me, assembly is a universal abstraction for how my computer works. I know it's not accurate, lots of magic happens on microcode and OS level, but still it's so much cleaner.
Going to higher level languages has many advantages, and I would definitely prefer to write any complex project (for example a web browser) with the help of higher level languages.
However learning and programming in Assembly broadened my horizon in a lot of ways.
Comparing C++ to Assembly in terms of complexity is not fair. C++ is "complex", it requires loads of tooling to compile, a special runtime etc.
Assembly is super simple at its core. Especially if you can free yourself from structured code ideology. C and C++ force you into programming a certain way, you don't use jumps, you can't manipulate the stack however you want etc. Once I leave all that and start playing with real spaghetti code :) with jumps all over the place, programming gets much more fun for me.
The cost of maintaining assembly code doesn't have to be high. You can write special subroutines you need in Assembly and keep the code short, simple and useful. I think it's a misperception that assembly is hard to maintain. I think people think that because lots of developers are afraid to even touch C code, let alone Assembly.
TL;DR Assembly is fun, leave everything you think you know about programming and jump in :).
- pjc50 5y ago> Especially if you can free yourself from structured code ideology. .. how well does this work in a team? There are a number of people who do individual heroics in assembly, but I'm not aware of any large long term maintained such projects that have outlived their originator.
- minipci1321 5y agoMaintaining projects in assembler requires much less heroics than developing them. Significant part of Soviet computer program, shortly before (Minsk 32), and after they switched to cloning IBM mainframes (ES EVM), was maintained in assembler only, once they lost access to the original PL/S source code of the OS and other system products. These were teams of many people and the activity lasted long enough time to fit your criterium. They certainly outlived the originators by several dozen years. Maintenance involved fixing bugs (including in the OS kernel), localizing software to a different language (sounds inoffensive ... when you have source code. Much more nasty when translated sentence doesn't fit into its allocated place in the binary). And adapting to hardware difference, such as less RAM, less capable peripherals and slower CPUs. EDIT: Minsk 32 was bespoke development but the language still was close enough to hardware to be qualified as assembly by today's standards.
- terminalcommand 5y agoThanks for this anectode! Soviet CS history is very interesting. There were some novel ideas. I was fascinated by DRAKON when I first learned about it. The Wikipedia article said that it was used by other professions as well. For example doctors had flowcharts in DRACON for medical procedures etc. I'll be glad (and think that the whole community will be glad) if you decide you want to share more historical anectodes about the Soviet computer program.
- hootbootscoot 5y agowhy is this message grayed-out?
- the_af 5y ago> Especially if you can free yourself from structured code ideology What is "structured code ideology"?
- terminalcommand 5y agoLike every other programming paradigm, structured programming is also a paradigm. The only difference is that it is so engrained in us that we don't see it. Like each programming paradigm it is an ideology for me. Why is it acceptable to refuse OOP and not code using objects and not refusing for loops, if statements etc.? It is because we are taught to program and think like that. I am not saying this is wrong, but there is so much more to programming if one can break free from structured programming paradigm. All the loops, variable declarations, scoping, if statements, switch statements etc. are inventions just like constructs of object oriented or [insert programming paradigm here] programming. CPUs don't have these constructs. These are abstractions and limitations to make life easier. But there is much more to programming if you take a step deeper.
- rramadass 5y agoThis is an illuminating viewpoint. I came to Assembly from HLLs and had often wondered why i found writing assembly code so alien and difficult (in spite of understanding Computer Architecture). I was restricting myself by looking at it only through the lens of Structured Programming constructs. Only by going beyond these concepts and embracing the full generality of Assembly can one understand many techniques like Threaded Code/Self-modifying code etc.
- rramadass 5y agoGreat comment and quite insightful !