Sunday, May 27, 2012

Snipped from the web: an idea related to GUTS

HN > Techcrunch story > Google Search for paper mentioned > Ch1 of paper, which had this nugget:

"I noticed that, often, the mere presence of a feature or capability incurs some cost, even when not being used. For example, as the number of services and options multiply, extra code is required to select from among them, and to check for possible interference between them. This code does no useful work processing the application's data, yet it adds overhead to each and every call."


I like this idea of the presence of code causing things to change around it - seems like something that can be quantified usefully by GUTS

Monday, May 07, 2012

I am Jack's total lack of unlayered design

A nebulous idea grows within me partly from GUTSE's insight that all programming is mere translation from one  language to another: All Von-Neumann machines are merely SSI (Sequence, Selection, Iteration) executors that essentially facilitate these translations. Why not enshrine these facts directly, then? The design of Jack, therefore, stands refined to:
  • A simple SSI executor at the base with no idea of what data is beyond the generic map that it reads in as input.
  • A data layer (built using the SSI + its environment) that actually does know about the bits of data stored in the map. This layer essentially provides the box/unbox, serialize/deserialize, parse/print dual functions as required
  • The data transformation layer (built using the layers below) that enable and reason out the transformations declaratively so that they can be composed, collapsed etc.

Sunday, May 06, 2012

Coin, Lambda, Jigsaw and EJB Home Automation: My take on the JavaOne 2012 Hyderabad

So nearly 13 years after my first java program, I finally attended a JavaOne. I remember sitting in Chennai years ago wishing I were in California when I first heard of them (or read about talks from them months later); so when I heard about a JavaOne in Hyderabad, I figured it was time. Of course, its not the same thing without Sun hosting it, but I was also interested to see how Oracle rolls one out. Few days of finagling with the powers-that-be later, I was set to go.

I've been to Hyderabad before, but not by air. So when I landed and found an airport that could be mistaken for any mid-size one in Europe or the US, I had to concede that Bangalore with its sneeze-n-you're-either-out-or-on-the-runway airport has been severely outclassed. Add to that the faithful reproduction of a US expressway (with exit numbers, no less) that led from the airport to the city and a die-hard bangalorean like me had to just weep and die a little bit inside. Damn you, you f-in politicians and whoever else who's responsible for our rinky-dink airport and the tragedy that is NH-7. You know you've had the revenue in spades to do a better and quicker job.

