Thursday, January 29, 2015

Well, I haven't written a post for many years, but hey, maybe it's time to start writing again.  As long as you don't mind anything too carefully thought through, time is of the essence...  I am not sure who I am writing for anyway, besides myself :)

Friday, November 23, 2012

Tax the poor

Everyone keeps saying how we don't want to raise taxes, but actually taxes are being raised all the time.  Because cities are no longer getting enough revenue from the state and the federal government, they are finding other ways to bring in revenue.  One particularly lucrative source is traffic tickets.  I recently got a ticket in a spot that is marked (very poorly) as no stopping from 3-7 on weekdays.  That cost me $64.  A moving violation costs $500.

What particularly irks me about this is that this charge is the same for anyone, regardless of their income.  At least with income taxes you pay as a percentage of your income.

I heard that in Sweden (I believe it's Sweden), the amount you pay is a percentage of your income.  This means that a rich person is just as motivated to abide by the law as a poor person, because the monetary pain experienced is the same.   I would love to see something like that implemented here, except of course the rich run this country...

Wednesday, October 17, 2012

HTML5 Dev Conference Trip Report

The last two days i attended the HTML5 conference at the Palace Hotel in San Francisco, and I thought I'd share some of my takeaways.


I took notes at the sessions I went to and put them into an Evernote notebook, published here:


Here are the major themes I saw out of the conference:

- Web development continues to be way harder than it should be.  Lots of discussions on improving productivity, tooling, testing, etc.  Stacks and stacks of APIs and libraries and tools and it keeps churning.  It's amazing how complex this world continues to be, having cut my teeth on very simple MVC thick client environments in the old days of client/server.

One tool that looks to have the right approach to improving web development is AngularJS.  They understand the value of declarative, they understand the old thick client architectures that have worked so well: MVC, data binding, dependency injection, etc.  Looks very promising.

I also really liked the tooling I saw where in one window you are editing source, and *as you type*, the browser is highlighting the section you're editing and refreshing itself as you change data, behavior and styling.  It's seriously close to WYSWYG development.  I don't quite know how it works, but it's awesome.  Generally called "Live Editing".  Check it out.

- HTML5 is going through growing pains.  There was a good talk by someone from Mozilla about where HTML5 is and where it should go.  He was good at identifying issues, not so good at identifying solutions.  I loved his one example API, there is a method "canPlayType(mediaType)" which returns null, "probably" or "maybe". :)  See my notes on "HTML5 Broken Promises"

Another good point he made here is, you need to design systems that degrade gracefully when certain HTML5 features are missing.  This is an aspect of responsive design (see below).  One quote he had which made me laugh: "The way you tell something is HTML5 is, if you run it on IE and it doesn't work, it's HTML5".  He used the example of an escalator vs. an elevator.  If an escalator stops working, it's still functional as a set of stairs.  A broken elevator is just a small hot room that doesn't make any sense.  So he was encouraging us to build escalators, not elevators.

- In a caching talk, a reminder to be explicit with caching directives using cache control headers.  Caching has the biggest impact on performance, over network speed and Javascript interpreter.  50% of the top 200 sites don't use cache control headers.  Another interesting point - a large percentage of users come in with a completely cold cache.  Reason suspected: cache corruption or other bad behavior forces them to regularly clear their cache.

- EVERYONE is getting impacted by mobile.  There were very interesting sessions on how to work with multitouch, and a general buzz was that "responsive design" was the New Thing - basically your app adjusts elegantly to the screen constraints of the current device.  

One thing I thought was very interesting were the new Windows 8 devices which are many creative combinations of desktops and large multitouch devices.  The important takeaway: right now we usually check to see if a device is multitouch or pointer, but that's no longer valid - devices can be both; you can even have mouse events and touch events happening at the same time, and have it mean something.   Microsoft is proposing a standard event API/model for multi-touch that looks pretty good.

- Lots of demoing of rich media experiences, including capturing media sources from the person's machine and integrating it into your web app.  I think this is probably because it demos so well; not clear of the usefulness.  Two examples: capture your camera, and when you swipe your hand, you go back and forth in pages in a document/book.  Really nice for dirty hand work with tablets.  Another example: capture your camera, and it detects your fingers, and use your fingers to play a xylophone.  But these are just "cool demos"  The question is, how might we use these kinds of ideas to improve engagement with your site.   Hm...

Cheers,

David

Thursday, August 23, 2012

Time to stop feeding the beast...

I've been thinking a lot about the frustration many of us feel towards the way our government and our corporations are behaving towards obvious long-term critical issues such as climate change - corporations actually hiring people to sew doubt into the message so that the status quo will be maintained.

The thing it, corporations can't do anything different.  A corporation is measured by its stock price and earnings, quarter by quarter.  If the leaders of a corporation do not make decisions that optimize earnings they are fired.

This means that a corporation can not take any actions motivated by other concerns, particularly longer-term concerns such as the impact on the environment say 20 or 50 years from now or the impact on society or long-term health of populations.  Corporations are not structured that way.  We can't really blame the people in charge of these corporations.  If they did not behave this way, they would be moved aside and leaders who do focus solely on the bottom line would replace them.

I suspect that many corporate leaders would like to behave differently, would like to transform a company that truly takes long-term impacts of their decisions into account, but they just can't - if they did this, they would be fired.

What drives this short-term approach?   Wall Street.  Mutual funds are measured by their performance on a quarterly basis.  And why are mutual funds this way?  Because people leave mutual funds who aren't giving them positive performance every quarter.

So who is really to blame?  You and me - the investors.  If you are investing in mutual funds or in stocks and buying and selling based on quarterly performance, you are the core of the problem.

