Announcement Announcement Module
Collapse
No announcement yet.
Newbie Question: General Controller / Manager? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Newbie Question: General Controller / Manager?

    Looking at the examples with Spring's source and stuff like Appfuse, I've noticed that Spring doesn't have a general/generic controller or manager class that is not tied to the web tier (like what's in Beehive or XWork). I don't think that Spring MVC cuts it for being a generic MVC. Am I wrong or have I missed something? Also is there a standard way of using web services with predefined generic controller/business objects within Spring (similar to Beehive) or is this forthcomming?

  • #2
    I don't think that Spring MVC cuts it for being a generic MVC
    I don't think Spring attempts or puports to do this. Spring's MVC is given the title "Spring Web MVC" in the reference documentation and states "Spring's Web MVC package provides a Model-View-Controller implementation for web-applications." It does remove web dependencies from your domain model - unlike struts.

    Regarding being generic - being able to integrate with Struts, WebWork etc, as well as several view technologies (JSP, Velocity, Freemarker, PDF, Excel) is pretty generic.

    is there a standard way of using web services with predefined generic controller/business objects within Spring
    Take a look at the Spring JPetstore sample. It supports Hessian, Burlap, RMI, and Web Services via Apache Axis. Again Spring is flexible.

    Comment


    • #3
      Regarding being generic - being able to integrate with Struts, WebWork etc, as well as several view technologies (JSP, Velocity, Freemarker, PDF, Excel) is pretty generic.
      Yes, I think that Spring's dependency injection / inversion of control feature is great, but I also feel that having a real control layer framework (instead of another view layer framework like struts) in the way of Xwork would be great to have - though I could use Xwork now with Spring as the control layer, Struts as part of the view, and Hibernate as part of the model layer....

      Comment


      • #4
        Spring works great with XWork, so if you want XWork style commands using XWork + Spring should be a good choice.

        However, some of the things a "command" pattern is typically used for, such as an interceptor chain, can be done using Spring AOP while preserving strong typing.

        Rgds
        Rod

        Comment


        • #5
          Rod, first I'd like to say that Spring is one of the coolest things to come out in a while.

          I was just wondering if you have any plans to make Spring MVC generic instead of being so tied to the web tier like Struts?

          Comment


          • #6
            plans to make Spring MVC generic
            Rod can answer on the MVC plans, but can I ask what's the ultimate goal? What clients would this cater for? There is the Rich Client Project for Java applications, remoting (including Web Services) support and portal development is progressing in the sandbox.

            being so tied to the web tier like Struts
            In Spring's defense, it is designed to be less tied to the web tier than Struts. Take a look at the validator class - no javax.servlet imports and easy to unit test.

            Comment


            • #7
              what's the ultimate goal? What clients would this cater for?
              Maximum flexibility and helping people achieve better design - this is for everyone, since the only thing that you can count on is change: an evolution of requirements and your application.

              You've mentioned the Rich Client Project, but that only caters to Swing. What about SWT or Laszlow http://www.laszlosystems.com?

              In Spring's defense, it is designed to be less tied to the web tier than Struts.
              First let me again repeat that Spring is great, but Why merely follow in Struts' example when you can lead? Don't get me wrong Struts was a breakthrough in helping people adhere to good design and a lot of apps reside in the web tier, but there are a lot of apps that go beyond the web tier (and they need more than just validator classes).

              Yes, there are already frameworks like Xwork and Beehive that provide solutions; but for some reason I have the feeling that the Spring team can come up with something better in that respect.

              Comment


              • #8
                what's the ultimate goal?
                Maximum flexibility
                Again, I believe Spring MVC is flexible. It also aims to be lightweight. It caters for the most common client at the moment, and does it well IMO.

                What about SWT or Laszlow
                SWT - I'm not sure for plans on this. I'd guess it'd be based on the current RPC remoting model - not Spring's MVC. Contributions are welcome.
                What about SWT or Laszlow
                Laszlow - This is a cool technology and I believe it is being looked at.
                Be patient - or you can get in there and contribute ...this went Open Source less than 2 weeks before your post. Laszlo requires a (previously proprietary) presentation servlet, so I don't think criticism of Spring's MVC is relevant.

                Comment


                • #9
                  Again, I believe Spring MVC is flexible.
                  While Spring is very flexible and great, Spring MVC is NOT flexible if all it can be used for is the web tier.

                  Comment


                  • #10
                    I was just wondering if you have any plans to make Spring MVC generic
                    No plans at present. Interesting discussion though.

                    Comment


                    • #11
                      ...

                      Looks like someone else also had the same idea of true controller framework....

                      http://raibledesigns.com/wiki/Wiki.jsp?page=AppFuse

                      Comment


                      • #12
                        Originally posted by pulse1014
                        what's the ultimate goal? What clients would this cater for?
                        Maximum flexibility and helping people achieve better design - this is for everyone, since the only thing that you can count on is change: an evolution of requirements and your application.

                        You've mentioned the Rich Client Project, but that only caters to Swing. What about SWT or Laszlow http://www.laszlosystems.com?
                        Say someone wanted to write some integration for SWT or Laszlow (indeed IIRC some previous forum posts suggested this might have started/happened), they would find Spring's framework makes it very easy. I wrote an integration with Echo (a little like JSF and Tapestry) in about an hour. It's really very easy.

                        I think you are misunderstanding Spring's design. Spring has a comprehensive web MVC layer, which, as you would expect, is designed to help people build web MVC applications. Spring also includes a rich set of other services (remoting, database access, transaction management, EJB access, JMS, security etc etc etc) designed to facilitate properly engineering your services layer, persistence layer and domain layer. The Spring Way of development urges people to put AS LITTLE AS POSSIBLE into the web MVC layer. Indeed there is a rule of thumb, "if you have a Http* or Servlet* object in your services layer, you've got an architectural problem".

                        If people understand and follow The Spring Way of development, they will find the web MVC layer is very thin and most of their application actually exists in reusable higher layers. Spring is not in any way tied to the web. As mentioned, the presence of a web object in a higher layer points to a design problem. Spring internally doesn't have web objects floating around in its transaction or persistence classes, for example (well there is a Hibernate "open session in view" support class, but its use is usually discouraged due to the "design leak" mentioned earlier).

                        Spring is not in any way bound to either its web MVC layer or indeed to the web generally. There's nothing uncommon about a standalone application internally loading the Spring IoC container and benefiting from a properly layered architecture which includes transaction support etc.

                        If you have a specific technical design in mind which you'd like some feedback on, we'd be more than happy to help show you how that would "be done" in Spring. But without a specific technical design, it's hard to be more helpful or add much more to this discussion. Just rest assured Spring is not tied to the web, as working though a real application design would demonstrate.

                        Comment


                        • #13
                          ...

                          Yes Spring itself is great and its core allows for a very flexible controller framework/layer. It is extremely cool and useful. I don't argue that (never did/ never will).

                          However given the revolutionary nature of Spring's core architecture, I still don't quite understand why instead of making a true generic controller framework - the Spring team choose to reinvent the 'Struts' wheel. (In my personal opinion (I could be wrong) while SpringMVC is an improvement - It isn't really that much better than Struts. It just has a different way of doing certain things....).

                          Spring's core is FLEXIBLE. I just don't get why Spring's mvc isn't as flexible as its core, instead of being tied to the web; given the myriad of view layer technology today (Velocity, Lazslo, FLEX, PDF, Swing, SWT, etc...)...

                          Well it wasn't really a problem to me especially because stuff like XWork, Beehive, and Appfuse exist. I was just curious (or just being annoying depending on how you see it)

                          Comment


                          • #14
                            Re: ...

                            Originally posted by pulse1014
                            I just don't get why Spring's mvc isn't as flexible as its core, instead of being tied to the web; given the myriad of view layer technology today (Velocity, Lazslo, FLEX, PDF, Swing, SWT, etc...)...
                            I would have thought a web MVC layer would need to be tied to the web. :-) Is there some other approach (ie non-MVC) you have in mind? Such as JSF, although there's already a Spring integration project for that. Indeed there's also an integration project for Tapestry if you prefer a different event-driven web model. As mentioned earlier, I did an Echo integration in about an hour, so it's all very simple and easy. Or perhaps portlet support, but again, there's already work done on Spring supporting that too.

                            Sticking to the standard web MVC offering for a moment, the myriad of view layer options isn't a problem at all. Indeed the web MVC layer's entire view resolution approach is completely pluggable and well thought-out. To exemplify, Spring MVC already directly supports as views JSP, Velocity, PDF, Excel, XSLT, Swing (not sure what that's doing in a discussion about web MVC though), FreeMarker, JaserReports, Lazlo (http://forum.springframework.org/showthread.php?t=10693), and I'm sure others I've forgotten to list. I also know people have written FLEX apps (I've had support questions for Acegi Security concerning such apps), and there has been some basic work done with SWT already.

                            The key thing to remember about Spring is it is flexible and pluggable. You don't like the view technology, add one or don't use it. You don't like the web approach, add one or don't use it. It can accommodate whatever you want to do...
                            Last edited by robyn; May 19th, 2006, 05:58 AM.

                            Comment


                            • #15
                              Re: ...

                              Originally posted by Ben Alex
                              I would have thought a web MVC layer would need to be tied to the web.
                              if you noticed my other posts, I have never criticized the Spring core itself or its flexiblitiy. I just kept wondering why the Spring team came out with a web mvc (and other Spring teams came out with/ will be comming out with more reiterations of the control layer wheel - ie Swing Spring project) instead of having just one true generic mvc framework that everyone works off of and makes 'plugins' for.

                              Comment

                              Working...
                              X