Today is a good day to code

Trials and Tribulations of a PHP Interpreter / Compiler Writer

Posted: June 7th, 2009 | Author: | Filed under: android, java, Programming | Tags: , , , , , , , , , | No Comments »

For the past couple of months, I have been struggling to write a PHP interpreter for an upcoming Android version of Mides.  The tokenizer was fairly easy, building the Abstract Syntax Tree was relatively uncomplicated, but now we come to actually writing the executor.  This is giving me pause.

I totally understand why Joel Spolsky says that there are two classes of programmers, one class that sort of hacks their way through life, and another that writes compilers for fun.  I guess I am trying to blunder my way into the latter class.  At first, it didn’t seem to be so difficult, but eventually it has gotten so hard that sometimes I feel like just dropping the whole thing entirely.  However, when I feel like bashing my head into the desk, and / or throwing my MacBook Pro out a window, I know I am on the right track.  That is how I felt when I was trying to learn Java and Objective-C a few years ago, or attempting to understand domain modeling as it pertained to Object Oriented Programming, before understanding Object Oriented Programming.

I guess these are just things that we all must get through, I also see why most CS majors don’t every actually finish their compilers.  I, however have a dream that I can develop web applications without being encumbered by any sort of connections from my handheld.

The first part that slowed me down was that I was trying to approach the executor by compiling the program to opcodes and then running them against the system, sort of like the asm function in C.  That won’t work with Dalvik, at least not in an elegant way.  Then I asked this question on StackOverflow, and the answer made me think;   I don’t think I quite got it immediately, but now I understand.  It basically comes down to a large hashmap of keys ( variable names ) and their values, ( the statements to evaluate into them ).  OK, I get that, but the new problem I am facing with the top-down recursive descent parser is how to handle classes and functions efficiently.

I realize that generally a class is just a new hashmap of values, scoped to a variable handle in the global hashmap, a function is similar in that it has its own scope that is not shared with other objects in the main hashmap.  The recursion here can make your head hurt.  The problem I am facing now is that if I have a statement ( series of tokens ) mapped to a variable, how do I handle, a ) parameters, and b ) not re-interpreting the tokens each time the class is instantiated.  Another issue is how to keep the scope of a single instance different than another instance, unless there is a shared static variable in the hashmap between them.  I am looking at V8’s source to try to understand the concepts behind their VM.  I think that is how they boosted speed so greatly for OO based JavaScript applications.  They must only parse those tokens once.  There are all kinds of bugs I can see introducing into my fledgling interpreter by doing that.

I guess what I am understanding is why PHP has taken more than a couple years or more to get where it is today, why Ruby still has quite a few oddities to the language, and why Python basically needed a complete rewrite for version 3.  This is not easy stuff, but nothing worthwhile is.  I have never considered the possibility that this may not fully work in any practical sense.  When I do release the Android Mides, the PHP parser functionality is likely to be beta.  I did look at the code once for Quericus, but without some sort of object diagram, I can’t really understand what I am looking at.  Much of the code is mixed up with the server code so it is difficult to figure out what is doing what.  I have read a few pages of the Mak book and I’m thinking about buying it just to see how he implemented the parser, but I am not sure it will do me any good.

I may consider creating my own language for use with Mides, and then compilers that generate PHP and Ruby source code from it while I work on versions for Apache, Nginx, etc… In lots of ways I think it would be much easier, and I could offer type checking and other things from compiled languages that help build more robust code.  I would maintain the PHP documentation that is present in Mides, and naturally you could FTP up the code to your server and test it there.  But I think that would be copping out, and I don’t like to have something like this beat me.  I do however have to realize that PHP wasn’t built in a day, and that this process will not happen immediately.

I keep asking myself what would Steve Jobs do, and the answer I keep coming up with is that he would go his own way, well I’ll keep stewing on it, and hopefully the end result is that I will become the sort of programmer that Joel would want to hire, although somehow I doubt I could ever achieve that level of software engineering excellence ;-).


Writing a PHP Interpreter for Mides

Posted: May 7th, 2009 | Author: | Filed under: android, iPhone, java, mides, PHP, Programming | Tags: , , , , , , , | No Comments »

For the past few weeks I have been working on writing a PHP interpereter for Mides.  As I know that I am not allowed to do it for iPhone, as it would involve downloading and executing scripting code, which is not allowed.  I have only been looking at the tokenizer for the iPhone, while I have been looking at the full monty for Android.