If we truly want to create change, we need to address this core problem.  Personally, I am getting out of mutual funds.  I am canceling my 401K and moving to a self-directed IRA, and I work to make long-term investments in companies I feel good about.  I am tired of feeding the beast.

Friday, June 08, 2012

Advanced queue policy acronyms

We already know about FIFO (First-In First-Out) and LIFO (Last-In First-Out).  Over the years I have encountered a few more queue policies:


FIFS - First In Front Seat

LIRE - Last In Rotten Egg
LOTL - Last Out Turns off Lights -- applied at failing companies


Any others?


Tuesday, June 05, 2012

Neti pots, free will and destiny

My son has been struggling with allergies, and is up very late at night sniffing and sniffing trying to clear his sinuses.  He gets very unhappy and miserable.

So I did some research, and found out that something that can provide a lot of relief is a Neti Pot.   This is a very simple thing, a pot of water with a spout.  You fill it up with distilled water and a saline solution, and then gently pour the water through one nostril and it drains through the other.  All sorts of gunk comes out this way.

I showed him the video, showed him how happy the little girl was who used this.  He said sure and we got the pot.

But when I tried it, it was just too uncomfortable for him to have water going up his nose.  So he won't use it, even though he is so miserable.  I let him make that choice, but I thought it was funny how he couldn't see how much happier he'd feel if he just put up with the discomfort of the Neti pot.

Then today I was thinking about all the things that make me unhappy - old stored up emotions or habits or physical ailments - and I know there are things I can do to make them better - certain changes in habit or lifestyle or diet.  But I get nervous.  Those things aren't always fun; they can even be uncomfortable or difficult.  I know they'll help me feel better.  But for some reason I prefer the pain I know to the pain I don't know.

Luckily, the Universe is patient.  I won't be forced to make those changes.  But I will experience the consequences of my decisions.  To me this is the mystery of free will in God's universe.  Alternatives are offered.  Choices are made.  Very often we hold on and hold on as long as we possibly can.  But the consequences of our choices are experienced.  So there is free will, and there is destiny, the consequences of our actions.  In this way, very naturally, growth occurs, and (inch by inch) we learn how to live harmoniously in this world.

Thursday, May 24, 2012

Ruby on Rails, sure, but at some point, you need Java

For the past year I've been working part of my time with Ruby on Rails.  I had heard great things about Ruby on Rails and was excited to get a chance to work with it.

Over the time, I've formed some perspectives about RoR that I thought I'd write down.

First of all, I'm working with an older version of RoR, 2.3.11.  Upgrading to Rails 3 is a Big Project that our team has not been ready/able to take on.  So some of these opinions may be out of date.

My overall first impression - wow, this is really productive.  I can make quick changes to web pages very fast and turn around new features quite quickly.  I really do think that's the strength of Rails.  So I think it's a great choice for an early startup that is quickly trying to get a minimum viable product to market and then start iterating very fast as the company adapts to what it learns.

However, there is a certain point at which the strengths of RoR become weaknesses.

For example, it is easy to rely on Active Record to provide a very simple, fast, easy abstraction to the database.  But when you start scaling up, you can be slammed by the incredibly inefficient ways that ActiveRecord talks to the database.  So you find yourself writing more and more raw SQL to try and process the data faster, and get the performance you need.

Then there's the dynamic nature of the language.  You don't have to mess with the verbose nature of static type definition or time-consuming steps of compilation and deploy.

But the result of that is you end up working without a net.  You just can not tell whether a change you make is going to break something, because you get no warnings from a static compiler telling you you're breaking a contract somewhere.  We have classes with tons of methods that *seem* to be obsolete, but nobody dares to remove them because you never know if some code path, in production, is going to call that method and cause a stack trace.  Even if you search for the signature everywhere, that is no guarantee, because someone could have built up the method call using string concatenation and invoke it using runtime evaluation.

The other problem is the tools just can not reliably do global refactorings like moving classes around or renaming things.  This severely limits your ability to adjust and rethink your application as the design reveals itself more and more or your requirements change.

The argument is that to address this you write lots of unit tests, and that gives you the net you need.  I think unit tests are invaluable, but I really don't like having to basically write a compiler using  unit tests.  I'd rather let the compiler do that for me.  As much as everyone says they are writing unit tests, can you really rely on that?  If you can, well, you must have a collection of very disciplined programmers on your team.  I personally have never seen that...

Finally, the performance of Ruby just can not hold a candle to Java.  Every time we migrate some logic from Ruby to Java, the difference in performance we get is quite astonishing.

So, here are my thoughts about how to go about building a system...

Fine, use Ruby on Rails to whip out your initial product quickly.  But have in your plans moving things over to Java as things stabilize and specific services begin to reveal themselves in your design.   This means, in particular, I would implement a domain layer between the front-end code and the Active Record models.  This allows you to migrate the underlying implementation of the domain layer from Active Record to backend services written in Java.

An alternative that I really like as an approach, but have never had the opportunity to try, is to write only services on the server side, and write all the UI using one of the new client-side Javascript UI frameworks like backbone.js.

Java has the performance, tools, APIs and stability to be the powerhorse of mature, highly scalable, robust middle tier infrastructures.  Ruby really can not hold a candle to it.  Having this kind of infrastructure becomes essential as a company scales up and matures, and customers begin requiring a high quality of service as well as new features.

In general, if you use a domain-driven design, where you focus on building a domain layer that is well thought through, and then provide APIs to the view and third parties, and pluggable interfaces to your lower-level services, you have the foundation for an architecture that can move through the evolution from a quick Ruby on Rails app to a highly robust, scalable system with numerous independent services written in a strong, high-performance language like Java.