And then there was the convention center itself. Pretty much world class, IMO. Easily configurable main hall (attendees know what I'm talking about), a control console in each room, each room equipped with at least 2 screens and 2 LCDs facing the speaker - one to show the slides and one with a timer, ample wait staff and F&B counters, attached hotel - the works. Of course, the event management itself had some typical desi-ness to it that I'll mention below, but in all a very nice place. It had the feel of somebody with systemic thinking being in charge.

Anyhoo onto the sessions themselves. There were 5-7 parallel talks spread across Oracle-specific and Java themes so I'll talk about the sessions I attended:
  • Day 1:
    •  Keynote: Pretty OK state-of-mobile talk by Mr. Rego. Nice demos of Nano Ganesh (controlling irrigation pumps using Nokia phones) and of controlling cars via phone. Nice message about "looking for problems to solve and the money will follow". Also liked Nokia's message that they're not about creating new things themselves, but enabling and partnering with people who are creating those new things. I liked this message because I've always like Nokia phones as sturdy workhorses of communication and IMO with all the smartphone craziness this is a good middle path to take. Hope it works out for them.
      • Aside: The Nano Ganesh project uses the phone's voice connection to control pumps. I spoke to Santosh Ostwal - the creator - and he confirmed there's no API to this - its direct control of the hardware. Sad. It would have been great to write this kind of phone app - the kind that doesnt need a separate data connection.
    • Head and tail of Project Coin: Good "Directors cut" review of what its about by Dalibor Topic. Much better than just the changes.
    • Data Parallelism with Fork/Join: Blew my mind when they got to Spliterable. Very well explained by David Holmes. He didn't like my fanboy idea of reviving the old java idea of sending code via RMI to another JVM so that we could federate fork/join over multiple JVMs, however. Probably with good reason :). 
    • Oracle SOA suite: Caught the last of this because I was talking to David Holmes, so can't say much about it.
    • Tech Keynote 1: Nice overviews of Coin, Jigsaw and Fork/Join. Particularly liked Dalibor's animated slides that converted boilerplate java into its functional equivalent.
    • Improving MSQL performance with Hadoop: Lost patience. Speaker gave very naive definitions of MySQL and Hadoop and showed an agenda that didn't actually have the title of the talk listed.
    • Project Lambda: Excellent build up of the material and exposition of the JSR as it stands.
    • Java ME and LWUIT: Attended the end of this lab session. Seemed pretty standard UI stuff.
    • OTN Night: Not easy to get a few thousand indian geeks to "get jiggy", but to their credit Oracle tried. First there was a stand-up comic who apparently was a developer at some time, so was billed as a comic in 4 languages: English, Hindi, Java and C++. Sadly his tech jokes stopped at calling himself a Null Pointer. Aside from asking a whole crowd of south indians if "there were any south indians" and making the cardinal sin of assuming all southies are the same when there was a whole wealth of jokes with just mallus alone, he was OK. That was followed by Vasundara Das trying really hard to get 5000 engineers to confirm that the "party was on the dance floor" to her chartbuster "Where's the party tonite?". When I left about 100 hands were up in the air somewhat in chorus with the slightly-off background troupe. The food was good, though :)
  • Day 2
    • Oracle Develop Keynote: Some clueless event management guy goaded me into this with a "Developer keynote starting, please go, please go", so I went in. 5 seconds in I was thinking "How the hell is this a developer keynote, I'm walking out right now". I remembered, however, that I should probably listen to some Oracle speak for use "at the office" and settled down. It turned out to be pretty Ok after all, with Oracle's Cloud strategy taking center stage. David Pease presented a nice (possibly standard, but nice anyway) cloud adoption strategy and spoke about their public and private cloud offerings. Afterwards, him and another Oracle Manager did a pretty good job of answering my two questions:  How the cloud affects their main revenue stream - big iron database servers (answer: complimentary, not cannibalistic), and what their official response was to NoSQL(ans: berkleyDB. Not convincing, IMO) and Big Data (Ans: Will be treated as extension of existing solutions, not a separate one).
    • Interfacing with the interface: Impressive demo of JavaFX, Wiimote, Kinect and Hotspot. It was one of those "It CAN be done with Java too" kinda things. Cool, but dont see the point. Wouldnt you just use the native technologies for Wiimote and Kinect? Still a very balanced and nice talk. Take away: Heard about the JMonkey Engine. Also heard that its pretty buggy :)
    • Agility and Scalability @ eBay: Good, solid talk; but nothing new. Walked away into the "interfacing.." talk after a while, returned towards the end and found it taking a predictable course. No fault of the speaker, though. It was me, not him; entirely like seeing George Carlin for the 5000th time and not laughing. The rest of the crowd seemed to like it just fine.
    • Jigsaw: Another solid talk by David Holmes. I started reading about the project after the talk and immediately wanted those slides that presented the problem, its implications and solution(s) so well. Reaction to the project itself: Cant wait for it, cant wait to use it. Although I dont get the need for the "default" keyword for default methods. If you're writing a method body within an interface definition, shouldnt that be sufficient indication that its a default method? Holmes' take was to join the mailing lists and either understand or speak up. 
    • Nashorn - Javascript on JDK: Short, well presented talk on the new JS interpreter on the JVM. Sunderrajan was awesome at spinning out quick examples to questions right on spot. He was evasive about performance due to safe harbor rules, but was forthcoming enough to say its way better than Rhino. Killer announcement: Node is coming to the JVM, and they already have it working internally. Cant wait.
      • Aside: I mentioned that I was excited about Node-on-JVM to Steve Chin and Kevin Nilson and their response was: "why would anyone want to do that?". My answer: admins love the JVM. Put anything inside it, and they'll be OK with it. The JVM is the ultimate production grade sneakware platform :)
    • OTN Room: Monitoring Cloud Apps: Spent 10 mins here. People in the audience kept interrupting the speaker with more knowledgable information than he had. Good to get good information, not so good to have the talk's flow being interrupted thus. IMO Ranganath should have just set the rules of engagement better than being polite like he was, or the session should have been a BOF one.
    • Java beyond the IDE: Nice if boring-in-the-middle talk by Jay Suri on things less talked about in the Java scene, namely, issues in production. After a long list of issues the Java Platform Group has heard from customers (and their solutions), Suri introduced two tools that were coming to the JDK via JRockit - Mission Control and Flight Recorder. This latter tool is what everyone wants in production - instrumentation for a running JVM - and you can now have it! Expressly to be run in production! From the source! Of course, you'll need an Oracle license for production use, but depending on the price, I can easily see this being put on at least "Test in Production" servers for those hard-to-debug-in-preprod problems. Awesome.
    • Having fun with JavEE and Home Automation: Who would have thought of using an EJB server to do home automation? A crazy, funny, energetic brazilian and his wife, that's who.  Vinicius and Yara Seneger were genuinely happy to be in India and gave what was possibly the most lively presentation that I saw. They demoed JHome - a home automation software platform that uses Glassfish and Arduino to create home automation such as lamps that turn on via http, LED lamps that turn to any RGB colour, controlling appliances  via sound. The final demo was a heartbeat monitor that Vinicius had hooked up to some EJB code (Yes! EJB code!) so as to light up a lamp when the heart rate goes over 110 BPS. And of course, he had to jog to get it working. Awesome and endearing. Who cares if they used a whole herd of elephants to swat a fly? The energy of the guy was great. Couldn't have asked for a better last session :).
    • Speaking of: why wasn't there a one last hurrah Oracle? I'd have liked one last closing session on the center stage. And: some of us like to see the people behind the show, you know? Get 'em up the stage and let's take a gander at them. 
