Yes…
for some definition of the word “application”
. Your error is the claim that web “application” and “Vaadin application” are the same thing. These are NOT the same thing… and I can prove it simply because I know of several counter-examples!! Not to mention 1000+ Spring Stuff add-on downloads.
Maybe you have never personally experienced a situation where they are not the same thing. That’s fine. Just don’t then assume that this will be true for the entire rest of the world.
Analogy from history: people used to think “The Internet” and “Internet Explorer” were the same thing, because they never used them separately. You are making an analogous mistake.
I’m glad you asked. Maybe some explanation will help!
You Vaadin guys seem to think the world revolves around Vaadin, as if the only type of Java object in the world was the Vaadin widget. But in a large enterprise application, Vaadin is just one small component/toolkit in a much bigger picture. There are all sorts of other things going on in the server backend: data flows, threads communicating with external systems, etc. The “Vaadin application” is a relatively small component that provides a web browser client with a view into the overall application. It’s really just a “view.” And as with any complicated system, there are several different such “views” that may need to be instantiated at different times and/or at the same time.
For example, you might have an administrative view, a user view, a reporting view, a service view, a 3rd-party view, etc. Each of these views has not only Vaadin widgets of course, but also a host of other backed supporting objects that exist to support that view (such as data-backed containers, etc).
Finally, at the lowest layer, all of these views share a common base set of objects such as DAO’s and service beans, not to mention classes, libraries, and resources. It’s all one big “enterprise application”, and it’s all one big “web application”, but it has multiple independent (relatively small) “Vaadin applications”, which are just “views” in the general sense.
For scale an efficiency reasons, we cannot instantiate all of these “views” at the same time. Not only would that be stupid and wasteful, but it doesn’t scale from a performance point of view, because having a single view (aka. Vaadin application) creates too much contention on a single, shared lock, when the same user wants to e.g. use the system while they keep open a continually refreshing dashboard.
But look: I shouldn’t have to justify this to you. The very fact that many people are using this kind of entirely reasonable setup should be sufficient evidence to support it. For large enterprise applications, there are good technical reasons for it. But even forget all of that: you should just be letting people do what they want to! Instead of fighting them based on your own assumptions and experience.
In fact, why are we even having a debate about this? The very fact I’m having to explain this to you makes me wonder if you guys really understand or care who your customers are. Simply put, you are being arrogant. You think you know how everyone else is going to want to use Vaadin. That’s a dangerous attitude to have for a project based on open source, especially when you’re also trying to build a business based on that project! Business that think they know everything and don’t understand their customers always end up as so much more roadkill.
I understand that you are trying to simplify things - that is a worthy goal, but in the process you are confusing “simplicity” with “eliminating choices”… these are not the same thing, and the latter can really piss people off.
I think you guys could really learn a lot by studying the Spring Framework codebase (I know I have). Good software design is hard, but they do as good a job as anyone. You need to understand the open/closed principle and the importance of good Javadoc. Most importantly, achieving power and flexibility without unnecessary complexity by having good class hierarchies, lots of interfaces and configurability, and relying on “convention over code”. Vaadin classes are to often difficult to subclass because all extensibility methods are private or don’t exist, so the only option is to copy and paste the whole thing into a new class, which kills maintainability.
When designing code and APIs for an open source project, instead of asking “Why would anyone ever want to do that?”, ask “How can we enable possibilities that we ourselves can’t even imagine?”
You said
VaadinService
but you meant
VaadinSession
correct? (I don’t think there is any problem with
VaadinService
).
Specifically I have two problems:
- I need a single HTTP session to be able to hold more than one Vaadin application
- I need some kind of lifecycle notifications to occur when a Vaadin application is started and closed, so that associated non-Vaadin resources (such as the Spring application context) can be started and closed at the same time.
#1 is self explanatory. All that’s needed is some way to parametrize the HTTP session keys on a per-servlet basis. This can easily be done with a new, optional
.
For #2, one way to do this is with another new, optional
that allows you to specify a custom subclass of
VaadinSession
. This was my first thought, but there are probably simpler ways. For example, just add
onApplicationStartup()
and
onApplicationShutdown()
methods to
VaadinServlet
so that I can subclass that instead.
So while there is a lot of design argument here, from a practical point of view, this is a trivial issue to solve without altering the 7.0.0.beta1 APIs.
Of course my comment was in jest. But in any case, what you said is not true. With a proper class hierarchy, nobody would be forced to do anything. You can easily segregate classes that depend on optional 3rd-party libraries so that people who don’t need them don’t need to touch them. Again, Spring shows how to do this correctly. Their code is works with zillions of 3rd party libraries, but the code is all properly modularized so that you only have to use what you want/need.