Page 1 of 1

Why do they say it takes years to make a GUI?

Posted: Tue Jan 10, 2017 9:24 am
by andrewthompson555
Hello.

Why do people say that it will take years to create your own GUI? It sounds quite stupid to be honest. It will only take a few months if you know what to do with programming and if you type fast.

Voice control will take years. You can make a simple GUI in a few weeks by changing background and foreground colors (colours), adding a few buttons and things.

Re: Why do they say it takes years to make a GUI?

Posted: Tue Jan 10, 2017 9:26 am
by BrightLight
I made a window manager in a week and a widget library in three days. It doesn't take long if you design it well and know what you're doing.

Re: Why do they say it takes years to make a GUI?

Posted: Tue Jan 10, 2017 5:57 pm
by bzt
andrewthompson555 wrote:Why do people say that it will take years to create your own GUI?
Because you'll need a lot of things before you can even think about writing a GUI.

First: you need a working bootloader, a kernel, device drivers for keyboard and mouse. That implies enabling IRQs, issuing EOIs, IDT etc. Most people can't finish with this in months, not in weeks. Once you got all of that, you're still lightyears away. How would you implement that GUI? Trivial solutions tend to be the wrong:

Simplest: GUI in kernel with minimal look out. Attempting, but very in-efficient. Your applications would "freeze" as you move windows by, just like in XP. No icons, or just statically linked pixel maps. As all of your drawing done in supervisor mode one simple bug in line drawing routine would crash your whole system. You'll gonna need working system calls so that applications can say "open a window for me please".

Bit more advanced: Loading resources (like icons and fonts) from file. You'll need a working filesystem for that. A big dependency. Separated memory for each window instead of drawing directly to the frame buffer. That implies a way of coping big amounts of memory quickly (effective blitting). You'll have to take overlapping windows account, calculate intersections, etc. so you need a window manager or compositor.

Move along, be safe: moving all the libraries to userspace. You'll have to have multitasking (either cooperative or preemptive) for that. Another big dependency. You should separate window decorator. Most likely at this point you'll realize that you gonna need to redesign / refactor almost all of your related GUI code, and start it over.

And the proper way: you'll need double or triple buffering to avoid epilepsy seizures of the users, a shared function library, image handling libraries (like decompressing png into a pixel map), a client-server architecture (like in X11 or in Wayland), themes, etc. etc. etc. Writing applications like panel, dock, dekstop, application launcher etc. things that are not part of your GUI library per se, but users expects a graphical interface to have them.

That's hell a lot of work even for a copy-n-paste samurai!

Re: Why do they say it takes years to make a GUI?

Posted: Wed Jan 11, 2017 2:19 pm
by Brendan
Hi,
bzt wrote:
andrewthompson555 wrote:Why do people say that it will take years to create your own GUI?
Because you'll need a lot of things before you can even think about writing a GUI.

First: you need a working bootloader, a kernel, device drivers for keyboard and mouse. That implies enabling IRQs, issuing EOIs, IDT etc. Most people can't finish with this in months, not in weeks. Once you got all of that, you're still lightyears away. How would you implement that GUI? Trivial solutions tend to be the wrong:

Simplest: GUI in kernel with minimal look out. Attempting, but very in-efficient. Your applications would "freeze" as you move windows by, just like in XP. No icons, or just statically linked pixel maps. As all of your drawing done in supervisor mode one simple bug in line drawing routine would crash your whole system. You'll gonna need working system calls so that applications can say "open a window for me please".

Bit more advanced: Loading resources (like icons and fonts) from file. You'll need a working filesystem for that. A big dependency. Separated memory for each window instead of drawing directly to the frame buffer. That implies a way of coping big amounts of memory quickly (effective blitting). You'll have to take overlapping windows account, calculate intersections, etc. so you need a window manager or compositor.

Move along, be safe: moving all the libraries to userspace. You'll have to have multitasking (either cooperative or preemptive) for that. Another big dependency. You should separate window decorator. Most likely at this point you'll realize that you gonna need to redesign / refactor almost all of your related GUI code, and start it over.

And the proper way: you'll need double or triple buffering to avoid epilepsy seizures of the users, a shared function library, image handling libraries (like decompressing png into a pixel map), a client-server architecture (like in X11 or in Wayland), themes, etc. etc. etc. Writing applications like panel, dock, dekstop, application launcher etc. things that are not part of your GUI library per se, but users expects a graphical interface to have them.

That's hell a lot of work even for a copy-n-paste samurai!
Even with all of that; there's things like:
  • An event system for various things (not just user input, but window resize/movement, etc)
  • Font engine (changing font style and/or size in middle of sentence, proportional fonts, etc)
  • Layout engine for "text" (likely with some form of markup), possibly including support for intelligent word wrapping, "right-to left" languages, etc.
  • Lots of icons (one for each app/utility/thing that comes with the OS, one for each file type, etc)
  • Sound effects
  • A help system (including pictures/diagrams/graphics and "click-able hyper-links", and including the fine-grained help for specific things - e.g. where you click on a "?" icon then any button and it'll show you the help for that button)
  • A system for tracking user preferences (at a minimum, global preferences that effect all apps)
  • A whole pile of widgets (list view, tree view, drop down list, checkbox, ....)
  • "Clipboard" system for cut&paste (with standardised representations for things like graphics data, etc - not just text)
  • Various utilities needed to make using the GUI productive (start menu/task bar, file browser, clock app)
  • Various utilities needed to configure the OS (disk manager, network configuration tool, user preferences, etc)
andrewthompson555 wrote:Why do people say that it will take years to create your own GUI? It sounds quite stupid to be honest. It will only take a few months if you know what to do with programming and if you type fast.
There's also a massive difference between "piece of poo slapped together in a rush" and "well designed high-quality software that won't need radical/compatibility breaking changes for decades". It doesn't matter how experienced you are with programming and OS development and GUIs; you can not write* a full GUI in 2 months that isn't a worthless piece of trash. Note: I mean "write" literally here - you might be able to port large pieces (e.g. font engine, etc) to save some time.


Cheers,

Brendan