The Windows weakness !
Now don’t think I don’t like Windows 8 from the title of this article. I just think that one of the key issues Windows faces right now, may be the product of this weakness.
Everything is going mobile and for mobile battery life is everything. The question of whether to use ARM over Intel all comes down to battery life. Now Intel CPU’s seem to not look so good because power usage, but maybe the real problem is with Windows and how software is developed. What do I mean ?
Because I started programming in the days of DOS (even before that), 640 KB memory and no hard drives, using the resources of a computer efficiently were a high priority. Compiled code had to be small. Compilers had to be fast and produce small executables. Apps had to use memory careful, even disk space carefully. The new generation of programmers have grown up on computers with huge amounts of memory and diskspace. They grew up on processors which had their speeds defined in gigahertz, rather than megahertz. They have been spoiled.
To add to this, somehow object oriented programming design, rather than simply providing one more tool for programmers has somehow become the core model for programming, as if anything else is the product of ignorance. I hate to burst the OOP bubble, but it has not produced the benefits everyone thought it would and I believe it may be at the core of the Windows problem. One has to appreciate how human readable code is converted to machine language to appreciate this. If you mention to programmers that OOP requires a few extra “hoops” to jump through to accomplish a task (aka. pointer to a pointer to a pointer), their first reaction is “big deal”. Computers are so fast that it makes little difference. It is that mindset which actually makes programmers fail to appreciate the value of performance.
The problem is, that this may be true for a single line of code, but when you multiple this by millions upon millions then it adds up to a lot of waste. Also the nature of object design does not lend itself to minimal machine code generation. Objects are so complex at times that they can actually lose efficiency.
You may say this it does not matter anymore, but I think it does. Herb Sutter in his talk “Why C++ ?” discussed how both in mobile and in large data centers (which service all this mobile stuff), performance once again has become critical. I will go one further, even C++ because it leans towards OOP more than C, may slow things down because the more you depend upon OOP, the slower things can become.
I had an interesting experience. I was talking to a friend, who I learned used to work in the software industry years back. He asked me what programming language I use and I said Powerbasic. He was surprised when I said I don’t even use OOP at all. I was describing what I was able to do with PowerBasic and the GUI engine I built using it (EZGUI is non-OOP based and relies totally on the WIN32 APIs). As usual I noted how fast my code ran and how small it was (both vital to performance), because of how it was created and because of using PowerBasic.
I started to tell him about all the features in this library. Just think, EZGUI is actually a GUI framework of sorts (a middleman between your app and the WIN32) and it contains the following:
- GUI engine for forms and controls (all the standard WIN32 controls and most of the common controls) and support for most often used features
- Common dialogs, even being able to customize them
- thread engine
- subclassing engine
- superclassing engine
- ownerdraw engine
- customdraw engine
- graphics engine (GDI and proprietary)
- 2D sprite engine
- 3D OpenGL engine
- multimonitor support
- theme support
- drag and drop engine (ie. build your own visual designer)
it also has a number of custom controls built in, which go beyond the ones provided by Windows such as:
- masked edit control
- shape/hot spot/splitterbar control
- drag handle control
- turtle graphic (vector graphics) control with built in turtle graphics macro language
- canvas control with built in proprietary 2D Sprite engine
- opengl canvas control with built in proprietary 3D OpenGL scripting language
- files listbox control
- property listbox control
There are a number of important features not provided by Windows which I had to design myself, such as the Sprite engine, 3D engine, the autosize engine (autosize controls when form is resized) and layer engine (show and display controls on separate layers. Now of course EZGUI does not do everything, but it does a lot and if you need to extend it you can easily integrate pure API code calls to compliment it.
When I gave an overview of what EZGUI does to this friend I posed the question of how big do you think it is ? I told him the main runtime (which has 90% or more of the functionality) is only about 700 KB in size. His response ? (paraphrased)
“You mean 7 megabytes, right” ?
I said, “no, I mean 700 Kilobytes. The total of all the runtimes (DLLs) together come to about 1 megabyte”.
His response was “that’s impossible”!
Just think, when describing all the features first, this friend who was more familiar with OOP than procedural style coding, could not believe that my library could do all it does and be only 1 megabyte in size.
To add to this, years back I was beta testing a product called MediaForge, which was an amazing multimedia development tool and I communicated a lot with its sole developer, Rob Adamson. Rob was a really, really good C programmer and knew his stuff. MediaForge could be extended using plugins written as DLLs, so I wrote my original Turtle Graphics engine as a plugin for MediaForge. It was just an experiment to see if I could do it and how well Powerbasic would do in creating such a plugin. It worked quite. The thing that struck me was that Rob was impressed with the size of the DLL’s I could produce with PowerBasic. It was on par with what he was doing with C.
The problem with Windows today, I believe, is how we write software. Software is bloated and slow, so no wonder the hardware has a tough time keeping up with it. The software is what makes the hardware look bad and this does not appear to be limited to Windows, but even IOS and Android (everybody uses OOP today). According to Herb Sutters talk, he commented how all these platforms have had problems dealing with performance. Why do you think all the mobile devices today are going the route of mult-core CPU’s ? Even dual core is not enough anymore, but now quad cores are becoming the norm. I see a mindset of “well the software is not fast enough, so let’s just add a couple more cores to the CPU and all will be fine”. So what about the software ?
Also look at the problems created by over eager hardware designs of computing devices. Everybody touts “retina” displays and PPI. The 3rd/4th generation IPads quadruples the pixels on the screen and everybody is excited. As a programmer who has been around awhile my first reaction is “the hardware has to do four times as much work now”. If software was slow before, it will be even worse now. Everybody touted the 4th generation IPad with its new more powerful CPU. “Wow”, they added so much more power. Has anyone ever considered that maybe they had to ? When they switched to the retina display, the CPU had to work a lot harder than before. Maybe Apple realized they need to spice up the IPad CPU even more to better compensate. The real question is, “is the performance today any better than in the previous years, overall” ?
Maybe we need to go back to basics and learn how to write better software. Software needs to be more efficient. Performance needs to be a high priority.
I also feel that programming has been made too complex. In the old days, many turned a hobby into a trade by learning programming on their own. Languages like BASIC introduced many to programming. I really don’t feel that many who moved on from BASIC to C eventually, did this because they did not like the language. I feel they likely felt they needed more power and the only languages touted as high performance were things like C. C does not have a natural syntax to it, like BASIC does. C is harder to learn. Even VB.NET has destroyed the BASIC language syntax by moving closer to its C# cousin. OOP has taken over languages to the point where they are not naturally any more, but more complex.
What we need today is programming languages with a more natural, easy to understand syntax (like Basic). We need programming languages which compile lightning fast and produce tiny executables. We need to get away from the overuse of OOP (OOP adds too much overhead and complexity). We need to produce simpler, less complex API’s for programmers to access. API’s need to be built in multiple levels, starting from low level to medium level and then to high level, building on each previous level. Modular design is not limited to OOP, but has to do with the layout and levels one builds into an API (or Library). IMO, Procedural based libraries can be written in such a way that we could likely double the performance of many of our computers todays by just writing software better.
Would you like to see what a programmer is really made of ?
If the average programmer using say “dot.net” likely has a computer with at least a Core i7 CPU, 8 gigs of memory and terrabytes of disk space, then why not make him (or her) , for a couple weeks, be forced to use a computer with an Atom CPU, 1 gig of memory and a 32 gig SSD ? Now see how quickly they start crying out “it’s all too slow, what do I do now” ?
Now many will say, “that is not realistic and it can’t be done”.
I say to you, yes it can. While I just recently switched to a better PC (Pentium D 3.2 ghz CPU and 2 gig memory) because my long time trusty XP PC experienced system crashes multiple times and I had to move to something more reliable, for the previous 6 years or more I have been developing all my Windows software on a Windows XP computer, with a 2.5 ghz Celeron CPU with only 768 megabytes of memory. Celeron CPUs have the same reputation as Atom and have not been known for power. The current Atom CPUs are more powerful today than my XP computers Celeron CPU. The Atom dual cores are extremely powerful compared to the desktops found in the early 2000’s (when XP was released).
How many programmers today would be willing to use a PC with an Atom CPU as their primary development computer ?
I have no problem with such a computer. I can easily compile 60,000 lines of code in just a few seconds using PowerBasic on such a computer.
My entire development system (PowerBasic compiler and EZGUI 5.0 Pro) only take about 20 megabytes of disk space and will run fine on about any PC made in the last 15 years. Visual Studio weighs in at 2 gigabytes or more of disk space. That means I am developing software with a set of tools that take up 1/100th the space of Visual Studio. I even designed EZGUI so one could even hand code their apps (like we used too) if they didn’t like working in a Visual Design environment.
I do like some aspects of Windows 8, even Metro (even though I prefer the desktop), but maybe we need a real programming renaissance today. The power of native coding using native API’s using better compilers could produce some amazing results. If less hardware is required to run the software, cheaper laptops and tablets could be manufactured, since the software would require less.