Tech Reactions/ Opinions:
  • UI Frameworks: Java has AWT(hopefully dead now), Swing, JFX and LWUIT (which I didn't know existed till this conference). Exactly how many of them does one language need? I spoke a bit about this to Steve, but he seemed unconvinced that it might be a good idea to consolidate. Maybe the way I put it was off, but is it too much to ask for one language to have one (preferably declarative) way to define a UI across all its deployment profiles?
  • Mobile: 
    • The elephant in the room was walked all the way around pretty carefully by Oracle. Nokia had one A-bomb, while Oracle billed the "mobile platform that must not be named" quaintly as "other linux tablets". The stoopid questioners mentioned below, however asked pointed questions on integrating with it, however. Was kinda funny to watch the Oraclers tippy toe around these ones.
    • The heartening news, however, was that the release schedules for J2ME was merging with the J2SE one and that Java 8 will have one of the ME profiles built in. Should bring solace to J2ME users, i guess. Do you know any? I dont.
General Opinions:
  • Speakers almost always took up all the time, leaving no "public Q&A" time. They were of course, super available in the hallway after the talk, but that meant fighting the hordes to get your one question answered.
  • There were some really stoopid questioners, which the speakers were gracious enough to deign to answer. 
    • Sample: To the nashorn team member: "Will it support eval?". Ans: Of course, its a language requirement. "Will it support closures, lambdas and anonymous functions?" Ans: Of course, its a language requirement.". "Ok, I understand it will support lambdas because of Project Lambda, but what about closures and anonymous functions?" Ans: "Look, we have to, cos its part of the language. And this has nothing to do with Lambdas in Java". This went on for a few more rounds.
    • It was even worse in the Oracle Dev sessions where people generally were summarizing the talks in the Q&A sessions.
  • Event management was a bit weird in places:
    • No wifi. Had to be said. In fact, their "suggestion" was to not get any laptops either. I get that the majority attendees are local and probably have their own data connections, but what about us out-of-towners who might want to tweet you some kudos? Surely the world's largest database company should be able to afford that?
    • Long queues to get into a session because Oracle wanted head count. Couldn't you have set the Reader at the door and made it self-service? Many people kept leaving sessions and walking into others anyway thereby skewing your count; and this made for an annoying delay at each session.
    • Food service had some desi quirks: 
      • I had to literally fight for a second plate at lunch (I discarded my first one after my first course) because they dont give out a plate unless you have a token. Explaining that I'd given mine already and all I wanted was a fresh plate didn't go too well. The second day I learnt my lesson.
      • Tea was served at these stations with really nice looking tea cups-n-saucers stacked up. But they didn't serve us tea in them. Instead we got it in paper cups. Yeah, no clue why, or even why they had them on display if they didn't intend to give them out. Once you got your tea and took a sip as you walked away was when you realized there's no sugar. Walk back, and you're pointed to these tables with bowls containing sugar sachets, but no stirrers. Those precious bits of cutlery obviously cannot be left unguarded, so they're in the safe custody of the F&B guy - who could have told you that the first time, but of course he didn't. So walk back, get stirrer, walk back, get sugar. Then drink. I saw this happen over and over again in those two days. Its funny when you know what's gonna happen and you watch some poor sap go over this drill.
    • The Swag embargo: At the end of the conference I saw a line snaking towards the registration booth and some people emerging with a t-shirt and mug. The mug I didn't care about, but I'm a t-shirt whore. So I stood in line, not really taking note of the people in line frantically filling out the feedback form. Apparently, you HAVE to fill the feedback form, else you dont get the swag. What if I took the things and came back with the form filled out, I asked? No sir, its the rules, they said. I'll wait right where you can see me, I countered. No sir, those are the rules, they said; helpless against the all-seeing all-dancing mother directive. So I filled it out as Doofenschmirtz, Evil Genius. They gave me the stuff without once looking at the paper. 
Thus went my first JavaOne. Oracle, if you're reading: Now you have my real feedback. Looking forward to more of the good stuff and less of the silly stuff.

Update: Not finding the slides from the talks in some official place, I scoured the internets for them so I could share with my team. Here're what I've found to date:

Thursday, April 19, 2012

Of Phonewords and Carpet Jingles: Its funny how the brain works

I was talking to a colleague about how my android phone's dialer doesn't have some basic features - like the ability to paste a number directly into it (LG Optimus 500, 2.2 - ymmv).

...which led to..

Me remembering how Blackberries had the ability to dial phonewords directly by pressing Alt.

...which led me to two things:

  1. Googling if android does the same. It doesn't looks like it does. Funnily, all searches led to blackberry forums where the Alt trick is described. Isn't progress wonderful?
  2. Googling 800-588-2300 - the one number (and jingle) I cannot forget.

... which led me to..

The metafilter discussion about Empire and the empire man.

... which led me to...

  1. Wonder how I remember seeing the commercial in NJ when the post doesn't list it as one of states in which Empire operates? Maybe I remember it from my time in Florida? Man, that would make it memorable for a decade! That's some recall power for a product that I've not ever bought.
  2. Now run around the whole day in Bangalore singing both the Empire AND Luna jingles!


PS: Best quotes from the metafilter page:
The man has gone, but the goddamn jingle will never die. I hope Hauldren's heaven is plush and stain resistant, with no monthly payments til July
and:
"we're been getting some ads in the same form for Luna carpet, but I haven't the foggiest idea what their phone number is."
877-241-LUNA. I'm ashamed of myself for knowing that.
What? No. 773-202-(boop beep boop beep) LUNAAAAA. 

Wednesday, April 18, 2012

Fluent in the real world: Light Table

Today's HN story on Light Table only tells me that I won't have to build Fluent myself - someone else will, soon enough!

In the discussion that ensued, there was however, this interesting comment:
Yes, but our code was entirely in these utterly unusable changeset files that couldn't work nicely with the version control that everyone else in the entire world was using; his version still uses files under the hood. There's a team that's trying to back Monticello with Git, I believe by saving each method into its own file in part of a Git source tree; that looks promising as a compromise.
That's a good lesson to learn from, methinks. Just as "text as code and not just its serialization format" has stood the test of time, so has version control using textual diffs. Anything else will face the migration gap.

I can't be bothered to find the link, but a while ago there was a post by somebody big in the blogosphere (Spolsky or Cringely) that spoke about a bill pay start-up that solved the migration problem by allowing users to forward their paper bills directly to them to have the bills digitized and paid. The idea was that once the bills were digitized they could be paid electronically thence, but it was the first time setup that was the hump that users didn't want to go over. Take that pain away, and you got yourself converts by the droves.

Tripit does something similar with Trip Management by parsing booking confirmation emails from travel websites.

I'm not so sure such an approach will apply to developers and their tools for a couple of reasons:

  • Text is actually not a format that you want to get away from (unless you're in the structured camp)
  • Providing the gateway solution involves fixing all the tools to work with the non-text format you come up with. And you must fix ALL of them - the IDE, the debugger, the built tool, you name it.
  • Alternatively, you could change the environment to something where text input is actually less efficient. Like the Tablet. Then you have a chance.
Its a long, tough road ahead :)

Wednesday, March 14, 2012

Early thoughts on Jack

I found this writeup from 2009 in one of my umpteen storage media and thought it was evocative enough to publish. My later ramblings on the topic of Jack have been attempts to concretize the ideas rather than gaze starry-eyed at the wonder that is that ephemeral topic of a versionable language. This one is more of the latter kind than the others. There are 2 parts to the writeup: a exposition on top and notes at the bottom. The notes are actually the outline of the exposition, which is essentially unfinished. Except for some cosmetic formatting changes, I've reproduced the piece as is:

Think of an aspect. An aspect usually takes a chunk of code, and in the most general case (called the around advice), wraps around that chunk an envelope. This envelope acts as a guardian to any entry into the chunk and is not only capable of altering expected behavior of the chunk by altering its inputs, but is also capable of deciding if the chunk should execute at all.

Think of a monad. It effectively does the same, except it does it to separate non-functional bits from functional ones.

Think of an ESB. It too, does the same; except that it does it at a much higher level of granuality - at that of a service. Taking the generally understood definition that services are suitably large components that house some specific business functionality, an ESB orchestrates the sequence of operations between these components to achieve the affect of an application.

Now think of how we modify code. We do the same thing - alter the expected behavior, decide if the code should execute at all, (re)orchestrate the sequence of operations to achieve the effect we're expecting.

We are the aspect, the monad, the ESB. 

However there are major differences between us and these constructs that act to the disadvantage of humans while maintaining code:
  • each of these constructs have the feature that it describes the change it effects on the component being changed. The humans changes are available only as diffs on an external tool - the version control system
  • the human's change is at a textual, character level; not a statement/method/package/module/unit of execution level.So the change is not percieved as a change of language elements to effect it, but numerous characters being shuffled around
While this might seem like a tirade against text-based programming and possibly making a case for structural editors, there's more than that. The key problem is that the unit of execution is not identifiable. Statements in modern languages are anonymous, except by the line number of the source file. If they were identifiable, we could express something like "i had to remove the 5th if statement to after the assignment of var foo" instead of "cut line 150-234, paste at line 450". The former is what we usually do when we talk about it, but there's no direct way of enshrining that in a machine readable way.


Whats the use of such a feature you ask? Well, imagine a language that allowed us to identify the statements, and then express addition, deletion and modification of statements within itself. Something like:
insertStmt module3.class4.method1.if#5, AFTER, module3.class4.method1.letvarfoo
 The fact that the statements of code are addressable allows us to refer to them in a logical manner and the fact that the operations carried out to cause the code to change are operators allows us to maintain the change itself as code.Similar to insertStmt there'd be addStmt, deleteStmt and modifyStmt operators; and obviously we can extend the concept of a function to these operators too, so that the complete conversion from one version to another is expressed as a single operation - a changeset in code, if you will.Producing the next version of your app is no longer a snapshot activity - it can become incremental. Further, multiple changesets can be "compiled" into a fix pack of changes to produce any version at will. And all changes are expressed as logical changes, not textual deltas.

More importanly, think of what the language (or its units of execution - the statements) would have to support for this to work. They would have to become self-contained modules. Self-contained micro services, if you will, which can then be "orchestrated" my moving them to the location in the code which will cause whichever version we desire to be effected via these transformation functions. Code therefore becomes easier to change.

Now lets take it to the next level, and define these operators at all levels of abstraction/modularization that the language supports. So we'd have addMethod,addMethodArg, addModule, etc.


Notes:
  • Identity
  • modularity
  • esb-style orchestration
  • not just run time, but also statically, we can express the change occuring. which makes is amenable to machine learning.
  • automatic modularization/aggregation is the key to useful versioning.
  • forget versioning. what i'm really trying to do is to discover the steps in the computation being carried out that can be abstracted out such that an esb can act on it.
  • deriving the higher order sequence from base description
  • there are only 3 basic constructs in programming - the assignment, the goto (including the implied goto by the instruction pointer), and the conditional ie if. if is usually followed by the goto, and all instructions of the JZ, JNZ variety are combinations of the if/goto. so the real inflection point for the sequence of operations is the if. we can consider any block of code before an if as a single block with appropriate inputs, outputs and context, and similarly any block of code after an if. each if clause represents a micro service. if therefore is the micro esb. 
  • so partitioning of code cana be done based on ifs. now if we take all the ifs at the same peer level - within a method, class or package/module, (or even app) and find the same conditions being checked, those paths can be collapsed, or refactored - this is similar to the ideas in subtext. find the right partitioning of code so that it can be expressed easily. 

Sunday, March 11, 2012

Named ranges - a potentially useful concept for Jack (or any normal language)?

Consider the following code that calculates the maximum product of 3 integers possible from a given array (Java used for exposition; could be any language):

The code in the loop could probably be extracted into 2 subroutines but that would involve major interaction between the variables in this one and those subroutines. What if we were able to define the code between the recalc...end recalc comments as a named range that did not introduce a scope? Something like so:

IDEs could fold easily on this and this would only help comprehension.

Finally: Why a language construct and not a comment? Because it explicitly aids comprehsnsion. 

Thursday, March 01, 2012

Nice idea from a HN thread

http://news.ycombinator.com/item?id=3650360

...storing here aa bookmark.

Tuesday, February 07, 2012

Two ideas to improve impress.js


  1. Add a "debug mode" that shows the center and bounds of the currently selected step. This is useful in aligning 3d elements
  2. Add incremental positioning attributes. That is, step n's position is based on step n-1's. This is really useful considering the normal flow is to move from step n-1 to n. The new attributes would be "data-dx", "data-dy", "data-dz", "data-rotate-dx" and so forth.
Implementation note:
impress.js's main logic where the position of each element is determined will have to be enhanced to use the previous element's position when these incremental attributes are used. Once they're calculated, however, the rest of the logic should work as expected.

Friday, February 03, 2012

Programmers have pretty low expectations from their languages

Hacker News had a post titled "Modern Language Wishlist". I bookmarked it, perused the comments that tried to guess the language that the post was alluding to, and finally clicked over to the actual article.

While the list is a pretty good and pragmatic one, I can't help but feel that we programmers are a content lot. All the things on the wishlist were incremental improvements at best.

We build these big skyscrapers using tools that were used to build huts, methinks. Shouldn't the prime questions be:

What is the biggest "thing" that a programming language models?
And how close is this to an actual running application?

... I ask? 

Monday, January 16, 2012

Rules for life

This is pretty similar to Slots, but has more direct application, methinks.

The app will have two main actions: Jot and Find.

Jot drops you into a Slots interface. You put down a sentence and define slots in it.
That's the first half. The other half is another Slots sentence that asks the question for which the first sentence is the answer.

Eg: Sentence1: I kept [the tools] in [the bottom drawer].
      Sentence2: Where are [the tools]?

Find drops you into a Slots interface populated with Sentence2-type sentences.

Simple. But I think it can be real powerful once we add true Slots functionality and automate actions based on query results.

Yes, I know there's www.ifttt.com, but this seems much more generic and less program-mey.

Friday, January 13, 2012

Sudocode

Create a language that abstracts out the differences between multiple OSs by wrapping them around English-y language.

Example: "Run the executable ex1" will internally do the right thing regardless of OS; on Windows it will set the path etc and execute it with backslashes and so forth; on unixes it will locate it, do the equivalent with forward slashes and execute it.

Call it sudocode. It'll be the Cobol of the 21st century.

Monday, December 26, 2011

Focus considered harmful

Most of us are used to the concept of focus in modern desktop UIs - there's usually one app that has it. But what is it? Essentially the app that has the magical focus is the target of all indirect input.

The way I see it, there are two classes of input devices in a common desktop system: direct and indirect. Direct input devices can readily and immediately target any app; while indirect ones cannot. Mice are direct input, keyboards are not.

The key problem with input is that you need to decide who gets it. This was not a problem with the OSs of yore where there was just one running app at all times, nor is it a problem with the new tablets because they have only one "full screen" app running at all times. Desktops with their multitasking, non-full screen apps however, have the problem in spades. Now that I use the Mac, I'm ticked off that cmd-tab doesn't necessarily mean you'll get the app front-n-center. You see, if you'd minimized the app before, you have to add opt to the cmd-tab just before the app you want so that it will pull up the minimized window as well. Otherwise its just the menu on the top for you. Why? I'm sure there's a really super important Mac/Apple reason for this behavior but it pisses the heck out of me.

Enter the newbie, exemplified by, in this case, my parents. My parents cannot figure focus out. They will painstakingly fire up an app, and start typing in the hope that Windows will magically figure out that where they're looking at (or were looking at before looking down at the keyboard) is where they want the keystrokes to go to. Of course, this is without having brought the cursor to the text field in the first place so all that input does is bupkis (Where do keystrokes go when typed without focus, I wonder). And if they'd actually remembered to "make sure the blinking line is at the user name field", McAfee decides to popup a message that silently steals that focus away.

Focus is an implementation artifact and a leaky abstraction at that. The currently available approaches are:

  1. Its a non-issue: This is what tablets do - you dont need to worry about who gets the input if its completely clear that there's always only one such target.
  2. No more indirect input: Again, this is what touch devices do; you don't need to pick a target when the act of providing input actually selects the target.
  3. Provide a switcher: This is the Alt/Cmd-tab solution. Provide a way to switch the target of the indirect input. However, as we've seen above, this has problems.
Would it help to be even more explicit about who gets the keystrokes than just highlighting the app's title bar? Would it help to avoid modal (and non-modal, but focus-stealing) dialogs?

Is there a better way that tells the user that any indirect input will be sent to a particular app? Or, alternatively, is there a seamless way of "figuring out" the intended target? I can think of two promising avenues:
  1. Computer vision is slowly getting better to the point where head tracking using web cams is actually possible. Can this reach the resolution required to figure out the app the user is actually looking at? Lots of false positives in the future down this path, but definitely its a head-on approach at the problem.
  2.  No more leaks in the abstraction: This is a cheaper solution to computer vision and essentially involves ensuring that:
    • There're separate "user controlled space" and "system use" space and never the twain shall overlap.
    • User controlled space will always have one app that has focus. It will lose focus only when the user wills it to. The action to switch from one app to another is atomic and results in the other app getting focus. This will be true even on tiling window managers.
      • Dialogs and other such UI elements that halt the app before user interaction will work as before.
    • In addition to serially switch the target of input using Cmd/Alt-tab there will be a key sequence to switch between apps - maybe like the Ctrl-Shift-F1-7 sequence that Linuxes have for the default ttys.
    • System use space will be read only, except for some suitable way to scroll through messages.
Todo: figure out how to deal with system messages that require immediate attention.

Functional vs Implementation Models

Our apartment building has a down ramp from the elevator to the basement level. My kids usually run down this ramp, stopping just short of the driveway for cars exiting the basement.

Of course, they stop short because they've been told that "Cars are coming"; or as my under-2-yr-old says "because car comin".

The other day he ran down the ramp as usual, stopped short of the driveway and chanted his usual "because car comin"; then paused to look, said "Car no comin" and proceeded to walk across the driveway.

I'd almost started to blurt out the "Look to your left, look to your right, then look to your left again.." routine in an effort to instill traffic safety at a early age (I know, parents) when he said "Car no comin". Since he did that, I kept quiet.

It then struck me that his way was much better than the "Look to left routine" because he's formed a mental model of when cars come and when they don't. Once he has that model, he's free to decide what to do: cross the driveway, stay put, or whatever.

The problem with the routine is that its prescriptive; and therefore - by definition - too restrictive. How would a child's mind associate such a routine to the situation? It seems to me there are quite a bit of wrong associations that can be made to the one right one:

Right:

  • When crossing a driveway, do the routine for your own safety.

Wrong:

  • When you run down a ramp, at the end do the routine
  • When you stop, do the routine
  • When daddy shouts as I'm running down a ramp, stop and do the routine
More importantly, the value of looking left again will be completely lost on a child IMO. Wouldn't it be much better if he arrived at that step by himself?

Thus too, it seems, with software. As long as we build in the right functional models, it should be easy to instill the right implementation model; and by extension - modify or maintain it.

Wednesday, December 14, 2011

OS.next

  • Hardware Compatibility:
    • Run on x86, AMD
  • Software Compatibility:
    • Support Win PE, Unix executables and Mac executables natively.
  • Boot loader:
    • Support booting from usb, sd card
  • OS:
    • Ability to have the whole OS on portable media (eg SD card) if so required
    • File system:
      • Tagged storage instead of directories
      • Sensible file system hierarchy that combines win/unix/mac concepts
      • FS shadowing for legacy executables so that they think they're still "at home"
      • Ability to move /home to an sd card if so required. More generically, ability to configure OS to have any "standard, should be on boot volume" directory elsewhere.
    • Memory:
      • Nothing special as of now.
    • Disk:
      • versioning of files built in. ie some kind of journaling file system.
      • Security built in - encrypt a file, directory, mount point or whole system.
    • UI:
      • Light, capability-based UI framework.
      • Support for UI paradigms such as radial menus - controls that use Fitts Law better, basically
      • "Back to the place I was before" mode for people not ready to make the plunge
      • Keyboard support for everything. EVERYTHING!
    • Software in general:
      • Solve the package manager/installer problem for good
      • Solve the registry vs 1000s of config files problem for good
      • Rolling versions of the OS, easy revert back to previous version
      • Tool to see files changed due to any install/ version upgrade built into the OS
    • Shell:
      • normalization of options and formats across at least the busybox commands
      • autocomplete for command options got from info/help files
      • oo-ize commands (ie dir.ls instead of cd dir;ls)
      • Structured editing of the command line a la zsh
Updates to this post as I think em up :)

