Category Archives: Opinion

I love my MVC …

If this was a comics style blog it would start like this:

They both stood there, the clean and virtues super-hero MVC and his arch-enemy the dirty and corrupt spaghetti-design-pattern… they were both aware that only one of them will prevail.

The fact is that real life is more complicated than that, writing code is an on-going process and sometimes you need to “get things done now” instead of “get things done right”. The important thing is to keep in mind the important notions  that lays behind MVC.

So who is this super-hero? From Wikipedia: Model-View-Controller (MVC) is a design pattern used in software engineering. In complex computer applications that present lots of data to the user, one often wishes to separate data (Model) and user interface (View) concerns, so that changes to the user interface do not impact the data handling, and that the data can be reorganized without changing the user interface. The Model-View-Controller design pattern solves this problem by decoupling data access and business logic from data presentation and user interaction, by introducing an intermediate component- the Controller.

While MVC might take a little more time to design, the notion of decoupling presentation, logic and data layers is imperative. Code that has been written this way can easily be changed without enforcing changes on other layers of code. Because it is a well known fact of life that things always change, agile code makes our life easier and simpler. It is also usually makes the code more comprehensible.

On the other hand you have spaghetti code, it is takes no planning at all but changing it is a nightmare. Moreover, spaghetti code is incomprehensible and as the saying goes: “Always write your code as if the person who will maintain it is a violent psychotic who knows where you live.”

So keep your layers decoupled and live longer and happier.

BTW: if you don’t know which song was playing while I wrote this blog see the title or click here.

Why is Java-enabled hosting so expensive?

Why is Java-enabled hosting so expensive?

Hosting a website is a cheap matter these days. One could get a fairly good shared hosting package for around 1.5-6$ per month. These hosting packages offer a wide variety of features including support for PHP, PERL on LINUX or ASP (or ASP.NET) on Windows and MySQL DB. The problem is that prices soar when you want JSP/Servlet support.

I think Java should be as affordable as PHP and .NET or else it will loss a lot of private developers to the competitors. Expensive Java hosting is a problem when you want to deploy a privately-held/budget-aware website.

I like Java and wanted my open-source website to be written in Java. At the end I had to settle for PHP (which is cool too).

Why should ASP/PHP enabled hosting cost 1.5-10$ per month and Java enabled hosting cost 12-30$ per month?

Amir Shevat
2006-09-07T10:47:14-08:00
[Amir blog and articles]

Still waiting for true .NET – JAVA interoperability

Still waiting for true interoperability

One of the big things presented in JavaOne was .NET-Java interoperability. The notion of language interoperability can be understood and implemented in several different ways.

Sun and Microsoft introduced interoperability by means of web-services (WS). It seems that short of a cure for cancer, web-services is the answer to everything. While in some conditions WS is a good way for applications (written in different language or the same) to interact, this seems like a cumbersome way for simple (POJO) situations especially when the two applications are on the same machine.

Our open-source project, MantaRay, also tries to achieve language interoperability. We provide our JMS offering in Java and .NET, thus you can send a message in C# and receive it in java and vice versa. We keep the protocol layer unified to provide our language interoperability, while this might be simpler or even faster than WS it basically suffers from the same shortcomings.

Another solution presented in the JavaOne pavilion was of shared memory between .NET and Java. This is an interesting approach for interoperability within the same machine. But it lacks an event driven mechanism and method invocation, you need to write your own code that checks if the shared variable has changed. So this is, in effect, a very thin offering.

And there is JNI for Java-C++ interoperability. In the alumni “fire side chat” the guys from SUN admitted, when asked why JNI invocation takes so long, that JNI is sometimes slow and that Java itself used “dirty optimizations” in order to achieve better C++ invocation speed.

There was a company that implemented a “source time/compile time” interoperability approach, you write you code in .NET and access Java libraries as you see fit. At compile time your code is converted to Java. They showed a very simple demo and I am not sure what the limitations of this solution are.

I have a dream, in my dream you write the code in any language you like and mash-up different languages. I would like to write a multi tier application, writing every tier in a different language, and not worry about interoperability.

Technology should enable things. It should be simple and efficient. Interoperability is an issue because of licensing, lack of standards, lack of good will and business competition. As developers, and consumers of technology, we must strive to be able to use the right tool for the right task, we should push for open standards and seamless interoperability. We must make sure the technology providers (Microsoft and Sun) know that is important for their business to provide this interoperability for us.

Amir Shevat
2006-05-28T07:45:38-08:00
[Amir blog and articles]