I actually have gotten to the point where the tokenizer is passing a lot of my tests, but there is a lot of ground to cover with PHP. Tommy Carlier’s blog on writing a parser has helped tremendously.  Still, even after getting the tokenizer working, I have to write an interpreter to execute the tokens.  This involves implementing the many methods that PHP has built in, so it will be a while until I get that completely done.

I am pretty frustrated with Mides for iPhone, actually, I wanted it to be a full PHP implementation and editor, but until the Terms and Conditions change it isn’t worth the effort to build an entire PHP interpreter just to have the app rejected. I am still improving the iPhone version, and the next update should be a huge improvement over what is currently there.  I had to remove the nesting because I need the memory for documentation search as well as the PHP tokenizer that I am working on.  Overall, the next update for Mides will make it better, it will be close to what I was hoping for, but it will never be completely what I was hoping for on iPhone.

The Android version of Mides on the other hand is shaping up nicely.  The Android text view supports color so I have some syntax highlighting happening which doesn’t hurt performance on the G1 too badly.  The tokenizer is mostly done, and now I am designing the interpreter.  Development on Android is going a lot faster since I don’t have to worry quite as much about memory leaks, although if you try you can still make them happen.

At any rate that is why there haven’t been any updates for Mides in a while, I have been working on localization, parsers, and interpreters.  I am spending most of my time on the iPhone version of Mides, but it seems that I am getting farther with the Android version, go figure.


Idea For Making the G1 Screaming Fast

Posted: February 23rd, 2009 | Author: | Filed under: android, Companies, Google, java, Programming | Tags: , , , , , , , | No Comments »

There are a lot of cool things about the G1, but most people don’t talk about he hardware very often. It has a pretty snappy CPU, a good amount of RAM, and expandable storage. The coolest thing about the CPU is that it is a CPU/GPU dual-core combo unit. That gave me some ideas.

I know that Apple is working on their OpenCL that will allow applications on Mac OS X Snow Leopard to leverage the GPU for tasks that use it to advantage, like say floating point math, etc… It abstracts away all of the lower level coding that one would normally have to do for this type of functionality. Nvidia has some APIs for this type of programming, and I believe that Intel does as well. But one of the spaces where I see this as being especially beneficial is in the mobile space for phones and the like. The reason is simple, there is usually no math coprocessor like their x86 counterparts, and while most software doesn’t use it, others, like say speech recognition and image processing could get a huge boost out of it, and at a modest power cost.

What would be awesome is if Qualcomm published some sort of GPGPU language or spec to the Android foundation, and that made it’s way into the Android framework. Then when the GPU wasn’t being used, or when it was being used lightly, it could be used by code in the way one would spawn a thread to be run, but instead of running in the main CPU it could be run in the GPU, and free up the CPU to spend time doing something else.

I’m sure this has already been thought of and discussed by the Android brain trust, but it just occurred to me, and it would be 100% awesome if it made it into the framework.


HTML 5 Databases on iPhone

Posted: February 18th, 2009 | Author: | Filed under: android, Apple, Companies, Google, iPhone, java, Programming | Tags: , , , , , | No Comments »

Today I as looking into using HTML 5 databases on Android and iPhone. It turns out that the Android browser doesn’t seem to support window.createDatabase at all. It may be that it does work with Gears or something, but I didn’t try it.

What I did find, when enabling the developer menu for iPhone Safari was that in the 2.2.1 firmware, a user can view the databases that are currently stored on their device in the web browser by domain and delete them.

In the detail screen, it shows you how much data is currently stored in it, and it has a max, which appears to be stuck at 5 MB. I wonder if Apple has plans to improve the mobile Safari dev environment to allow for richer web applications at some point in the future when the AppStore revenues have died off a bit.

 

*EDIT*

Actually I did figure out that the G1 uses gears, so I guess they are equal, but gears doesn’t seem to care too much how much space I can use.  I haven’t tried the WorkerPool, or the local caching stuff, but I found another blog where the guy had an icon on his screen for a web-app.


I Got The G1

Posted: February 16th, 2009 | Author: | Filed under: android, Companies, Google, java, Programming | Tags: , , , | No Comments »

