Page 7 of 13

Re: Advice for novice programmers thread

Posted: Thu Jan 29, 2009 11:15 pm
by Troy Martin
My advice for new OS developers: learn assembly until you're good enough with it to write a small OS in it. I started OS dev with assembly and that's mostly all I develop my OSes with.

Re: Advice for novice programmers thread

Posted: Wed May 13, 2009 5:04 am
by UbarDPS
Troy Martin wrote:My advice for new OS developers: learn assembly until you're good enough with it to write a small OS in it. I started OS dev with assembly and that's mostly all I develop my OSes with.
Times have changed.

People used to write compilers, OSes, and even productivity software in mostly Assembly Language, but HLLs have improved so I would not suggest someone learn mostly Assembly Language.

Plus, it will kill any semblance of portability.

Re: Advice for novice programmers thread

Posted: Wed May 13, 2009 9:15 am
by Troy Martin
Portability isn't a concern though. Assembly language allows you to learn the insides and internals of architectures, specifically the x86 and whatever else you want to develop on.
UbarDPS wrote:Times have changed.
If so, then why do people and groups still write assemblers? Your points are empty, and I see no proof that asm is useless.

Many implementations of SSE and such are in inline assembly. How would you know how to write that if you have no previous asm knowledge? Personally, I never gave up assembly because I find it a lot easier to work with than high-level languages for OS dev.

Oh, and major necro thar.

Re: Advice for novice programmers thread

Posted: Wed May 13, 2009 11:35 am
by Combuster
UbarDPS wrote:People used to write compilers, OSes, and even productivity software in mostly Assembly Language, but HLLs have improved so I would not suggest someone learn mostly Assembly Language.

Plus, it will kill any semblance of portability.
Yet, if nobody were to write assembly, who would make the compilers in the future?

Assembly and basic OS theory is a required part of computer science here, for the primary reason that you should know what is going on, to take the most advantage of that process.

I wouldn't expect people to learn assembly to the extent of writing an OS in it. Being able to do something nasty like heapsort should be sufficient if you plan on using a HLL for OS development anyway.

Re: Advice for novice programmers thread

Posted: Thu May 14, 2009 9:14 am
by UbarDPS
I said "mostly" for a reason, and look at the post I replied to.
My advice for new OS developers: learn assembly until you're good enough with it to write a small OS in it. I started OS dev with assembly and that's mostly all I develop my OSes with.
I simply don't think that is required.

IRT:
If so, then why do people and groups still write assemblers? Your points are empty, and I see no proof that asm is useless.
Firstly, I would like you to quote me where I said Assembler is useless. I simply said nothing that is even indirectly equivalent to that, so I'd like to know how you came to that bastardized conclusion.

People still develop Assemblers because some things are easier to do in Assembler/Inline Assembly than in HLLs. That is why I still use Assembler, and that is also why I used this specific combination of words:
but HLLs have improved so I would not suggest someone learn mostly Assembly Language.
IRT:
Yet, if nobody were to write assembly, who would make the compilers in the future?
Most compilers are self-hosting these days. C/C++ compilers can compile themselves, FreePascal can compile itself, and GNAT can compile itself - those are just a few examples. Lots of compilers have inline assemblers, and they've been self-hosting since the 1980s. You don't need to do compilers in Assembly, even if the compiler emits Assembly that is then assembled to object code by an Assembler (like the Compile-via-Assembly option that many C/C++ and other compilers have).
Assembly and basic OS theory is a required part of computer science here, for the primary reason that you should know what is going on, to take the most advantage of that process.
Correct, and that is why I was careful in the way I wrote the statement above.
I wouldn't expect people to learn assembly to the extent of writing an OS in it
And that is why I replied in the way that I did. The poster I replied to suggested that others learn Assembly to a level of mastery that they can write a Small OS in it.

Unless you are using a High Level Assembler (MASM, TASM), I wouldn't [this is my personal opinion] want to even attempt such a feat with Assembly Language, personally. Many people have done in the past, and that's a testament to their grit, determination, talent, and expertise (and people who use HLLs can be just as talented, and dedicated). Times have change, however.. You don't have to depend on the least common-demoninator for everything.

I am totally in favor of learning at least a level of Assembler that would allow you to understand code and get done what must be done in Assembler, but I do not think learning Assembler to that level of mastery is required or even a boost in productivity.

Re: Advice for novice programmers thread

Posted: Thu May 14, 2009 10:02 am
by Solar
I'm completely with UbarDPS here. Today, assembly is for the places where there's no choice. Virtually everything else is better done in a HLL. Claims for better performance have grown increasingly stale ever since CPUs went superscalar, and today I think the only people capable of beating compiler output with hand-crafted assembler do work for Intel or somesuch, but sure don't hang out on osdev.org...

Re: Advice for novice programmers thread

