Sunday, 26 of May of 2013

Tag » programming

Programming has become too complex and has lost its way.

Having been coding for a couple decades now, I find programming is getting more and more complex and it makes me wonder if software development is actually getting better or is it getting worse ?

In all my years of programming I have stuck to the old adage of “keep it simple”. When you break software down, it really is quite simple. The software simply needs to do a task. Some tasks are simple, while others are complex. But no matter, software is task oriented. That is how I have always written my software, simply as a solution to a task or multiple tasks. I have written a number of applications in the past for a variety of businesses and rarely did I ever have to write a manual for how the software was to be run. If it was not simple enough for me to explain in a few minutes, then it was not simple enough.

Now building programming tools is much more complex (requires a lot of documentation too) so it can’t be compared to end user software in the same way, but still even programming tools need to be simply in nature. There is a trap though when creating programming tools. Simple does not mean you don’t have to think. I am a coder and I design my tools for coders. You have to think a bit to be a decent coder. But being required to think a bit does not mean that things can be simple and easy. The key to simplicity is to free software development from meaningless complex terminology and to provide libraries which are based on simple concepts.

To that end I prefer a purely procedural style of coding and libraries need to provide low level, medium level and high level functionality. If the high level features don’t do it for you, then you should be able to fall back to medium level functions (requires a bit more code of course) and if that does not suffice you should be able to fall back on low level functions (requires even more code). This is why EZGUI has so many different levels in its command set.

New users of my programming tools at times may think it is too complex and may give up quickly. As I have stated to many a customer, EZGUI Professional has an initial learning curve. It takes time to understand how things work. Well, if EZGUI is so easy, then why can’t some grasp it immediately ? There are a number of reasons, some of which I will touch on here. First, EZGUI is task oriented. It was designed to handle a nearly endless variety of tasks. This is no small feat.  In its development I considered the many possibilities programmers may face and built in features to cover a variety of possiblities.  In doing this though, I did not have the goal of making the transition to EZGUI as simple as possible, for example by emulating other development tools, just so new users would be immediately comfortable. For example I could have tried to emulate Visual Basic, so the design experience was so simple that anyone could do it, but I knew that is an easy trap to get into. What do I mean ?

The “easy” in programming is not simply having a visual design environment which allows a non-programmer to draw an application, but it is a development environment which allows a programmer to more easily convert tasks into workable code.  Programming is a skill, a craft if you will. By its nature it is not inherently easy. In the same way that carpentry appears easy when you look at the basics of what is involved (cut a piece of wood, nail it to another piece of wood and so on), but the real art is the ability to use simple steps to accomplish a complex task (build the entire house). Programming is similar.

This is why in the development of my programming tools, I concentrate not on the initial experience, but on the simplicity of the tools to be skillfully used to build complex software. So what is so hard about building software ?

Much of it comes down to the ability to combine thousands of small parts to build something large and complex. This is why coding style and coding logic play a big part in creating quality software. For example, in the same way that a well designed automobile must also take into consideration how easy it is to repair it and maintain it, so too with software, the ability to maintain the software and to debug it is vital to its success. This is why I personally find that using a more modular design when writing software is very helpful. I like to view writing software like using building blocks. The easier it is to add or replace a block, the easier it is to fix or improve something. The same is true with software. The more modular the design, the simpler the code is to understand and read and the easier it is to follow the flow of the code, the better your software will be.

This is why I use Basic rather than C or C++ ! Basic is a more natural language (if used correctly). This makes code more readable. This is also the mindset to why I designed the EZGUI runtime command the way I did. The command set, while powerful, was designed for simplicity. Most sub/function calls in the library are very easy to understand the meaning of the parameters. While the nature of Windows does not allow me to make every aspect of programming so simple that even a novice can grasp it, I did try to design the library to be task oriented and to break down tasks into the simplest steps I could think of.

Because performance and a small footprint are important, I have avoided the use of any object oriented programming in my software. OOP tends to add complexity, rather than to decrease it.

The mainstream world of programming in my opinion has not made programming any easier, but have in fact made it more complex.  I haven’t been using a Microsoft programming language (other than to dabble once in awhile) for the last decade and when I recently tried to use Visual Studio to build a Metro application for Windows 8, I found it overwhelming and too complex. OOP has ruined much of the experience in my opinion. Without intellisense, many modern programming languages would be useless. The endless new terminology tacked onto programming languages makes things even more complex. To me, software simply needs to be able to draw things on the screen, get user input, make calculations, read and write data to disk files and so on. I don’t need an endless array of complex programming terms which have little to do with the tasks I need to tackle.

