Skip to content

RIAs are a platform play, AIR is a platform of standards

15-May-08

RIA == platform play

Neal Ford has a great post here highlighting how the new enthusiasm for Rich Internet Applications is an attempt by the big vendors to capture the kind of platform marketshare that the Win32 API had back in the 90’s.

Which brings us around to the current hotness, Rich Internet Applications (RIA). Ever wonder why Adobe and Microsoft are slugging it out for that space? And Sun is running along behind with JavaFX saying “Wait, we want to fight too!”. It’s the new platform play. We’ve dealt with the pain of writing good looking web applications so long that when someone comes along and shows pretty pixels, we swoon. Yes, you can create beautiful applications using Silverlight and Flex. And Sun showed some awesome demos of JavaFX at JavaOne. But, if you write an application in one of those tools, you’ve bought a platform. You are no longer in a standards space. You can’t take a Silverlight application and port it to Flex without a rewrite. Same goes with JavaFX. Whoever wins the RIA war has the new dominant web platform, just like Win32 back in the day. Sounds like a good reason for big companies to pour resources into the effort.

Bringing up that Web-based applications are standards based highlights the unique position that Adobe has with it’s AIR platform. You can use FLEX/Flash to create your RIA in AIR, but you can also use web standards markup and script to create an RIA. But even if you use Flex, the compiler and SDK are available under the Mozilla Public License. JavaFX will be available under the GNU General Public License'>GPL once it is released. Adobe even opened up the Flash player. My point being that even though there isn’t a standard in place for those technologies, the format is open enough and allows people to build their own implimentations of those technologies.

links for 2008-05-14

14-May-08

The state of the software development crisis: status quo

13-May-08

I found this comment on Reddit and it’s worth repeating. I don’t usually post someone else’s words as the entire content of my post. But this really sums up my feelings about the term “software development crisis”.
http://reddit.com/r/programming/info/6j1mf/comments/c03zf02

I’m sorry, but this is just nonsense.

People are forever coming along and proclaiming that software engineering is in a state of crisis. And always their reasoning is that (other) programmers aren’t smart enough.

They, of course, are special magical code gunslingers with superhuman intelligence, members of the top 5%. (Surely software engineering is blessed to have 90% of its practitioners located in the top 5%!)

But the truth is that there is no crisis, and there never has been. The only problem, and the reason software projects keep failing, is that of unrealistic expectations.

Software is hard. Really hard. This should not be surprising to anyone who understands that it is really the field of assembling instructions for doing… anything. Anything that people want to get done. It’s sort of a meta-field that encompasses almost all other fields, with more being added every day.

Of course it’s hard. The only real question is why people consistently underestimate its difficulty, especially why they underestimate the difficulty of any particular software engineering task.

I think there are a number of reasons for this:

1.

“It fits in the little box, how big can it be?” Humans, particularly those who aren’t technical, have a tendency to judge difficulty with their eyes.
2.

“It’s just a word processor.” Everyone understands what they are building, what the set of instructions is supposed to do, and they probably know how to do it by hand, albeit very slowly. They tend to assume that writing the software is just a matter of telling the computer to do the same thing, but faster. What they do not realize is that they don’t really know how their brain works at all, and that all the details which they can just leave to their giant neural net when doing it by hand, have to be figured out and brought consciously to the software.
3.

The Cult of Smart. Programmers, on the other hand, have figured out that software is complicated, and that being smart really helps; in fact, nothing is a substitute for it. This causes them to emphasize it, convince themselves that they have an abundant amount of it, and to convince themselves that results are not the result of them learning about problem domains, and building better and better versions iteratively, but just the inevitable consequence of bringing their enormous brain to bear. This leads to things like the “Agile Methodology”, as in “I’m so Agile I don’t need a Methodology.” Instead of realizing that you have throw one away (usually more like ten), they think they can be so magically smart they don’t have to.
4.

Expectations based on hardware. Chips are square. A linear decrease in CMOS transistor size results in a quadratic increase in the number that can be packed on a chip. Code is linear. A linear decrease in the amount of time it takes to produce X amount of code is merely a linear increase in the amount of code that can be produced. This results in an ever-widening design productivity gap, where capacity forever recedes away from our ability to exploit it. We can waste some of that excess capacity to save programmer time (this is why high-level languages have an expanding role in the field), but this is never going to go away. It isn’t that software is inherently blighted. It’s that hardware is inherently blessed.

Dealing with comma delimited data in a database column

13-May-08

For various reasons, developers through the years have decided to store lists of data as comma-separated lists. Most programming languages include a split() function that allows you to break apart a list of data using a specified character. T-SQL does not.

I don't remember where I got this split function from. I know I didn't write all of it from scratch. But basically what it will do is take a delimited list of data, split it apart, and return a table where each data element is associated with the identity value you pass into the function. This is very useful if you just want to get the values for a single row.

CODE:
  1. CREATE  function Split
  2. (
  3.     @list varchar(8000),
  4.     @identityVal int,
  5.     @SplitChar char(1)
  6. )
  7. RETURNS @RetVal table
  8. (
  9.     id int,
  10.     Value nvarchar(1000)
  11. )
  12. AS
  13. BEGIN
  14.     WHILE (Charindex(@SplitChar,@list)>0)   
  15.     BEGIN
  16.         Insert Into @RetVal (id,Value)
  17.         Select @identityVal,value = (ltrim(rtrim(Substring(@list,1,charindex(@SplitChar,@list)-1))))
  18.         SET @list = Substring(@List,Charindex(@SplitChar,@list)+len(@SplitChar),len(@list))
  19.     END
  20.     INSERT INTO @RetVal (id,Value)
  21.     SELECT @identityVal, ltrim(rtrim(@list))
  22.     RETURN
  23. END

So what happens if you are trying to build a view or a report and need to split apart multiple rows. You can iterate over the rows in the table you want to flatten out and call the split function for each row, passing the rows PK into the split function.

CODE:
  1. create function fnFlattenMyTable
  2. ()
  3. RETURNS @RetVal table
  4. (
  5.     PrimaryKeyId int,
  6.     MyListValue varchar(100)
  7. )
  8. AS
  9. BEGIN
  10. Declare @PrimaryKeyId int
  11. Declare @MyListColumn varchar(6000)
  12.  
  13.  
  14. SET @PrimaryKeyId = (select MIN(PrimaryKeyId ) FROM MyTable)
  15. WHILE @PrimaryKeyId  is not null --main loop through MyTable
  16. BEGIN
  17.     Set @MyListColumn = (select MyListColumn from MyTable where PrimaryKeyId  = @PrimaryKeyId )
  18.     insert into @RetVal(PrimaryKeyId , MyListValue )
  19.     select id, value from [Split](@MyListColumn , @PrimaryKeyId , ',')
  20.     SET @PrimaryKeyId  = (select MIN(PrimaryKeyId ) FROM MyTable where PrimaryKeyId > @PrimaryKeyId )
  21. END
  22.  
  23. RETURN
  24. END

This function uses one of my favorite sql tricks. It uses a while loop to avoid having to declare a cursor . The logic is pretty simple, on each loop, select the lowest value of the PK in the table that is higher than the previous PK. That's the roundabout way of saying, "Select the next highest PK from the table".

Right now, this function is hard coded to flatten the table "MyTable", but it could be re-factored into a general use function.