Yesterday I got the T-Mobile G1. I’ll be putting it through its paces as I work to port Mides IDE to it. So far, so good, however ido have to say that I’m a little slower with the physical keyboard than I anticipated. I’ll be glad when the cupcake firmware comes out and I can use the virtual keyboard.

The apps so far are mostly good, the device is definitely quicker than the iPhone as far as raw hardware performance, but the navigation around the OS is a bit slower. Still, I’m excited to see what I can do with this SDK.

Overall I’d say that the philosophy of the device is different. The G1 and Android are definitely aiming to be a little computer in your pocket, while the iPhone is still an iPod first, which makes it more of an internet appliance than a computer. As such, it makes a direct comparison challenging at best.

The G1 is ugly, and Android is unpolished, but for a company that doesn’t make music players, it is pretty good. More importantly, it fits in better with my way of thinking, and I appreciate the freedom that Google and T-Mobile have given us. Hopefully it will continue to improve, but either way I am pretty happy with it. Hopefully Mides will turn out to be as good as it is in my head for the G1, and eventually the iPhone. Competition is a good thing.


Why I Will Never Specialize

Posted: January 5th, 2009 | Author: | Filed under: java, Programming, Uncategorized | Tags: | No Comments »

Why I Will Never Specialize

Picture of IrvinI realized a few weeks ago that I had left behind the concept of being an expert in any particular language. Not that being an expert is all bad, however the pace of change in software development makes it impractical.

For a while now my interviewing ( candidates ) has changed to reflect that belief. I frequently get into constructive arguments with my hiring managers about the types of resumes they are sending to me to screen. The problem isn’t that they aren’t qualified, the problem that I see is that they are insanely qualified. Meaning that they have for example 20 years of Java or something with no hint of other languages, or techniques. I mean how many awesome programmers have you met that had never deployed their own PHP server, or their own tomcat server. How many programmers have had no experience with shell scripting.

Actually a red flag for me is someone who has never even looked at what Microsoft has to offer. I don’t use Microsoft technologies, but I have worked for companies where I did, and I stay as informed as possible about their various languages and APIs. The reason is because I am interested in programming, not in making a bunch of money ( even though that would be nice ) or finding a cush job to lounge in. I really want to understand what is happening inside of the compiler, etc…

I mean recently I started on a foray into what I thought was the V8 JavaScript engine, which is *MEGA COOL* by the way, but I found myself looking at the assembly language commands and thinking, hmmm… I want to understand that. So I started digging in, and now I think that assembly language is cool. Boy, I’m a long way from ColdFusion.

I don’t have anything against people who specialize in one language. That is the way people hire, the reqs always are asking for 10 years experience in Java or some truck like that. I would prefer the req say, and they do when I have control of them, 10 years of programming experience, which means you could be 18 or 75, its all the same to me. The best resumes are the ones where the person has just about every language, with one at around 8 to 10 years of experience, but lots of side projects in everything from lisp to sed and awk. It is probably hurting my chances of getting ahead in my career, but that doesn’t matter, that I won’t just stick to one thing, but I really want to understand this, I want to know how it all works, and I want to have a part in making it better.

It probably means that I am a freak.


Installing ColdFusion MX 7, and the Apache Connector on Leopard Server (10.5.5)

Posted: December 31st, 2008 | Author: | Filed under: Apple, ColdFusion, Companies, java, Programming, Uncategorized | Tags: , , , , , , , | No Comments »

Installing ColdFusion MX 7, and the Apache Connector on Leopard Server (10.5.5)

Picture of IrvinThis weekend, I spent an unpleasant 24 hours or so working on upgrading a client’s server to Leopard 10.5.5. The actual Leopard upgrade went pretty well on the G5 XServe. The secret to that was having a crossover cable, and knowing the specific RackMac system identifier to be able to get the IP address to SSH into. The problems started with ColdFusion.

Now I am going to rant. My client has an Enterprise license, so we aren’t running on some hacked up installation, we are running a major OS that has been on the market for about a year, it has been in the hands of developers for more than a year. That there isn’t a proper connector bundled with the installation is criminal. If I wanted to go hacking around inside of source code, building crap, I could run open source. Why did we pay so much money for this? I will not write any more private applications with ColdFusion. If a corporation wants me to build ColdFusion applications, I may, but only after I try to convince them to go with something that is more likely to be supported on UNIX / Mac OS X.