For example, when I was developing EZGUI 4.0 and 5.0 I needed to better understand multithreading in Windows. I found an excellent book on the subject which was written by experts on the subject and yet it was do easy to read and understand that one could quickly see how simple multithreading really is and the ramifications of the choices you make in doing it. This is why I chose a specific model for the threading engine in EZGUI (which was to only use worker threads for non-GUI tasks while passing all GUI tasks back to the primary thread) which has worked very well in the product and made threading easy to use for my customers.

 

On the other hand when I read books on subjects associated with programming using current mainstream programming languages, I often find the language too complex, riddled with fancy computer lingo which makes little sense to me and poor explanations of why they do things the way they do. Now multithreading in Windows is not a simple thing to learn, but if a topic like that can be explained simply why can’t the same thing be done with other programming subjects ? Maybe it is because programming has become too complex in the first place. Maybe the love affair with OOP has had a more negative impact on programming than many realize. Maybe programmers are no longer coders, but simply application builders.  What ever the reasons, programming has lost its way. Programming will always be a skill of course, but this does not mean that methods of programming need to be overly complex. The tools need not be so complex that it requires an encyclopedia to learn how to use them. Programming languages need not be cryptic in style and syntax to be powerful. That has been proven with Basic. When I mention to others than I use PowerBasic, I get laughs, yet PowerBasic has the power of a C compiler, with the ease of Basic. What is so funny about that ?

There needs to be an effort to make programming easier, not so that it does not require any effort but in that a programmer can concentrate on tasks, rather than complexity of their tools. Programming languages would do well to go back to the basics of “keep it simple”.


Comments Off

Windows 8 and the software gap !

Not enough apps for Windows 8 new modern UI !

So that is what I hear anyway. So from the perspective of a non-Microsoft language developer, what do I think is part of the problem ?

While I understand the so called Modern UI concept and some of the reasons Microsoft has created it, I find that one serious flaw is failing to appreciate what Windows already has. The Windows Store (aka. Metro) environment is so radically different that it can not even run so called legacy software. There has to be a separate desktop for that, giving it a second class status.

So, didn’t I say I like Windows 8, before this ? Yes, I do. But many of the concepts of Windows store apps could have just as well been implimented using the WIN32 API’s by providing a few extra API’s to tap into. The strength of Windows is its long history. Backward compatiblity is something rare today in the tech industry, but Windows has provided this for many years now. Windows 8 attempts to break this and this may be a seriously failing in it. Yes, the desktop is still very backward compatible with the WIN32 API’s, but will it stay that way.

Another problem I see is Windows RT. OK, I understand the value of ARM for some things, but Intel is doing an amazing job of catch up and Windows and Intel (or AMD) for decades has been like a hand and glove fit. There is nothing wrong with improving CPU’s, but backward compatiblity is also important there too. Now cross platform sounds great in theory, but having been programming since the 80′s, I have found that concentrating on a single platform that “just works” makes life so much easier and you can tap into the power of the platform more fully.

Software developers have not made things any better in my opinion. It hasn’t been enough to just improve programming languages, but too many want to make radical changes to programming languages in the unending quest for the perfect language. Programmers want their tools to solve all their problems, rather than become better programmers. There is nothing wrong with building better tools, but at some point it all comes down to coding. Yes, coding to some is considered a bad word. I like RAD tools just as much as the next guy, but programming is all about coding.  Have you ever tried to keep up with all the latest programming lingo today ?

Terms like:

  • abstractions
  • agile
  • design patterns
  • fuzzy logic
  • obfuscation
  • polymorphism
  • waterfall model
  • namespaces

Now of course there are always going to be unique terms to any trade, but I have found that despite having been programming for a couple decades now, that I some times dislike reading articles about programming because, what should be relatively easy tends to be made overly complex. Windows programming has experienced the same thing. You don’t appreciate how something really looks until someone who has never seen it before sees it for the first time. Are they excited by what they see or are they confused ? Having been a non-Microsoft language programmer for nearly a decade now, I was excited to get a look at the latest Visual Studio for building Windows 8 (Metro) apps. I had once been an avid fan of Visual Basic (now some call it Classic Visual Basic). I had purchased Visual Basic versions 1.0, 2.0 and later 50 Professional. Visual Basic, despite its limitations (performance) was a dream to use. It was easy to use and concentrate on building software quickly. When I switched to PowerBasic, which required an extensive knowledge of the Windows API back then, it was a challenge. I was learning how to program the hard way (like C programmers of old use to). Compared to Visual Basic it was 10 times harder (not the core language, but the GUI stuff using the WIN32 API’s). But I endured and today, much of it is relatively easy for me. Now having endured a decade of learning the Windows API, you would think, anything else would be childs play for me. Not so.

