aspose file tools*
The moose likes Struts and the fly likes Struts vs. In House MVC : question for Mr. Neal Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts vs. In House MVC : question for Mr. Neal" Watch "Struts vs. In House MVC : question for Mr. Neal" New topic
Author

Struts vs. In House MVC : question for Mr. Neal

Dave Knipp
Ranch Hand

Joined: Oct 14, 2003
Posts: 146
Mr. Neal,
In your opinion what is the best type of framework to base a your average web app around?
Of course struts is very popular and being embraced by the community, but do you think that developing your own in house MVC/Model 2 architecture can be beneficiary to your own specific web app?
I can see the pros and cons to both. With struts you utilize a fully tested framework that is well documented and well known. But at the same time you are dependent on the struts developers implementation. On the flip side an in house solution creates quite a learning curve for any new developers that walk in the door (which doesnt exist with struts as long as they are familiar with the framework).
So is there really any true answer? I you have to make the decision depending on your own web app and weigh the pros and cons. I would love to hear your opinion on this.
Thanks for your time,
Dave


SCJP 1.4, SCJD 1.4, SCWCD 1.3, SCBCD 1.3, IBM Certified Solution Developer -WebSphere Studio V5.0
Neal Ford
Author
Ranch Hand

Joined: Oct 23, 2003
Posts: 82
Dave -
In your opinion what is the best type of framework to base a your average web app around?

