Sunday, December 9, 2012

Pac-Man Coffee

During prototyping, some project tools are more important than others.  Coffee:



And visual thinking:


Thursday, December 6, 2012

The Project Revealed

The more things change, the more they stay the same

So far, I've written about mountains and ports, about programming and about popular games on phones.  There were pictures from Himalaya and some screenshots of ancient computers.  There were also pictures of colored text and colored windows.  Even a page with samples of running code.  But it's all bits and pieces.  It's time to connect the dots.

Can you guess the image?

The basic idea is to make wxWidgets available on Amiga.  Making a new software available on a new computer is referred to as porting.  Porting wxWidgets means making it available on a new computer.  It's just that simple.

What is wxWidgets?

It's a toolkit for programmers.  Some of the fun things programmers want to do with computers can be a bit hard.  Things like playing video clips and music, making nice user interfaces, network stuff, graphics and 3D, web, database connections, etc. can take quite a bit of code even to achieve very simple things.  Even just making the software work nicely in both Россия and 日本 can present some fairly hairy challenges.  If you've ever faced code pages in Windows, or EURO (€) symbols that won't print, then perhaps you know what I mean.  Some people think of wxWidgets as a GUI toolkit, but it's really a toolkit that simplifies all of the above (and more).  And what's more, it makes it easy to make the same app available on both PC and Mac.  And Linux.  And phones.  And Amiga.

Using another toolkit like MFC, .NET or Cocoa (Mac) or even GTK (Linux) makes apps just as easy to write, but mostly just makes them available on one computer type (e.g. Mac or PC).  With wxWidgets, the app is more or less automatically available on just about any computer type, and tablets and phones.

Is that the Amiga from my childhood?

A different kind of small talk
Yeah ;-)  It changed a bit after Commodore failed, but it's essentially the same thing.  What most people don't know is that Amiga has a pretty nice, simple and mostly complete operating system.  The initial designers took inspiration from some of the best available technology, and simplified it to work in an inexpensive home/game computer.  This means it has many features from bigger systems (read: Unix), but without the complexity that makes them slow and big.  User interface systems were inspired by research at Xerox PARC, same as most other user interface systems.  GUI and widgets systems were inspired by Smalltalk, and the MVC model.  The disk operating system and kernel originated mostly from a research project at the University of Cambridge.

The modern Amiga is a 64-bit multi core PowerPC machine, with gigabytes of RAM, Radeon 3D graphics, gigabit ethernet, SATA/USB/PCI ports, 7.1 channel audio, and whatever else can be expected from a current computer.  The OS supports Cairo and OpenGL graphics, 64 bit journalling file systems, BSD sockets, music and video playback, transparent desktop windows, internationalization, threads, dynamic loading, and many other things expected from a modern OS -- with some nice additions not found anywhere else.

The key thing is that all of AmigaOS is based on solid research principles that were simplified and put into an efficient package.  This makes it similar enough to other systems to make it easy to understand, but different enough to make it interesting.  Now, how the original engineers were able to get venture capital to build a game console, but managed to produce this neat little piece of operating system, that can probably only be answered by themselves!

Either way, wxWidgets is a perfect match for the Amiga, and the port is long overdue.

So what's the project?

Making wxWidgets available on Amiga.  I'd like to think that this adds value both to Amiga and to wxWidgets.  How much value can certainly be debated, but I'm not asking to get paid.  I'm doing it mostly because I enjoy it.  And because it's something wildly different from what I've been doing recently.

The main effect would be to enable a large number of new apps on Amiga, but it also means that some Amiga apps could be rewritten for wxWidgets and made available on other platforms.

What's with the mountains?

They're just there as a metaphor for challenges that sometimes come in our way.  This project is a significant challenge for me.  I don't know much about mountains really, but I know quite a lot about taking on challenges that appear almost overwhelming.  Depending on your own experience with wxWidgets, Amiga, programming and software projects, you may or may not see the same challenge in this project.  That's fine though.  I will explain as I go along why this project, right now in my life, is stretching my limits.

Triangles?

Used for 3D graphics.  I like moving, spinning things in full color.  What can I say?  Here's an example of what is possible when triangles meet wxWidgets:



Nothing But Nets

One of the nice things about open source development is that it's mostly free (as in beer) and unbound in time.  In reality though, there are still both money and time constraints although maybe not as clear cut as in commercial projects.  I've decided to commit the time and money to complete this project, and make the end product available for free.  If you like this project and enjoy reading the blog, do consider donating to Nothing But Nets.  It is a United Nations Foundation initiative to fight malaria, clearly on a whole different level of importance than anything wxWidgets or Amiga can do.  I don't mind some limited compensation for the time and money I invested, but it's not critical.  If there is interest, I may open up options to donate to this project specifically, but Nothing But Nets will always be the preferred choice.

That's all for now.  Comments are open for this post, go ahead and try it!


“Grown-ups never understand anything by themselves, and it is
tiresome for children to be always and forever explaining things to them”
― Antoine de Saint-Exupéry



Sunday, December 2, 2012

Sunday Treat

It might take up to three bankruptcies to learn how to run a decent business.

The top menu now has a Status page where I elaborate a bit on project progress as I go.  The past few days my brain has been all over the place, and it's been hard to make any solid progress.  But as a Sunday treat, I thought I'd just show a couple of examples of working code in full color  ;-)

Starting to let some of the blue smoke out...

Ok, so that's just about as exciting as it is right now.  I have been testing against a wxWidgets tutorial at zetcode.com.  At this early stage it's as good for testing as any other code, and using something already available saves me some typing while testing.  In parallel, I'm also working with the wxWidgets test suite for a bit more formal testing.  But in my humble opinion, testing with "real" content is probably more interesting to most of us.  As of right now, everything on the Helper Classes page builds and runs nicely.  And that's still without really adding any significant code content -- I'm still in the design phase (see the Status page for more).

Q & A


I've had a few questions over the past few weeks.  Quite appropriately, since I'm new to most people in both the wxWidgets and the Amiga communities.  Keep up the questions, I'm happy that there is so much interest in this project already!  Here are some answers:

Which version of wxWidgets are you porting?

The latest.  Looks like 2.9.5 will be out any day now, but realistically it will be 3.0 before the Amiga port is finished.

How long will it take?

Yeah.  Would be nice to know.  I'm looking for the quickest way to put something reasonably useful out there.  Some other ports have taken a couple of months to reach a useful stage, and I don't know any reason right now why the Amiga should be significantly different.  So far it's going quite well.

Are you porting to AmigaOS 4 and native widgets?

Yes.  And that means using Reaction etc. and/or whatever else ends up providing the best implementation for Amiga.  That said, for practical reasons I'm doing a lot of initial testing on OS3 in UAE (an Amiga virtual machine).  It's likely that the wxWidgets port will also run decently on OS3 with reduced functionality.  At least under Amiga Forever -- testing on a wide range of actual hardware from ~1990 may be a bit too challenging.

I heard you didn't even have an AmigaOS 4 box?

That's no longer the case  ;-)

Wasn't someone else porting wx before? Is this again a case of double work?

No double work so far, and unlikely to happen in the future.  There were some previous attempts, and I've been granted a copy of their latest source tree.  Having the advantage of their experiences, I am able to take a slightly different approach that should hopefully prove quicker and easier.  The available code is perfectly fine though, and I understand I may be permitted to use it as applicable.

Can I be a beta tester?

At the moment I don't know if and when there will be a beta stage at all, though there will probably come a time when concentrated testing will be required.  If you're maintaining a wxWidgets app that uses only base/core, then I'm certainly interested.  If you have experience in CPPunit test writing then that will also be useful.  If you're super sharp with the intricate details of C++ and class documentation, you should certainly let me know.  If you have no experience with either wxWidgets, cppunit or C++, then please be patient for a little while.  Even if wx is massive it's still just a toolkit, and getting actual apps to run is some way off yet.

What nice software uses wx?

A fair bit actually, though you might not know it.  It tends to blend in so well with the regular look & feel that end users never know.  A couple of open source examples are Audacity, Kicad, Code::blocks and Amaya.  The list of commercial software is probably even longer, and some of them even originated on the Amiga!