Posted: Thu May 14, 2009 4:25 pm
by Troy Martin
UbarDPS wrote:Most compilers are self-hosting these days. C/C++ compilers can compile themselves, FreePascal can compile itself, and GNAT can compile itself - those are just a few examples. Lots of compilers have inline assemblers, and they've been self-hosting since the 1980s. You don't need to do compilers in Assembly, even if the compiler emits Assembly that is then assembled to object code by an Assembler (like the Compile-via-Assembly option that many C/C++ and other compilers have).
How do you think they were written before they were written (for self-hostingness)? Probably using another compiler or an assembler. ASM is an important thing.

Bottom line: Assembly is important, HLLs can be used if you either want something done for you or don't want to spend the time writing stuff out the hard way and getting practice for it, and people have different opinions.

/thread

Re: Advice for novice programmers thread

Posted: Thu May 14, 2009 4:28 pm
by Combuster
UbarDPS wrote:
Yet, if nobody were to write assembly, who would make the compilers in the future?
Most compilers are self-hosting these days. C/C++ compilers can compile themselves, FreePascal can compile itself, and GNAT can compile itself - those are just a few examples. Lots of compilers have inline assemblers, and they've been self-hosting since the 1980s. You don't need to do compilers in Assembly, even if the compiler emits Assembly that is then assembled to object code by an Assembler (like the Compile-via-Assembly option that many C/C++ and other compilers have).
That was not quite the point here: If you write a compiler for something, you will need to know the machine language you are dealing with. If you know C, you don't suddenly know all possible assembly languages just because gcc supports them - they got in there from somewhere by someone who knew.

Which is why we always need people that can write assembly: to teach a computer program to do the same.

Edit: Troy Martin beat me to the point (to some extent)

Edit2:
Solar wrote:Claims for better performance have grown increasingly stale ever since CPUs went superscalar
For generating x86 assembly, I would agree. Still good programmers can achieve much larger improvements on other fields, improvements of orders of magnitude larger, even with the current state of the art. And a vast majority of programmers haven't got the hang of that - I'm sure you're not one of them. The keyword here is algorithmic complexity.

<rant>And similarly, I would knee the openoffice devs for generating a 700mb program that does less than a 46mb program by microsoft, that runs on a pentium 1, and includes pinball.</rant>

Now guess what I think is important for a programmer :)

Re: Advice for novice programmers thread

Posted: Thu May 14, 2009 4:41 pm
by Troy Martin
Combuster wrote:
UbarDPS wrote:
Yet, if nobody were to write assembly, who would make the compilers in the future?
Most compilers are self-hosting these days. C/C++ compilers can compile themselves, FreePascal can compile itself, and GNAT can compile itself - those are just a few examples. Lots of compilers have inline assemblers, and they've been self-hosting since the 1980s. You don't need to do compilers in Assembly, even if the compiler emits Assembly that is then assembled to object code by an Assembler (like the Compile-via-Assembly option that many C/C++ and other compilers have).
That was not quite the point here: If you write a compiler for something, you will need to know the machine language you are dealing with. If you know C, you don't suddenly know all possible assembly languages just because gcc supports them - they got in there from somewhere by someone who knew.
And the fact that you could (in theory) just output NASM or GAS syntax assembly and use the respective assembler is a waste of allocated time and potential knowledge not learned. Oh, and it's extremely lazy (and probably worthless) if you're writing a full-featured compiler. And also requires you to (gasp!) write in assembly.

EDIT:
Now guess what I think is important for a programmer
Uh, writing buggy software? :twisted:

Re: Advice for novice programmers thread

Posted: Thu May 14, 2009 5:15 pm
by UbarDPS
Troy Martin wrote:
UbarDPS wrote:Most compilers are self-hosting these days. C/C++ compilers can compile themselves, FreePascal can compile itself, and GNAT can compile itself - those are just a few examples. Lots of compilers have inline assemblers, and they've been self-hosting since the 1980s. You don't need to do compilers in Assembly, even if the compiler emits Assembly that is then assembled to object code by an Assembler (like the Compile-via-Assembly option that many C/C++ and other compilers have).
How do you think they were written before they were written (for self-hostingness)? Probably using another compiler or an assembler. ASM is an important thing.

Bottom line: Assembly is important, HLLs can be used if you either want something done for you or don't want to spend the time writing stuff out the hard way and getting practice for it, and people have different opinions.

/thread
I never said Assembly wasn't important; and, yes, you can write compilers in high level languages (there are hundreds of examples). After the compiler (and [language] implementation) is complete, you simply rewrite it in that language. FreePascal and GNAT have illustrated how this can be done, as have many other compilers (Delphi, for example).