It depends! (Don't you hate that?)
Seriously, I think you are better off at least starting with an existing framework. After all, Java is itself a framework in some sense, but you aren't considering writing your own language, are you? A framework is just that -- a frame on which to hang your infrastructure.
Having said that, though, you have some additional options. You are free to choose an open source framework as the starting point of your own framework. In that regard, I think Struts is good because it is fairly transparent -- it's easy to see the moving parts, and put your own gears in place if you want. Note that the Espresso project did exactly that -- built an additional framework on top of Struts.
On the other hand, something like Tapestry would be tough, because it is more of an all-encompassing framework. It would be harder to base your own framework around it. However, if you did, you would be well along towards a lot of sophisticated functionality.
At the end of the day, I love code that works that I don't have to write as long as it doesn't get in my way and/or ruin my architecture. You get lots of built-in advantages (testing, community support, developer knowledge) using existing code.


Neal Ford<br />Author, <i>Art of Java Web Development: Struts, Tapestry, Commons, Velocity, JUnit, Axis, Cocoon, InternetBeans, WebWork</i><br /><a href="http://www.nealford.com" target="_blank" rel="nofollow">www.nealford.com</a>
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
My feeling is that there is really very little reason to write your own Web Framework considering the current state of Web Frameworks in Java. There are a number of very mature, accepted, and proven frameworks available today.
The first question you would have to ask yourself is: What do I need to do that none of these frameworks offer? If you can't answer that question then stop right there... you shouldn't be writing YAWF (yet another web framework).
Assuming you have an adequate answer to the above question then I would at least take the time to investigate the current frameworks to see how easy/hard it would be to incorporate the changes needed to support your functionality. I highly suggest getting involved in the project at this point and submitting your changes back to the framework's group. If you need the functionality then it is likely that others need it as well and you would just be making life a little sweeter for everyone.
Only after all of the above fails would I even begin to consider writing my own framework. Ultimately, writing your own framework has the potential to be a significant drain on your team to maintain over the lifetime of the project and not one to be taken lightly.
[ February 10, 2004: Message edited by: Chris Mathews ]
Ko Ko Naing
Ranch Hand

Joined: Jun 08, 2002
Posts: 3178
Originally posted by Chris Mathews:
My feeling is that there is really very little reason to write your own Web Framework considering the current state of Web Frameworks in Java. There are a number of very mature, accepted, and proven frameworks available today.

I do agree with this statement as well... Why should we re-invent the wheel, since there are some wheels to be used in our own vehicles... It's very less likely that a web app is not fitted to any available frameworks in the market todays...

Only after all of the above fails would I even begin to consider writing my own framework. Ultimately, writing your own framework has the potential to be a significant drain on your team to maintain over the lifetime of the project and not one to be taken lightly.

It seems like we are going to invent a new kind of wheel, instead of using the cirular wheel... Maybe triangular wheel or rectangular wheel... In this case, we do have to put our eyes on the things that we have invented and should be smart enough to maintain that over the lifetime of the project, as Mr.Chris has just mentioned...


Co-author of SCMAD Exam Guide, Author of JMADPlus
SCJP1.2, CCNA, SCWCD1.4, SCBCD1.3, SCMAD1.0, SCJA1.0, SCJP6.0
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

I feel struts is the best MVC frame work to be used. It is open source and there are lot of resources in the web to learn.
Maybe triangular wheel or rectangular wheel...

I guess wheel is circular in shape.


Groovy
Ko Ko Naing
Ranch Hand

Joined: Jun 08, 2002
Posts: 3178
Originally posted by Pradeep Bhat:
I guess wheel is circular in shape.

Yeah, Pradeep... The original wheel in circular, but if we are going to re-invent it, why should we re-invent the circular wheel? Try a triangular wheel or rectangular wheel If you carefully read my post, u will understand why I mean by triangular and rectangular wheels...
Dave Knipp
Ranch Hand

Joined: Oct 14, 2003
Posts: 146
I would agree with all of you. Struts is my definite choice, i was just curious whether or not anyone had ever encountered a situation where they had to give up on using struts (or some other framework) b/c it didn't support a certain type of functionality they needed.
I also like how struts is very transparent and easy to see the moving parts, imho any framework should be like that because you really need to have an idea of whats going on in the background or you might run into errors down the line. Its also nice that struts allows you to extend and specialize the ActionServlet which tends to lend alot of breathing room for every type of project.
I do agree that it is easy enough to submit suggestions and even join the struts development team if you run into a shortcoming of the framework, and then making life better for everyone else Thats the glory of open source projects, everyone can contribute if you want.
Its good to hear everyone's opinion on this, i don't think i would ever choose not to use struts and it seems like thats the consensus Thanks for your reply Neal!
Regards,
Dave
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
Originally posted by Dave Knipp:
Its good to hear everyone's opinion on this, i don't think i would ever choose not to use struts and it seems like thats the consensus

Don't take my reply as a glowing endorsement of all things Struts. It is not the best solution for all applications and I am personally not very fond of it. There are other web frameworks that I like better than Struts but I certainly recognize that siding with the 800lb. gorilla (Struts in this case) has its advantages too.
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

Neal
How will struts integrate with JSF?
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
Craig McClanahan (JSF Spec Lead and Creator of Struts) announced the Struts and JSF integration path back in September. Read it here.
I should note that Struts-Faces is currently part of the Struts distribution and can be found in contrib branch.
Dave Knipp
Ranch Hand

Joined: Oct 14, 2003
Posts: 146
I read that post by craig about the jsf integration, but it still seems somewhat hazy on how easy it will be to integrate struts with jsf. I wonder how seamless this will be, will it be a configuration change in the struts-config file or does everyone think we will have to change actual code? I'm fearful of starting to write an app using struts when jsf is about to replace it....
What do you think Mr. Ford, whats your take on JSF vs. struts??
Regards,
Dave
vasu maj
Ranch Hand

Joined: Jul 12, 2001
Posts: 395
Originally posted by Chris Mathews:

Don't take my reply as a glowing endorsement of all things Struts. It is not the best solution for all applications and I am personally not very fond of it. There are other web frameworks that I like better than Struts but I certainly recognize that siding with the 800lb. gorilla (Struts in this case) has its advantages too.

Another factor is that you don't need to invest in training people when you embrace a proven and popular concept, in this case struts.


What a wonderful world!
David Yutzy
tumbleweed and gunslinger
Ranch Hand

Joined: Jun 29, 2001
Posts: 192
I also use Struts quite heavily in most cases. However, where I find it's usefulness a "gray area" is in very simple web sites or applications.
Example: A simple HTML page that does nothing but display a table of information, say, a list of available corporate jobs:
Job Description | Post Date | Close Date
While there are a variety of ways to do this in Struts, I would do at least the following:
* Create a bean to pass information to the JSP
* An action class with a method to populate the bean and hit the DB
* A DAO class to call the StoredProcedure
* The StoredProcedure to perform the lookup
* Etc, etc.
OR
* Use the JSTL connection and sql tag to call the SP
* Use the JSTL forEach and out tags to output the 3 fields
When determining the level to utilize Struts or not, I usually follow the KISS methodology.
[ February 13, 2004: Message edited by: David Yutzy ]
Dave Knipp
Ranch Hand

Joined: Oct 14, 2003
Posts: 146
yah,
but what if you wanted to improve that web app in the future, you wouldnt have to code everything over if you abstracted it correctly
Dave
[ February 13, 2004: Message edited by: Dave Knipp ]
 
wood burning stoves
 
subject: Struts vs. In House MVC : question for Mr. Neal