How much experience do you have with AmigaOS programming?

A fair question.  I didn't really release much of anything for the Amiga before, and I've been away from the community for a while.  Whatever commercial programming I did was for Windows and Unix, and even that work you're quite unlikely to have seen.  That said, I grew up on the Amiga.  I was coding on it when OS version 1.2 was considered "new".  I found the gems pictured below in my library, and if you recognize them you know I've been around for a good while.  In all honesty though, the AmigaOS API is pretty small and simple and I'm not worried -- it's not even on my top 10 list of possible challenges in this project  ;-)

LISP is your friend.


Ok, that's all for now.  Be good.  //A.


“Everything should be made as simple as possible, but no simpler.”
A. Einstein (possibly paraphrased)




Tuesday, November 27, 2012

Programming Demystified

If you wish to achieve something, don't just believe you can do it.  Believe you have already done it.  Feel it, desire it, experience it as if it was already there.  And as if it was easy.  Then go do it.
Ever since I first experienced a computer in the 1970's I've wanted to a) understand how they work, and b) make computer apps.  Understanding how they work was easy, just take them apart!  (no reassembly plan required)  Making computer apps was the mystery.  How do I get the computer to write my name?

It also turned out to be easy:

It's version 4 and it comes only in green.

Oh, so everything between the quotes is reprinted on the screen?  Cool!  Very useful.  Can it do more?

Did you notice the massive amount of memory?

And we have a program! (which apparently recognizes my brother and sister)

This is actually quite an achievement, because it can do it all over again.  Just write "run" and it will print the same names once more.  It executes a program.  But only until you switch off the computer of course.  Then it's gone.

Incredibly, more than 30 years later this is still how we make computer programs!

This might explain why triangles are useful
Yes.  That's true.  We have more colors than the human eye can see, we have surround sound in three dimensions, we can write a text message in Japan and it instantly reaches our friend in Berlin, and any old desktop computer can draw millions of triangles in a fraction of a second.  And it doesn't disappear anymore when we switch off the phone or computer.  But we still make programs by writing a little bit of text, and then executing the program.  This is true for the word processor you use to write invoices, for games you play on the iPhone, and for whatever browser/reader you use to read blogs!

I've tried to make programs for just about any computing device I've come in contact with.  This has led to experiencing 30 or so programming languages/systems, and at least (!) 29 of them have been text based one way or another.  Write some text.  Then run it.  That's how we make computer programs.

Maybe equally weird, we also still build computers the same way as then.  Before the 1970's there was actually quite a bit of diversity in how we made computer programs and how we built computers.  Then we discovered the integrated circuit, and suddenly the whole world aligned itself, and started focusing on faster and more.  And smaller.  Much smaller.  And much faster.

Smaller and faster is no small achievement though.  To put it into perspective, an investor may be content if an investment grows by 10% every year.  The improvement rate of computers has been around 40% every year.  Consistently.  For the past 40 years, and still counting!  Computers can now write the names of millions of siblings in the same time as two siblings in 1980. (though we may not have millions of siblings)  When something improves consistently with 40% per year, this is such a massive improvement rate that new uses of computers eventually become available even without other significant breakthroughs.  Like mobile phones.  There's nothing significant in a phone that a computer in the 1990's or 80's couldn't do.  But having so many things integrated in a unit that almost disappears in a shirt pocket, that in itself allows us to start using computers in completely new ways.  Just from them being smaller and faster.

Of course, printing names on a green screen is exciting only for so long.  Today we want our programs to look (and sound) like this:

Built with wxWidgets, this is from Mac OSX.

And suddenly our programs need to be more complex.  And they don't run on all computers or phones or tablets anymore.

The program that prints the names of my brother and sister had an interesting feature.  It would run on most available computers at that time, not only the Commodore Pet that this example is from.  And it ran on contemporary computers for another 15 (or so) years.

But if we still build all computers by the same principles, why can't all programs run on all computers and tablets and phones?  In my opinion, this is a valid question that people tend to forget to ask.  Like I mentioned in the prologue, we've pretty much accepted that there need to be barriers.  What's more, the barriers aren't there for technical reasons.  Apps are more complex today, but there aren't really any technical barriers to make any app run on any device.  If you want to know why Halo doesn't run on Playstation it's not the technical department you should be calling!