When I downloaded the latest Visual Studio and started to play with it, my first reaction was “what happened to programming ?”. Even by resorting to the Visual Basic part of Visual Studio, nothing felt familar. Object Oriented Programming had changed programming and not for the better, in my opinion. If the editor did not have intellisense, it would be totally unusable. Complexity has ruined programming.

When you break down programming to its lowest level, it is simply the act of moving a lot of bytes around, doing a lot of calculations and trying to make it all mesh together to get some work done. The new Windows 8 style of everything being so flat in appearance, so much open space in apps, etc. does not make it more productive. True, designing for touch is quite different than designing for a PC with a mouse and large screen, but it is not the operating system and a bunch of UI rules which determine how well suited an application is to the device it will be used on, but it is how well the apps developer took into consideration the different device type he expected the app to be run on. What works well with touch may not work well with the mouse and visa versa.

Windows 8 has a lot of potential and I do not consider it a failure as some may. But software is software, no matter the device. Software must be designed to get work done and do it well. Software must take into consideration the devices it will be used on and remember, it isn’t always possible to make something so universal that it works perfectly on all devices. Maybe it would be better of the software had the ability to know what kind of device it is running on and then to morph into what would work best for the specific device it is run on. If run on a tablet, then dynamically change the app so it looks well on a tablet. If it is run on a desktop, then dynamically change so it works well on the desktop, even if it is significantly different looking than the tablet version.

Also software developers need the freedom to be creative. At times the best software comes from those who see the need to do things just a little bit differently, because the situation warrants it. Have you ever noticed that trees are not all alike ? Some trees are well adapted to living in areas with a lot of swamps. Some trees have large bean like pods they drop (for seeds), because in a swamp they stick in the mud and grow better because of their design. Other trees drop acorns or nuts (not in a swamp of course) and they get seedlings to grow and also feed all the squirrels. The point is that some times different makes sense, when it accomplishes something practical.

Software design is similar ! As a programmer, I just want to be able to easily access the core functionality of the operating system without having to jump through hoops. Native procedural based API’s are the simplest form of this. Sure, if you want to add some layers on top (be it OOP or COM) fine, but the core of an operating system needs to be simple and easy to access. This allows a variety of developers to even build new tools for programming applications for the platform. The long time WIN32 API’s had this advantage, though I would not have called them easy. Still they were easily accessable, so programmers could built upon them. But don’t we need high level tools to get work done ?

Of course, but high level languages don’t always mean simple. Sure, I would like to see some of the low level API’s in Windows made a good bit easier. But the high level tools used today don’t appear very easy to me. Visual Studio is overwhelming and not friendly to a new programmer. High level is only beneficial when it really is easy to use and it really accomplishes important tasks. Modern OOP based languages are not easy by any means. Remember, building an application which does its job well is hard enough to begin with. But why make the development of an application any harder or more complex than it needs to be ?

Now many would take issue with me, because I have been a long time BASIC programmer. BASIC is not a professional language some will say. But what is the definition of professional ? Does someone using tools which are too hard to use or more complex than need be make them a professional ? Professionals are those who know how to choose the best tools which make their life easier and more productive, not more complex. If a programmer chooses a language because it is easier to use, more readable (easier to maintain), requires less resources and produces smaller and faster applications, how does that make him a novice rather than a professional ?

In many trades, more experienced tradesmen are often noted for telling the novices of their trade the often heard lesson or rule of “Keep it Simple” (or something similar). Yes, professionals know how to keep it simple, not make things more complex. Microsoft could learn a few things from this. It is time to get back to basics and to “keep it simple”. Windows reimagined doesn’t have to mean a total face lift and more complexity. Why not reimagine Windows and make it easier for developers ? Why not make programming so simple that even a child could do it ? (aren’t they the next generation of developers). While I have yet to tackle building Windows Store apps using a non-Microsoft language yet (that is one of my goals), I currently have been doing so for the desktop for a decade now and making things “easy” , while still providing power features, is my goal.

As a developer of tools (EZGUI) for programmers (PowerBasic programmers), I don’t want to see all my customers build the exact same thing. I want them to build the best they can for their particular need or market. The variety of user interfaces that some of my more experienced customers are designing is surprising.  Windows (even previous versions, not just Win8) has so much untapped power in it, it would amaze you. Windows 8 would benefit from having more developers tapping into that power.


Comments Off

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.

 

 

 

 

 


Comments Off