Monday, November 28, 2011

The loss of WYSIWYG in programming languages

As programming languages have evolved, we have moved from static languages to dynamic languages. These new languages offer new capabilities, but at a price. That price includes performance (perhaps not a great cost, given advances in hardware) but also the ease of understanding code.

Early programming languages of FORTRAN and COBOL were quite easy to understand. They did not allow for recursion (the early versions, at least), and offered static, up-front at compile/link time memory layout. You knew (or the linker knew) the location of every variable and every subroutine when the program was built. You knew the destination of every jump and the meaning of every statement. (Yes, COBOL had the 'ALTER' keyword, and FORTRAN had the "assigned goto", but they were proscribed in civilized shops.)

Of all languages, BASIC (prior to Visual Basic) was probably the most easily understood. It had a specific set of keywords, no pre-processor, strongly-typed variables, and no dynamic aspects.

The C language was one of the last languages in which "what you saw was what you got". A colleague referred to his "cortex compiler" when discussing the clarity of C code. One could look at source code and know the actions performed by the computer. (I am ignoring the effects of the pre-processor here. Poorly-design -- or even well-designed -- #define macros can change the normal meaning of C code and stymie all but the most careful analysis.)

Things changed with object-oriented languages. In object-oriented languages, one can look at the source code, but the action taken by the computer is not always obvious. To understand polymorphic code one must understand the inheritance hierarchy. To understand operators one must understand the class and its ancestors. Multiple inheritance (multiple implementation inheritance, as in C++) is rife with ambiguity.

(I'm ignoring LISP in this sequence. LISP, which dates back to the days of FORTRAN and COBOL, offered the same flexibility and dynamic constructs that it does today. But most programmers ignored it then, too.)

Java kept object-oriented programming but mercifully implemented multiple interface inheritance (and not multiple implementation inheritance) and eliminated the pre-processor and operator overloading, all which made it more obvious than C++.

Dynamic languages are now in the ascendant. Perl allows for lots of un-obvious constructs (some will snarkily comment that the entire language is un-obvious). Ruby lets one define or modify classes -- even the "standard" classes -- during run-time. (The shades of COBOL's 'ALTER' haunt us still.)

The trend may be towards dynamic languages, but not everything is moving in that direction. The up-and-coming functional programming languages (Haskell, Erlang) take a different approach and enforce strict definitions of functions and their results. Their syntax and organization is different from object-oriented programs, and can be difficult for those trained in O-O programming constructs. Despite the differences, I expect that these languages will, in the long run, be considered the more "obvious".

And we may, once again, have programs that are obviously understood, capable of being processed by our "cortex compilers".

Sunday, November 20, 2011

Android success

I successfully wrote an Android app today, and downloaded it to my tablet. It installs and runs! Woot!

OK, the app is simple -- trivial, really. It is a simple "Hello, world!" app that displays the "hello" message and the screen resolution.

I was impressed with how easy it was to test the app in the Eclipse simulator. I was also impressed with the ease of installation: on the PC copy the .apk file to the tablet and then on the tablet click on the .apk file.

Sunday, November 13, 2011

Playing with X

I took some time this week-end to play with X and remote access to computers.

First, I set up a virtual machine running Ubuntu Server edition 11.11. The server edition is plain Ubuntu without the Gnome front-end. It's a much better configuration for a server -- although it does require that one perform administration tasks on the command line. I had to refresh my memory of the 'apt' and 'aptitude' commands.

Second, I configured the virtual machine with a bridged network connection, so it will appear on my local network.

Then I configured Ubuntu Server to use a static IP address. That took some research (a minimal amount, thanks to Google) and some experiments (keep the "auto eth0" line in /etc/network/interfaces) and some tests with 'wget' to ensure that the configuration was correct.

Finally I installed ssh-server and 'xclock' on the Ubuntu Server and tried some connections. Connecting from a Windows PC running Xming and putty worked, and I was able to see the clock. Connecting from an Ubuntu PC failed at first; I had to use the 'ssh -X' command to connect, an 'export DISPLAY=192.168.1.102:0.0' command to identify my display, and also the 'xhosts +' command to allow connections.

I want to create an /etc/X0.hosts file; that should eliminate the need for the 'xhosts +' command. I'm not sure how I can auto-configure the DISPLAY variable... or if that is even desirable.

All in all, I feel pretty good about my accomplishments. Remote access with Linux is quite different from sharing desktops in Windows. The Linux approach has more possibilities: run X applications in my local display, share a KDE session, or share the whole desktop. Windows seems to be limited to the 'share a desktop' approach. (Can one SSH into Windows? That is, get just terminal -- a CMD.EXE terminal -- session?)

Tuesday, November 1, 2011

Looking at HTML5 and CSS3 with the .NET folks

I attended tonight's CMAP meeting, with a presentation on HTML5, CSS3, and Javascript. The meeting was well-attended, perhaps the best attendance I have seen. Apparently lots of Microsoft tech fans are interested in the subject.

And they should be. Microsoft let the cat out of the bag earlier this year, announcing that their new development platform supported HTML5 and Javascript. (That announcement may have been premature, but the direction seems correct.)

Tonight's meeting was about HTML5 and CSS3 and Javascript, and had very little about Microsoft tools. (It was given by a Microsoft employee and evangelist, so it seems credible.) The programming paradigm of HTML5 and CSS3 is very different from the old world of WPF and XAML. It is not specific to Windows or Internet Explorer -- it is cross-platform.

Interestingly, the presenter mentioned "inkscape" as a tool for experimenting with SVG. (Apparently Microsoft has no SVG editor.)

We are in a new world, a world of multiple technologies and multiple environments. Mobile phones, tablets, desktops, and servers all interact as part of your system. This new configuration is bigger than any one company.

Sunday, October 23, 2011

Local Linux, Cloud, and Virtual Machines

This past week I accomplished a number of things.

I attended the local Linux user group. They are going through a transition, expanding their focus from Linux to open source. The change makes sense; when they were formed, Linux was a difficult beast and one needed a lot of technical knowledge. In today's world, the modern distros install themselves. (I recently installed Kubuntu 11.10 and the process was simple.)

The change in focus requires a new focus, and the challenge to the group is to identify it. No one is stepping forward to claim ownership, and the transition has stalled. I have considered stepping up, but I have no clear vision for the group, no "itch" that I want to "scratch". As such, I consider myself an inappropriate candidate.

The cloud computing meeting had an informative presentation on database.com, a "spin-off" of the salesforce.com folks. I chatted with a number of folks; these meetings attract people with varying degrees of experience.

The cloud computing group was in the Washington area, and it highlights the challenge of my living and working arrangements. Living in Baltimore and working in Washington leads to a long commute, even on the train. It also locks me out of a number of activities -- I arrive in Baltimore too late to participate, and I must leave too early to participate in Washington events.

As to virtual machines, I made modest progress with my local tests. I successfully connected to a virtual machine with remote access software. I had to completely disable the firewall on the host system, and the color palette leaves a bit to be desired. But it is success, and I am looking forward to tuning the arrangement, adjusting the firewall to allow access and handling the color palette. I also found instructions for creating a headless virtual machine, which makes a lot of sense for remote operation. I'll have to read up on the process; it is something more than simple.

Sunday, October 9, 2011

Revisiting virtualization

I dusted off some virtual machines today. They are experiments, to see how virtualization performs in different environments.

I use VMware and Oracle's Virtualbox. Both had updates; new versions of the virtual machine software.

The updates for Virtualbox ran a bit smoother than VMware. Both programs alerted me to the new version, and let me download them. Both updates were replacements and not patches. That is, both un-installed the old version and then installed the new version. And both new versions had new "inside helper" packages, utilities that install drivers inside the guest operating system to help the "outside" virtualization program.

It was the installation of helper utilities that Oracle beat VMware. With VMware, you have to run a script, answer several prompts, and let the script compile several modules for your system. (The questions have default answers, but they are sensible only to a sysadmin.) Virtualbox, on the other hand, installed the helper utilities without prompts or compiling.

For both VMware and Virtualbox, the improvements were evolutionary, not revolutionary: small improvements to the GUI, noticeable changes in support for devices.

And for VMware and Virtualbox, performance was acceptable. Virtual machines run a little slower than a "real" machine, but the difference is small.

I don't use Microsoft's Virtual PC, as it refuses to run on my hardware. My PC is a two-year-old SystemMax PC with a nice Intel processor and 4 GB RAM, but apparently it lacks something that Virtual PC needs. So I limit my tests to VMware and Virtualbox.

Tuesday, October 4, 2011

Sharing evil plans

I attended the GBTC meeting for "Evil Plans" tonight. This was a meeting of meetings; a parliament of local groups to discuss meetings and schedules. Baltimore has enough special-interest technical groups that our schedules collide. This meeting was to introduce the groups and let them work out their scheduling conflicts. (Working out non-conflicting schedules is to every group's benefit, since other events pull people away.)

About fifty people attended, all creative in their own way. Some were hard-core programmers, others web developers, and others teachers. It was a creative mix of creative people!