Re: Rewrite from Scratch
Posted: Thu Dec 06, 2012 7:53 am
We know, you've stated it in this thread several times.rdos wrote:Personally, I don't want to write the same code twice, which is why I never want to start from scratch.
The Place to Start for Operating System Developers
http://forum.osdev.org./
We know, you've stated it in this thread several times.rdos wrote:Personally, I don't want to write the same code twice, which is why I never want to start from scratch.
Not necessarily. There are at least 3 causes of design change:Love4Boobies wrote:That is self-contradictory. It means your design was bad. This is the very reason for which so many software design books exist.nevar wrote:I think rewriting OS is good practice at least from my point of view. I did it many times but always because of design changes.
I don't see that as a valid reason to start from scratch. I went through the process to convert from "custom" 8-bit fonts to TrueType Unicode only half a year ago. I decided against wide-character codings (because that tends to pollute all character-based code in a system) and decided to use UTF-8 throughout. I even actively disabled wide-character support in OpenWatcom's RDOS libc because I didn't want to have anything to do with wide character sets.Brendan wrote:internal scope creep - e.g. the design was perfectly fine for "foo" which is all we cared about at the time; but now we want to do "bar" and the design needs to change. A simple example of this would be saying "it's only a small hobby OS, therefore I don't want to bother with Unicode and proportional fonts" and then 3 years later thinking "it's grown beyond just a small hobby OS, therefore I actually do want Unicode and proportional fonts".
And I didn't say that that alone was a valid reason to start from scratch. I was replying to Love4Boobies' "design changes mean bad design" comment.rdos wrote:I don't see that as a valid reason to start from scratch.Brendan wrote:internal scope creep - e.g. the design was perfectly fine for "foo" which is all we cared about at the time; but now we want to do "bar" and the design needs to change. A simple example of this would be saying "it's only a small hobby OS, therefore I don't want to bother with Unicode and proportional fonts" and then 3 years later thinking "it's grown beyond just a small hobby OS, therefore I actually do want Unicode and proportional fonts".
Then Love4Boobies is saying that your original (ASCII, 8-bit fonts?) design was bad. Do you agree with him? I'm saying that originally it may have been good design, and "internal scope creep" happened, causing it to need redesigning. For simplicity; I'll just assume you agree with me.rdos wrote:I went through the process to convert from "custom" 8-bit fonts to TrueType Unicode only half a year ago. I decided against wide-character codings (because that tends to pollute all character-based code in a system) and decided to use UTF-8 throughout. I even actively disabled wide-character support in OpenWatcom's RDOS libc because I didn't want to have anything to do with wide character sets.
I don't see how the fact that everyone makes mistakes is an argument for the fact that requiring a rewrite is not a sign of a good design.Brendan wrote:
- bad initial design - e.g. the design wasn't very good for "foo" to begin with. Everyone makes bad design decisions sooner or later (the only people who haven't made bad design decisions are people that haven't made design decisions).
A good design would have to be flexible enough to allow for the requirements to change over time.Brendan wrote:
- internal scope creep - e.g. the design was perfectly fine for "foo" which is all we cared about at the time; but now we want to do "bar" and the design needs to change. A simple example of this would be saying "it's only a small hobby OS, therefore I don't want to bother with Unicode and proportional fonts" and then 3 years later thinking "it's grown beyond just a small hobby OS, therefore I actually do want Unicode and proportional fonts".
- external scope creep - e.g. the design was perfectly fine for "foo" which is all we could have known about at the time; but now someone else has introduced "bar" and the design needs to change. At the moment there's probably a lot of people looking at their "it was reasonable to assume PC BIOS at the time" boot code.
Using such a font is not a sign of bad design. Inability to switch to vector fonts because of the design on the other hand...Brendan wrote:Then Love4Boobies is saying that your original (ASCII, 8-bit fonts?) design was bad. Do you agree with him? I'm saying that originally it may have been good design, and "internal scope creep" happened, causing it to need redesigning. For simplicity; I'll just assume you agree with me.
You are starting from the assumption that their designs were good when they actually weren't. They may have seemed good at the time; that's another story.Brendan wrote:Where we don't agree is that I think these smaller design changes can become a larger collection that does justify a rewrite; while you think that (for an example) it would've made more sense for Microsoft to keep polishing "MS-DOS" until it becomes something like Windows 8 without starting again (twice).
MS-DOS is the worse piece of junk ever launched, so I don't think Microsoft should have polished on it. They should have released a multitasking system to start with, not such a piece of junk as they did. MS-DOS was the primary reason why I went into OS development. My initial design goal was to write an OS that was compatible with MS-DOS, with multithreading and multiprocess support (the "r" in RDOS stands for "realtime DOS"). Because it was already in the late 80s evident that running programs in the limited real mode environment was a dead-end approach, I designed the new OS for running in 32-bit protected mode, and running DOS applications in V86 mode. Because I planned to run multiple DOS programs at the same time, it was an requirement to use paging. Segmentation was used because it was such an elegant solution for within and between modules isolation, enforced by hardware.Brendan wrote: Where we don't agree is that I think these smaller design changes can become a larger collection that does justify a rewrite; while you think that (for an example) it would've made more sense for Microsoft to keep polishing "MS-DOS" until it becomes something like Windows 8 without starting again (twice).
Using raster fonts at the time this was implemented was considered an acceptable design. I'm not even sure if TrueType fonts were available at that time, but at least there were no free code to use.Love4Boobies wrote:I don't see how the fact that everyone makes mistakes is an argument for the fact that requiring a rewrite is not a sign of a good design.Brendan wrote:
- bad initial design - e.g. the design wasn't very good for "foo" to begin with. Everyone makes bad design decisions sooner or later (the only people who haven't made bad design decisions are people that haven't made design decisions).
Exactly. I had no big problems changing from GFT-based raster fonts to OpenType fonts. I simply rewrote the font device-driver from scratch in C, and integrated it into the available framework.Love4Boobies wrote:A good design would have to be flexible enough to allow for the requirements to change over time.Brendan wrote:
- internal scope creep - e.g. the design was perfectly fine for "foo" which is all we cared about at the time; but now we want to do "bar" and the design needs to change. A simple example of this would be saying "it's only a small hobby OS, therefore I don't want to bother with Unicode and proportional fonts" and then 3 years later thinking "it's grown beyond just a small hobby OS, therefore I actually do want Unicode and proportional fonts".
- external scope creep - e.g. the design was perfectly fine for "foo" which is all we could have known about at the time; but now someone else has introduced "bar" and the design needs to change. At the moment there's probably a lot of people looking at their "it was reasonable to assume PC BIOS at the time" boot code.
But there were a multitasking system back then called CP/M (look here: http://en.wikipedia.org/wiki/CP/M). CP/M was a decent operating system, but for some reason IBM let Bill Gates do his hack and used that instead. If IBM had used CP/M instead, the PC market would be very different from how it is now, and it wouldn't have taken two major rewrites by Microsoft until there was decent multitasking on PCs.Love4Boobies wrote:@rdos: Saying that MS-DOS was the biggest piece of junk is going overboard. Back then, computers were quite slow, expensive, had rudimentary graphics hardware, and there was no protected mode. There was also limited use for them, Microsoft didn't have many resources, etc. An OS like the one you descrined could not have existed for the PC back then.
Imagine someone who's never designed or implemented an OS before. Is it sane to expect them to design and implement something perfect on their first attempt?Love4Boobies wrote:I don't see how the fact that everyone makes mistakes is an argument for the fact that requiring a rewrite is not a sign of a good design.Brendan wrote:
- bad initial design - e.g. the design wasn't very good for "foo" to begin with. Everyone makes bad design decisions sooner or later (the only people who haven't made bad design decisions are people that haven't made design decisions).
Sounds like a nice theory. Can you think of anything that has actually achieved this in practice? If both Microsoft and Apple can't do it, should we expect random hobbyists to be able to?Love4Boobies wrote:A good design would have to be flexible enough to allow for the requirements to change over time.Brendan wrote:
- internal scope creep - e.g. the design was perfectly fine for "foo" which is all we cared about at the time; but now we want to do "bar" and the design needs to change. A simple example of this would be saying "it's only a small hobby OS, therefore I don't want to bother with Unicode and proportional fonts" and then 3 years later thinking "it's grown beyond just a small hobby OS, therefore I actually do want Unicode and proportional fonts".
- external scope creep - e.g. the design was perfectly fine for "foo" which is all we could have known about at the time; but now someone else has introduced "bar" and the design needs to change. At the moment there's probably a lot of people looking at their "it was reasonable to assume PC BIOS at the time" boot code.
They were (relatively) good designs at the time they were designed. For example, in the time before MS-DOS was released (before 80286 existed), it would've been unreasonable to expect Microsoft to develop a full multi-tasking OS with GUI, etc. For their next rewrite, Windows 9x was (given the need to support old DOS software that expected full control and no protection) also relatively good.Love4Boobies wrote:You are starting from the assumption that their designs were good when they actually weren't. They may have seemed good at the time; that's another story.Brendan wrote:Where we don't agree is that I think these smaller design changes can become a larger collection that does justify a rewrite; while you think that (for an example) it would've made more sense for Microsoft to keep polishing "MS-DOS" until it becomes something like Windows 8 without starting again (twice).
Rewrites are good practice, when they're justified. Wasting years polishing a turd just because you're not smart enough to recognise the magnitude of design changes and/or because you lack the courage necessary to do what needs to be done, and then ending up with a unmaintainable pile of scar tissue is not good practice.Love4Boobies wrote:Also, notice that my main problem with that post was that the poster was advocating rewrites as a good practice.
The first version of MS-DOS was released in 1981. If it took 1 year to implement then it would've been designed in 1980. Back then (before Microsoft became historically important) they would've been lucky to hear vague rumours about the 80286 (which wouldn't have been released until 1982).rdos wrote:And while the 386 processor didn't exist initially when MS-DOS was written, it was on the market 1988 when I started my project. And I bet the 386 processor was at least at the early design-stages when MS-DOS was written.
rdos wrote:But there were a multitasking system back then called CP/M (look here: http://en.wikipedia.org/wiki/CP/M). CP/M was a decent operating system, but for some reason IBM let Bill Gates do his hack and used that instead.Love4Boobies wrote:@rdos: Saying that MS-DOS was the biggest piece of junk is going overboard. Back then, computers were quite slow, expensive, had rudimentary graphics hardware, and there was no protected mode. There was also limited use for them, Microsoft didn't have many resources, etc. An OS like the one you descrined could not have existed for the PC back then.
The original version of CP/M was single-user. I also doubt that the multiuser variants of it *were* in fact decent multitasking systems (at least, not without hardware the IBM PC didn't have), because the 8086 had no means of enforcing protection: Any process could have taken over the system.If IBM had used CP/M instead, the PC market would be very different from how it is now, and it wouldn't have taken two major rewrites by Microsoft until there was decent multitasking on PCs.