Update #1:

Show a schematic box diagram of the computer system as it boots up and have icons (or text) depicting the status of each box in the diagram.

This is in lieu of the "screens of flying text" a la linux or the "startup progress bar that never quite ends" of windows/osx

Also missed out adding my idea about intelligent workspaces, but it should be in this list.

Tuesday, December 13, 2011

Codermetrics: A review

I picked a book called Codermetrics(book, website) yesterday - one of those impulse purchases because I liked what it said on the cover. I've not finished reading it completely, but I went through most of the meat of the book and its an interesting concept.

The core concept of the book is simple: Measure a developer - and by extension the development team and organization - in the same way the world measures sports persons, teams and organizations. The book's name is a play on Sabermetrics - which apparently is all the rage in Baseball these days as far as metrics go.

After a somewhat drawn-out beginning, the bulk of the book is focused on defining metrics for developers, teams/organizations and their combination. The developer metrics measure how good a developer (called coder throughout the book) is at advancing the team towards the org's goals (Offensive Impact); how good s/he is at preventing or avoiding the things that detract the team from the org's goals (Defensive Impact) and so forth. Specific attention is paid to work done beyond the call of duty (Pluses) and help given to others (Assists).

Next, the organization is defined in terms its successes (Wins), failures (Losses) and position relative to competitors. In each case, the end of the chapter gave some examples or archetypes that arise from specific combinations of the relative values that the metrics may take, for eg, what separates a junior coder from an architect, or what separates an enterprise company from a startup.