I won't go into that any further in this post.  But in future posts I will explain why I don't consider there to be any technical barriers (some people may disagree with that).  And why porting wxWidgets is a Pretty Cool Thing.


//A

"There is no order of difficulty in miracles. One is not 'harder' or 'bigger' than another. They are all the same."
- A Course in Miracles, Helen Schucman


Friday, November 23, 2012

Picture the Goal

Everything is connected.  In mysterious ways.
Sometimes, a picture is the quickest way to describe what a project intends to achieve.  For this project it's super simple, four pictures tells the whole story.  Next week we learn how all apps, phones and tablets are built.  It's probably easier than you think.  There will also be dolphins.  And some triangles.

Ok, the basic idea is to get this:

Colored text, not so hard.

to produce this:

A couple of windows, not so hard.

but run on this:

More windows, still not hard.

because then it will also enable this:

Whoah, cool!  ;-)


How hard can it be?


//A

“If you don't know where you are going,
you'll end up someplace else.”
― Yogi Berra




Monday, November 19, 2012

Prologue

- Why do you want to climb Mount Everest?
- Because it's there
(George Mallory)

Once upon a time...

What is wxWidgets, and why would you want to port it? And what is porting anyway?

Few people would know.  Even fewer will actually do it.  But the world wouldn't be the same without it.

As I go through the process myself, I will attempt to explain it in a casual way that can be appreciated without a technical background.  There will be jokes and pretty pictures.  And you will (yes!) learn programming by following along.  Entertainment and utility, all in one package!  ;-)

Here's the issue:

  • When Angry Birds first came out you needed an iPhone to play it
  • If you want to play Halo you need an Xbox
  • Logic Pro (create digital music) is only on Mac
  • Lots of programs for Windows will not work on your tablet
  • And so on...

This is incredibly common.  You can't use x because you have to have y.  We've all experienced it.  We keep experiencing it, over and over.  It's in fact so common that we've come to accept it as part of normal life.  Often, we don't even realize that it could be any different.

But it can.

Mountains and ports

For now, let's say porting means making an app work on a new device.  Like a phone.  Or a gaming console.  Or a desktop computer.  Anything really.

With that introduction, wxWidgets will be a lot easier to understand.  But it really deserves its own blog post.  For now, let's just say wxWidgets makes it easier to put any app on any device.  Now you have the tools to understand what porting wxWidgets means.

Foothills of Himalaya in 2008
In the early 1920s, George Mallory took part in the first three British expeditions to Mount Everest.  He is famously credited with the response in the beginning of this post.  I find that quote appropriate to this project.  A complex porting project can be a difficult challenge.  It's a step into the unknown.  It's not guaranteed to succeed, and the rewards are unclear if you do.  It's not even completely clear why you would want to do it.  If you want to play Angry Birds, just go get that iPhone!


And yet, here I am, dead set on completing this project.  I can't easily explain why I want to do it.  The best explanation I can come up with is "because it's there."  Fortunately, that's all I need at the moment.

It is unknown whether George Mallory actually reached the top.  He and his climbing partner disappeared in 1924 during their attempt to make the first ascent to the top of the world.  They stayed missing until 1999, when their frozen bodies were found.

Luckily the consequences of a failed port are not quite as severe, but let's still hope it works out, ok?  ;-)


//Andreas
“Mountains should be climbed with as little effort as possible and without desire. The reality of your own nature should determine the speed. If you become restless, speed up. If you become winded, slow down. You climb the mountain in an equilibrium between restlessness and exhaustion. Then, when you're no longer thinking ahead, each footstep isn't just a means to an end but a unique event in itself. This leaf has jagged edges. This rock looks loose. From this place the snow is less visible, even though closer. These are things you should notice anyway. To live only for some future goal is shallow. It's the sides of the mountain which sustain life, not the top. Here's where things grow. But of course, without the top you can't have any sides. It's the top that defines the sides.”

― ROBERT PIRSIG