I mean, how long has Apache 2 64-bit been out there, this shouldn’t come as a surprise to Adobe. I can’t trust that they will support major platforms going into the future. This is because of one or both of two things. The first possibility is that Adobe doesn’t want to put money into ColdFusion because it is dead or dying, the second is that Adobe wants to force people to upgrade to ColdFusion 8 by any means necessary. What Adobe has done is to make me look bad in front of my clients for choosing a technology that was not supported. I have already begun to write my applications in RoR, now I am definitely going to write my applications in RoR. I am done. I could have made so much more money writing code instead of screwing around with compiler flags.

The problem is that I would expect to run into trouble installing or running my software when using OSS. That comes with the territory, but when you buy software and it claims to support the platform, one would reasonably assume that the platform would be fully and actively supported. Anyway, rant over.

Now I will show how I fixed the problem:

First:

If you have a standalone installation (the only one that works), you will need to start it by switching to your ColdFusion directory, if you followed the defaults, it will be /Applications/ColdFusionMX7/runtime/bin. You will need to issue the JRun command from here ./jrun -start coldfusion. This will work, if you try to start it any other way, you will get the THIS_PROCESS_HAS_FORKED errors.

If you have installed it in multi-server, you are screwed, I have not found any decent way to get this to work.

Second:

You should be able to get to the administrator on http://127.0.0.1:8500/CFIDE/Administrator/index.cfm. Then you will need to set up the connector, this was crazy. The solution I am about to post I found on Scott Pinkston’s blog. The post is called ColdFusion 8 Leopard with apache an answer for the rest of us. It is generally for CF 8, but it will work on ColdFusion MX 7.

Here are the steps from his blog:

go to terminal window.
cd /Applications/JRun4/lib
unzip -d src wsconfig.jar
cd src/connectors/src  

apxs -c -Wc,-arch -Wc,x86_64 -Wl,-arch -Wl,x86_64 -n jrun22
mod_jrun22.c jrun_maptable_impl.c jrun_property.c jrun_session.c
platform.c jrun_mutex.c jrun_proxy.c jrun_utils.c

apxs -i -n jrun22 -S LIBEXECDIR=/Applications/JRun4/lib/src/connectors/src/
mod_jrun22.la

strip mod_jrun22.so

Now run the connector configuration:
sudo java -jar /Applications/JRun4/lib/wsconfig.jar

After it finishes, run this command:
cp /Applications/JRun4/lib/src/connectors/src/mod_jrun22.so /Applications/JRun4/lib/wsconfig/1/mod_jrun22.so

sudo apachectl restart

The order of the files to be compiled is *IMPORTANT* I was working on a Dual-G5 2.3 GHz so my command was /usr/sbin/apxs -c -Wc,-arch -Wc,ppc64 -Wl,-arch -Wl,ppc64 -n jrun22 mod_jrun22.c jrun_maptable_impl.c jrun_property.c jrun_session.c platform.c jrun_mutex.c jrun_proxy.c jrun_utils.c.

You will get some warnings, you can ignore them. If you get an error saying something about functions that start with an underscore in your apache error logs, when you try to start it, you have the file names in the wrong order. If you see an error that says it found the module, and it is mach-o, but it is the wrong architecture, you are probably using -WI (I as in imitate) instead of Wl (l as in Larry).

Step 3:

Make sure to add the add handler to your httpd.conf. in the ifmodule for mod_jrun22.so. Mine did not install this by default, so my ColdFusion templates were coming up with the code showing up as plain text. Here is the default handler: AddHandler jrun-handler .jsp .jws .cfm .cfml .cfc .cfr .cfswf.

I hope this prevents anyone from going through the ridiculous configuration nightmare that I went through this weekend. I apologize for the rant, but I have some other cool projects that I would rather work on than spending forever hacking around with my application server.


What Does a Sun Bankruptcy do to Enterprise?

Posted: December 29th, 2008 | Author: | Filed under: Companies, java, Programming, Sun Microsystems, Uncategorized | Tags: , | No Comments »

What Does a Sun Bankruptcy do to Enterprise?

Picture of IrvinFor more than a few weeks now, I have been pondering some broad implications of companies that we all rely upon failing. Probably the grand-daddy of these is Sun Microsystems.