The final set of metrics - called Value metrics - were the most interesting. While the previous sets of metrics required some input data from the real world, these ones were derived from other metrics and were intent on exploring the contributions of individuals factored into the larger scheme of things in the organization. Terms like influence that a particular developer has on the team and company, the teamwork  demonstrated etc become measurable things!

The final section of the book has some advise on how to go about implementing such a process in an organization.

Overall, the concept of the book and the simple language used to explain the concept is a win for the book; as is the author's repeated disclaimers that we should heed to his overall construct, not the specific metrics that he provides. This is sane advice and a welcome change from the typical prescriptive nature of texts on metrics.

I've started trying this out on one of my teams which is particularly feeling the pain of under-delivery. Highly recommended.

Sunday, December 11, 2011

Information Density and textual vs visual

I was reading the Wikipedia page on Information Theory as part of my read the wiki project, when it struck me that there's possibly an objective way of measuring the effectiveness of text vs visual programming languages using Information Theory.

The central concepts (whose math I'm admittedly unable to fathom) are those of information, information rate, entropy and SNR. One of the age-old cases for text-based programming ( and therefore against non-textual programming languages) has been that it has very low SNR and the "information density" is high for given screen real estate.

Is that really true, though? How much "noise" does syntax add? On the other side of the spectrum, I've seen infographics that assuredly deliver more "understanding" in the given screen space than the equivalent textual description. Is it possible to design an "infographic-style" programming language that packs more power per square inch than ascii?

It would be interesting to do some analysis on this area. 

Descriptive Drawing Language

I have been thinking of the way by which UI mockups are created. In most Visio-style applications - which are the mainstay for this kind of thing - there's usually a pallette of known "widgets" that can be dragged onto a canvas and put into place using the Painter's Algorithm. The good part about such an arrangement is that they allow easy creation of UI mockups, and thereby expression of the look of the app-to-be.

This works when the UI framework is an established one and the set of widgets is known. But what if you're trying to create a new UI framework and you want it to be completely (or sufficiently) different from the current pack?

The other problem I see with the current way of doing things is that UI mockups/wireframes are still woefully disconnected from the rest of the development process: the designers build their mockups, pass it onto the graphic artists who finish up the design with dimensions, colors etc and finally deliver a finished design (typically in html for webapps, most probably psd for others) to the developer - who now has to tear down the carefully crafted design to get at its constituent pieces.

I was thinking of an alternative that's inspired in part by Graphviz.

Imagine being able to draw a picture by describing what it contained. So a description of a wheel would be something like:

wheel:
    circleA: circle
    circleB: circle
    line1, line2, line3, line4: line

    circleA contains circleB
    line1: pointAt(circleA, top) - pointAt(circleB,top)
    line2: pointAt(circleA, right) - pointAt(circleB,right)
    line3: pointAt(circleA, bottom) - pointAt(circleB,bottom)
    line4: pointAt(circleA, left) - pointAt(circleB,left)

The syntax is obviously very handwavy at this point, but hopefully the intent is clear:

  • You describe the scene, not paint it
  • You define relationships between the objects not place them in specific positions. 
  • You provide dimensions only if absolutely required, else the system figures it out for you.This is obviously not intended for a "to scale" diagram; although I can already imagine a Graphviz style mode that outputs the same format as the input - only annotated with dimension information that can further be processed to make it to scale.
The advantages I see with such an approach are:

  • Diagramming becomes descriptive. It could easily have a Canvas backend as a GL one, but the scene would be the same
  • UI wireframes can be built "from scratch" easier than before and thus support early exploration of new ways of expressing design intent
  •  UI wireframes become instantly accessible to version control
  • Developers can literally write diagrams!
Design notes:

  • There will obviously be primitives - line, circle, arc etc come to mind.
  • The system will allow creation of compound objects from simpler ones and primitives
  • Spatial organization in a 2D plane will be represented by a logical grid, or using predicates such as "contains", "to the left of", "to the right of" etc
  • Overlapping objects will be represented by a Z-ordering (as in most such tools) using predicates such as "in front of" "behind". Alternatively, the system could allow depiction of each "layer" in the Z-axis as a slice within which no front/behind predicates are allowed
  • Objects can have "anchor points" defined which allow other objects to use those specific points in other areas of the script.

Sunday, December 04, 2011

My Bowerick Wowbanger homage... aka the wikipedia breadth-first read

I've been meaning to start this for quite a while now.

If you've read the Hitchhiker's guide to the Galaxy, you'll probably remember Wowbanger the Infintely prolonged who takes upon himself to insult every living being in alphabetical order just to keep himself busy?

Well, aside from the immortality, the need to keep myself busy and the insulting bits, this is my Wowbanger-esque project.

I've started reading the Wikipedia at the Computer Science page, and I aim to keep reading it in breadth-first fashion from that page onwards. I hope to read one page every day. Along the way, I'll track my course with a graphviz graph that will eventually be a map of the wikipedia subtree (subgraph?) that is rooted at "Computer Science". Simple rule for picking the next page to read: I'll pick the one that I know the least about.

I've also created a wikipedia account, should it come of use somehow. I'll look to see if I can fix simple typos and such - as they arise; and if there indeed are pages that are stubs that I can fill out, I'll try.

Why
Because one my (admittedly naive) goals in life when I was still studying was to "know everything there is to know about computers". A decade and a half later I still remember it, so it must mean something. I figure this is the least I can do :)

