Thursday, April 05, 2012

Busy, busy,busy!

Well it's been quite a week (year?) with family issues taking up much of my time. I now have a little time to sit back and think about my HA. My mind has been racing with many of the latest technologies (Arduino, Wi-Fly, SVG, AJAX, Groovy & Node.js). I've been playing with 2 particular technologies, Groovy (a super set of Java) and Node.js (Javascript).
Node's current advantage is that it uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices. I've been playing with Node.js and it is very easy to use. Basically much of what I need written as already done. It has plenty of excellent examples (and I've been able to steal plenty of ideas :-D ). I've also found a BASIC interpreter that I can munge in my user language (which I've called Npress). Node's major weakness is the Javascript. While I can write interesting code and take advantage of the javascript interpreter I can't really create object oriented code (just try to override the ++ in Javascript). There are places where object oriented code can really make this easier. Also I worry that I'll need to deal with blocking I/O and I won't be able to easily deal with this using node.js (we see the same problems, no concurrency & not object oriented, in Mr. House & Perl).

What I have in mind is a simple design for gHCS. I think I should be able to implement these ideas with node.js. The ideas come from both Steve Ciarcia's HCS II and Mr. House. My concern is the non-blocking I/O portion of my code in node.js, although this is a minor issue in Mr. House. There are many opportunities to use the event based portion of node.js with remote devices. I've already created the timers portion of gHCS and I've found a BASIC interpreter that I can munge into the user language. The user language is a rather simple if/then/else language with support for timers, variables, string handling and math. I have thoughts for expanding it a bit but not too much. It needs to be kept simple for non-programmers to use (this won't be an easy task). At the same time I need to be able to support developers that will deal with hiding the complex portions behind a simple facade. That's where the object oriented code goes a long way.

Groovy/Java is a better language to deal with the overall design than javascript as Groovy has better support for concurrency and supports events, object oriented programming and Groovy code to be run from its runtime compiler (MH/Perl has eval support, as does Node.js). Of course there's nothing like node.js written for Groovy yet and I may have something simple written with node.js in a few weeks, we'll see. In the meantime I'm trying to see if I can learn enough about Event handling with Groovy to accomplish the same thing as I am creating in node.js. The reason I haven't made much headway with Groovy is that when I search on Java/Groovy and Events I end up finding tons of framework, which don't meet my needs, or graphics, which is heavily event based but fails to deal with any other type of events. I, unfortunately, lack enough Groovy/Java knowledge and need to find some examples so I can figure out how it all works. Then I can sit down and code it.

Now, I'm not ignoring the dozens of HA projects out there. The one reason I've not joined them is that I want something a bit more simple. I don't want an HA project whose initial code base is on the order of 10 Meg of storage before we even add the first device. I would love to see this project actually fit on something as small as a NSLU 2 or a Raspberry Pie. I currently have a spare NSLU 2 & several Plug computers which I can put into use quickly.

0 Comments:

Post a Comment

<< Home