Using Assembly in Compiler Construction is not on the level of being able to write a small OS in Assembly. The Compilers are written primarily in the HLL, and optimized in Assembly. Optimization comes after the initial coding, debuggin, and profiling. Not before. Using Assmebly as a way to pre-optimize algorithms [because you assume yours will outperform a compiler] is not always the smart thing to do. An Assembly Coder cannot always outperform a Compiler. Some compilers have very aggressive (and [largely] correct) optimizers.

It's not about being lazy and wanting things easy, it's about productivity and turnaround - an area where HLLs are vastly superior to Assembly Language (if you take the time to learn them). That is the reason why most non-embedded Operating Systems are written primarily in a HLL, with Assembly where needed. You are always free to profile you code and fine-tune it later, using Assembly where needed.

Read the post I responded to, and put my post into that perspective. The responses are too general, almost to the point of disingenuous...

Read the post, I have not disagreed with any of these sentiments IRT the importance or usefulness of Assembly - I have even stated that I still use it. I don't know where that other poster got the translation where I said Assembly was useless.

I simply disagree that OSDev should require one to have Assembly Language knowledge required to write an Operating System in Assembly Language - and only Assembly Language. Architectural Knowledge != being an Assembly Language Guru. Assembly is just the lowest-common demoninator. Know enough so that you can get done what needs to be done in Assembler, or when it cannot be done [as easily] using a HLL or inline assembler.

I am quite aware that various things like drivers are written in assembly language, often. I know that there is a lot of embedded development done in [almost] 100% Assembly Language; however, I think learning Assembly Language to that level is a waste of time when you could be mastering a HLL that would allow for higher productivity, while using Assembly where required.

Are you going to rewrite all the software you want to port in Assembly because you don't have a firm grasp on C/C++ when your OS is complete? Are you going to write all of you APIs in Assembly (lol and using NASM to boot, must be great)?

I'm thinking ahead. How is this liberal use of Assembly actually help the development cycle down the road? My guess is that it will add unneeded complexity and make code-maintenance more of a nightmare than almost any HLL - that is, after all, one of the reasons so many developers (systems and application developers) have moved away from using Assembly Language as a primary development language... It will also kill portability, and contrary to what the other poster wrote - it does matter.

I don't want to have a circular argument. That post was quite clear.

A good understanding of Assembly is required, but being able to write a small OS in Assembly is not a prerequisite to [serious] OSDev [i.e. for Novices]. Sorry. I am quite aware that Assembly is a bit overrated at these forums (I have been lurking for quite a bit and reading thread back to 2005 or so), so I'll just leave it at that. (You'll free to respond though, I'm not saying that I will cease to acknowledge anything that anyone is saying... Just that I will agree to disagree :P)

Thanks for you time.

LOL @ "/thread"... Seriously... People do have different opinions, but the thread doesn't end after you give yours.

DISCLAIMER: This is my Opinion.

Re: Advice for novice programmers thread

Posted: Thu May 14, 2009 6:40 pm
by Troy Martin
Great foot to start off with at a forum, eh? Getting in to an opinion-based debate on assembly language with a regular and a mod...

Re: Advice for novice programmers thread

Posted: Thu May 14, 2009 8:15 pm
by JackScott
Not sure what you were intending to say there Troy, but on the off-chance that it was that regulars and mods know better, I'd like to disagree. If so, get off your high horse. Being a regular (or a mod) makes you no better than anybody else.

If that wasn't what you were saying, and you were actually appluading UbarDPS for having the guts to defend his opinion, then feel free to ignore me. Also, I'd like to apologise for the accusative paragraph above.

And UbarDPS: Welcome to the forum.

Re: Advice for novice programmers thread

Posted: Thu May 14, 2009 8:36 pm
by Troy Martin
Jack: The intention was to say that I find it awesome that UbarDPS has the stones to both defend his opinion and keep it professional at the brink of flaming (if we had intolerably unfriendly/flaming members in this debate.) I know being a senior member or mod isn't anything special.

Ubar: Welcome to the forums, I don't mean to intentionally offend people if I offended you.

Re: Advice for novice programmers thread

Posted: Thu May 14, 2009 11:59 pm
by JackScott
Well then, please accept my apologies.

Re: Advice for novice programmers thread

Posted: Fri May 15, 2009 8:39 am
by Troy Martin
JackScott wrote:Well then, please accept my apologies.
Accepted :D
Shrek wrote:For all ( bussiness ) practical purposes , programming in assembly language does not help at all , people just want the button to be there and it should show the result resonably qucikly and people are in 'demand' of that button . If it passes the perf test cases , then it's more or less ready to be shipped ( from a perf perspective ) . Nobody really cares whether you have made a brilliant design or not ( or it is very efficent or not ) .. After few years , the entire architecture is scrapped off and redesigned by another (or same) 'brilliant' architect . Welcome to the 'evil' real world .
And evil it is.