PS: Yes, I did think about what I'd do if a page I'd read already changes. I dunno. We'll see how it goes. Even Wowbanger did Arthur twice :)

Thursday, December 01, 2011

I visited JavaFXville and all I got was this post

I tried to write an FLV player in JavaFX today.

I tried very hard.

I didnt get very far. Or when I did, it was not obvious how far I actually had.

It all started with me looking for a trustworthy way of downloading Youtube videos - you known, the Randy Pausch kind. To share with my team easily.

Googling for Java and FLV showed that JavaFX spoke FLV natively. Awesome. I'd heard enough of JavaFX in its previous incarnation as F3 to think it was worth a shot for a weekend project. Not to mention this is the closest that one can get these days to simple declarative GUI.

Of course, I'm sadly backed up on the news front. Oracle, in its infinite sagacity, decided that the declarative DSL was to go; replaced by a Java API. So what looked like a simple sample in the 1.3 documentation morphed into this beast of boilerplate in 2.0.

But wait, there's FXML - the Oracle blessed replacement for FXScript, right? It IS XML, but its still declarative, right?

Wrong. Conjuring up the right incantations to get MediaView instantiate a Media object is obviously beyond me. I've never liked XML as a UI description language and this abomination only stokes that feeling.

So I give that up and get back to the POJO version; which works for the sample FLV they provide.

So I proceed to download a Youtube video using a Sourceforge-based downloader (also Java) and the bloody thing doesnt load. Maybe the downloader is broken?

I dunno. The code looks like its doing multiple passes on the embed element's params; and justifiably so because that value's a snakepit of multiple URL encode sessions. Security by obscurity, perhaps?

Ugh.

Its 4 in the AM, and all I have to show for my efforts is this blogpost.

Final nail in the coffin: I now read that JavaFX has spotty support for Linux. The whole intent of this was to create something in Java so that I can share it with my linux-using team.

FML.