Normally I wouldn’t be concerned about tech companies going away. It is part of the normal advancement of the art, but in Sun’s case, it does concern me. While I don’t share many developers’ blind love of Java, or Solaris, or any product really. I do feel that Sun has given a tremendous amount to the software engineering community and would be sorely missed if they were to go belly up. At the time of my writing this, Sun’s stock is at $3.41 per share, and their market capitalization is 2.52 Billion, less than Sun has on hand in cash.

I don’t necessarily think that Sun is in financial trouble, but it does seem that there are a bunch of products that they release that are mostly not for pay. Not to mention that their financial performance may / should, be giving some corporate IT departments pause as to their dependence on their technologies. Many companies rely on support from Sun, and if that were to transition to the community, the level of response may not be sufficient. The question I would ask is, “Will a Sun Bankruptcy Drive Corporations Back to Microsoft?”

Unfortunately, I can’t see any other alternative at the moment. There are millions of lines of code out there written against the Sun JVM, and while the JVM is now mostly open source, and so is Solaris, the companies that count on those lines of code typically are not interested in maintaining that code as well. Without Sun, you could have JVM forking, Solaris forking, etc… where a particular application written against Java or Solaris may not run in a given company. Corporations would have none of these problems if they used the .net stack for application development.

Now, I am not advocating that all corporations out there should drop their Sun implementations and run to Microsoft, but what I am saying is that they should prepare themselves for a little instability. I tend to use Ruby and the Rails framework for most everything anymore, but I have come to be somewhat skeptical of the gems that I am using. I am also aware that there is currently no support beyond community support for most of these items, and the developers working on them could get bored and go away. So for functionality that is more than a nice-to-have, I tend to write it myself.

Hopefully this will go away when we start to see professional gem houses, but in the near term, I would hope that companies would begin to diversify their stack a bit so as to mitigate the cost, such as re-engineering their non-core systems to be less dependent on core software from a particular vendor. The last thing you would want would be to find a showstopper bug in something you were about to release that was based on a technology from a shaky vendor, that holds up your business process.

Most good IT shops already support a variety of technologies so as to not be locked in to any one particular implementation from any given vendor, but enterprise developers should not continue to believe that Sun or Java will be around forever in its current enterprise-blessed, no-brainer form. I think serious unbiased evaluation of technologies to be included in future products should gradually become the norm. If Microsoft wins, so-be it, there is some good stuff in .net, but I would hope that Ruby and PHP would benefit from this situation.


Doing an Http Request in Java

Posted: December 31st, 1969 | Author: | Filed under: Companies, java, Programming, Sun Microsystems | Tags: , , | 1 Comment »

Doing an Http Request in Java

Picture of IrvinSince I always forget how to do this, because I just reuse a class, I am selfishly going to post the code for an HTTP request in Java to this blog. I don’t think I am using anything specific to JDK 1.5, but I very well could be.
/*
* MakeHttpRequest.java
*
* Created on May 15, 2007, 8:40 PM by Irvin Owens Jr
*/ 

import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;

public class MakeHttpRequest {

private String myUri;

/** Creates a new instance of MakeHttpRequest */
public MakeHttpRequest(String uri) {
this.myUri = uri;
}

public String doRequest(){
String req = null;
try {
req = makeHttpRequest();
} catch (IOException ex) {
ex.printStackTrace();
}
return req;
}

private String makeHttpRequest() throws IOException{
String str = null;
URL hp = new URL(this.myUri);
URLConnection conn = hp.openConnection();

Here I am going to set a User Agent string by getting some information from my Java Environment, along with additional information.
conn.addRequestProperty("User-Agent","WelshCorgi/1.0(WC 1.0; " + System.getProperty("os.version") + "; " + System.getProperty("os.version") + "; " + System.getProperty("os.arch") + ") Corgi/1.0.0.0");
InputStream input = conn.getInputStream();
conn.connect();
String mime = conn.getContentType();

I have a thread spin off to write the file to a cache.

Main.corgiExecutor.execute(new SaveBinaryFile(input,"wc/cache/wc_cache_" + this.myUri.replaceAll("\p{Punct}","_") + "." + getFileExtension(mime)));
//new SaveBinaryFile(input,"cache/" + this.myUri.replaceAll(":punct:","_")).run();

Then I check the mime type to make sure that it is markup. It would probably be prudent to check for the xml type also.
if(mime.equals("html") || mime.equals("text")){
// Get response data.
BufferedReader inputData = new BufferedReader(new InputStreamReader(input));
StringBuilder sb = new StringBuilder();
while (null != ((str = inputData.readLine()))){
sb.append(str);
}
str = str.toString();
}
return str;

private String getFileExtension(String mime){
String ext = null;
if(mime.contains("html")){
ext = "html";
}else if(mime.contains("text")){
ext = "text";
}else if(mime.contains("gif")){
ext = "gif";
}else if(mime.contains("jpeg")){
ext = "jpg";
}else if(mime.contains("swf")){
ext = "swf";
}
return ext;
}

}
That should be enough to get you started with the http request. Its pretty simple once you get used to it.


The MVC Disaster Befalling Application Servers

Posted: December 31st, 1969 | Author: | Filed under: java, Programming, Uncategorized | Tags: | No Comments »

The MVC Disaster Befalling Application Servers

Picture of IrvinI have always felt that the entire metaphor of MVC has been broken to a degree in web development. For a while I thought that AJAX held promise that eventually we would reach the point where we could have true MVC in that the controller would be the application server, the model would reside in the database, and the view would be entirely pushed down to the client as JavaScript.

Unfortunately, largely because of Google and its cohorts, this promise will have to wait. Since pages must be indexed, and Google refuses, not can't, but refuses to index AJAX content the pattern will remain broken.

The first and most egregious breakage of MVC is between the controller and the view, so we'll start there. The current implementation of web applications typically has HTML residing on the server mixed with JavaScript. This HTML is usually generated by an application server, so it is mixed with some, hopefully small, amount of business logic. Frequently this resembles a family gathering over noodles, tomato sauce, and meatballs. If people want dynamic behavior they will frequently deliver an RSS feed, or some other form of XML or JSON to the client via AJAX and update some div somewhere after parsing it. This is how good implementations are done today. What I'd like to know is where is the MVC in that design? business logic should not be allowed in template pages at all, no conditionals, no loops, definitely no method definition, this should not be allowed. What should happen is that you should be able to use an XML tag to create an instance of a bean representing a view interface and call getters. This would be a proper implementation of an application server IMHO.

The next and most dangerous breakage of MVC, not just in code cleanliness and readability, but also in security comes in the interface between the model, and controller, or as in some cases the model bypassing the controller and heading straight for the view. Typically this manifests itself in some process generating HTML, JavaScript and CSS from the domains data, and putting that content on an application server. Then using JSON or XML and the XmlHttpRequest pulling that preformatted content and putting it directly on the screen. In this case, there is no separation between layers at all, its just that kid putting his stupid hand down through the cake and squeezing at your birthday party.

If you are a single developer, it may be possible to manage such an implementation, but for a team it is impossible, there are bottlenecks everywhere, UI people have to wait for the process to run to generate the markup, the back-end people have to wade through lines and lines of markup to debug their code, and if you have AJAX engineers, forget it, they have to understand your back-end code to deal with the generated JavaScript. In other words, and put simply its a mess. Even sending HTML to the UI, a hijacker could change URLs so your client clicks and goes to a phishing site, etc… that is not to say that it couldn't happen with XML, but it is a little easier to handle these security issues if you have several steps between receiving the data and displaying / executing it.

On the security front, many people like JSON. I like it too if all hackers were to disappear. If someone were to inject packets into your JSON stream, it is too easy to hijack someone's browsing session. Remember all JSON is executed once its loaded in most cases, at least with XML usually it is treated like text and is never eval'd.

Unfortunately there is no application server that comes close to this strict MVC implementation. Maybe, in a stretch you could suggest that JSF, JSP, JSTL, and Tomcat all together create a decent MVC implementation, but really no server does that. Even if it did, people wouldn't know how to use it anyway.

Why does this matter? It doesn't if you are the only one maintaining and implementing a web application, if you waste your own time it really doesn't matter. It is when you need to scale in performance via parallelism, or in resources that you will constantly curse yourself for not fixing this broken MVC implementation. As far as I can see, facebook is coming the closest to doing a good job, at least metaphorically in this area, that may be because I can see their API. The fbml model is a good one, it conceptually separates business logic from the view, and hopefully their model is separate, I'd say it is because of the robustness of their model API it is.

At any rate, I'd hope to see better application servers, and implementations soon. I think it will take better application servers forcing better implmentations to make people change.