Improving life without using a Java web framework?

I'm so sick of learning yet another Java web infrastructure in a day.
JSP, Struts, Wicket, JSF, JBoss Seam, Spring MVC, to name just a few, all of these countless frameworks are trying to solve the same problems. However, none of them solves the main problems - why more and more new ones are still appearing.

Most of them look very bright and shiny at the first impression, because they simplify the implementation of simple things.
But, as soon as it comes to realizing a real use case in the world, problems get into the problem.
Often the framework does not give any help, but it hinders one and limits the options, forcing things to be implemented in accordance with their own logic and environment.

In short, I see the following disadvantages when using the framework:

  • Basically, there is a steep learning curve, and first you need to understand, at times, academic concepts enough and know the meaning and location of the heap of configuration files before you can start.
  • The documentation is usually more or less terrible, or there is no publicly accessible online link, it is helpless outdated, it confuses different incompatible versions or all of this together and often does not provide any useful examples.
  • The structure consists of millions of classes, which makes it almost impossible to understand the intended use only when viewing sources.
  • Therefore, you need to buy several "XYZ in action for mannequins in 21 days" that have a poor user interface, because they lack full-text search and are hard to carry.
  • To really use one of these frameworks, you need to learn by heart how everything can be done as the infrastructure requires, remembering the appropriate classes and method names until your head is filled with stupid and useless information that you cannot use for what or else.
  • There is a lot of overhead that slows down the performance of your applications and makes your brain feel numb when you try to understand what is really happening.
  • In the real world, there is usually no time to get to know something new because of the pressure to be productive. As a result of this training, when making an approach, you always look only at the fastest way to complete the next task, and not understand the new tool and opportunities.
  • The argument that the standard will allow people who are new to quickly launch a project is not valid in my view, because each project uses a different structure even within the same company (at least in my case).

It seems to me that the following quote from Albert Einstein fits very well here:

"We cannot solve problems using the same kind of thinking we used when we created them."

Back in the good old days of PHP programming, when coding was still fun and productive, I used to write my own frameworks for most things and simply copied them and transferred them from one project to another. This approach worked very well, leading to quick development, no overhead, and a structure that was actually stronger than most Java infrastructures, but with several hundred lines of code in one file plus some simple mod_rewrite rules.
This, of course, does not solve all the problems of web development, but it was simple, fast and straightforward. Despite the fact that it was fully adapted to the requirements of the current project, it was also easily extensible and had very high performance due to the zero invoice.

So, why all these troubles using these frameworks, why not throw them all away and get back to the roots?
What should I tell my boss when we start the next project again with a new map?

Or maybe a framework that really matters?
Or some hidden benefits that I have ignored?

+46
java web-applications web-frameworks
Apr 23 '09 at 10:49
source share
13 answers

Here is a quote from Kev from the stream What is your conflicting opinion on programming? fit in very well here:

I think that the entire enterprise infrastructure is smoke and mirrors. J2EE, .NET, most Apache infrastructures, and most abstractions for managing such things create a lot more complexity than they solve.

Take any regular Java or .NET OMR or any supposedly modern MVC environment for what the magic does for tedious simple tasks. You end up writing a huge amount of an ugly XML template that is hard to validate and write quickly. You have extensive APIs, in which half of them are designed to integrate the work of other APIs, interfaces that cannot be processed, and abstract classes that are only needed to overcome the inflexibility of Java and C #. We just don't need much of this.

What about all the different application servers with their own descriptor syntax, complex database, and teamwork products?

The point is not that complexity == is bad, it's extra complexity == bad. I worked in large corporate installations where some of them were necessary, but even in most cases, to create the majority of use cases, several home scripts and a simple web interface are required.

I will try to replace all these enterpriseisey applications with simple web frameworks, open source databases and trivial programming constructors.

+11
Apr 24 '09 at 9:17
source share
— -

Going back to the good old days of PHP programming when coding was still fun and productive, I wrote my own framework for most things and just copy and paste them from one project to the next. This approach is very well paid, which leads to rapid development, no overhead at all, and a framework that was actually stronger than most Java infrastructures there

I'm sorry that I believe that not one second.

but just a few hundred lines of code in one file plus a few simple mod_rewrite. This, of course, does not solve all the network problems, but it was simple, fast and straight to the point.

So, basically you developed your own framework for several months or years, taking into account your own needs, and could work with it very quickly, because you knew it deeply.

And yet you cannot understand why others do the same and then try to turn the result into something useful for everyone?

Where is this great structure you developed? If it is so powerful and easy to use, where are the communities dedicated, have thousands of users and hundreds of sites developed it?

each project uses a different framework even within the same company (at least in my case)

Well, that is your problem right there. Why did you choose the experience gained in each structure after each project?

The idea is to select one structure and stick to it in several projects so that you can master it. You have to spend some time learning the basics, and then it saves you time by letting you work on a higher level.

+35
Apr 23 '09 at 11:18
source share

The problem with creating your own frameworks is that you will make all the same mistakes that all established structures have already stumbled upon and addressed. This is true, especially with regard to security.

Just ask Jeff and the guys what they needed to consider when implementing WMDs in stack overflows. I would rather use what they produced in the project, rather than implement it from scratch. This is just one example.

+20
Apr 23 '09 at 11:23
source share

The problem, of course, is not only with Java frameworks. I lost count of the number of C ++ MFC projects that I saw floundering, trying to train my requirements in the Document / View model (which really works only for text and graphic editors - database applications are especially difficult to train).

The secret to using the framework successfully is to change your application to fit the framework, and not vice versa. If you can’t do this, don’t even think about using the framework - it will be more work than if you had written the application from scratch using good, reliable and well-documented utility libraries.

+11
Apr 23 '09 at 11:24
source share

So you say that we should deal with sockets and HTTP every time we want to create a web application!

The servlet container itself can be thought of as a framework, since it handles all these messy details and leaves you to write much simpler servlets / filters / listeners (that is, "extensions" of the framework specific to your application).

Any other framework trying to do is a separate mundane, repeatable, error-prone legwork code from a fun application code.

However, for a small application, you can get away simply with Model 2 MVC , which uses only JSPs and servlets.

Example:

class MyController extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ... { MyBean model = // do something request.setAttribute("model", model); request.getRequestDispatcher("/view.jsp").forward(request, response); } } 

Then, when your application becomes more complex, you can look at using Spring MVC to provide an easier connection (and therefore more flexible) to controllers, viewing resolvers, etc.

+9
Apr 23 '09 at 12:18
source share

I share your pain when I come across another structure that does not do the trick.

Having lived for ten years jsp, struts, EJB, EJB2, struts2, jsf, and now all the new web service frameworks, the horrors of xslt and the first wsdl nightmares, I am definitely tired.

There are a number of problems with frameworks. They are leak , so you need to know more - not to mention that internal structures have huge costs, using external infrastructure costs (but much less), since they are rarely delivered, and then you end up writing enourmus pieces of xml configuration and spend days fixing bugs and spelling mistakes that you immediately noticed in your favorite content, helping the code editor.

Perhaps the answer is to find less pompous tools that try to solve the problem, but do not redefine the world, but this is also difficult, since the main application model (html over http) is inconvenient - at best.

Add the fact that there seem to be many complicators , people who seem to be obsessed with trading boring simple problems to complex (but complex) problems (perhaps the Eric Axix axiom variant mentioned above).

Add the arrogance of developers who all know this, and feel free to write a new framework to solve all the difficult problems for you. Only they cannot, leaving 10% on the left, is much more difficult to fix now.

I don't have .NET experience, but the .NET world seems less crowded with theorists and compilers, and maybe the lingering VB stink scares them away, but every time I hear someone tell me they spent 1,500 hours on their maven config (hi?), I'm seriously thinking about removing "java" from my resume.

... what's the question again? Are there any frameworks that matter?

EDIT - added Stripes and QueryDSL.

I would try Stripes or GWT with QueryDSL + Hibernate or OpenJPA (with annotations) only so that you really develop in Java and try to limit the use of wsdl-first web services, xml-oriented frameworks, EJB and ESB (not beer) as much as possible.

+7
Apr 23 '09 at 14:24
source share

Well, not every day is the same boring ...?

+3
Apr 23 '09 at 11:01
source share

I had to work on a project trying to implement it in JSF. It was a nightmare.

Most of the working time was spent just compiling things. The fact is that at least half of what was compiled did not work, it was a different story. Almost no textbooks. Documentation is basically an automatic export of source code without comment. How can you expect this to work?

Of the few frameworks we saw, only Sun was able to create a new project that compiles at all! Another can only produce a bunch of things that took many days to call in a compiled state.

The network was almost silent. For any search, we get no more than 20 pages of search results, with useful first 1-3. In what was appropriate, what was found, half of the people cried for help, the other half said that they were screaming for help, no one came, they lost time and interest and abandoned this technology.

So, we spent time and did just something simple that could be done in a few weeks using ASP.NET.

Then we looked at an alternative framework for JSF. To our surprise, we found that they are all completely incompatible.

Not surprisingly, we joined the ranks of those who also dropped JSF.

+3
Apr 23 '09 at 11:33
source share

Consider the oncoming point. I am currently working in a store that does not use any frameworks outside of the JSP standard. Everyone has different ways of doing things, and we are very poorly versed in concepts such as de-mutation and security issues such as validation.

While I don’t think that using frameworks automatically makes you a better coder, I think using the standard design pattern implemented by most frameworks and having easy access to utility functions such as validation, I think I’ll be forced to code before a certain standard.

In web application design, you don’t reinvent the wheel every time, so you either complete your own solution for general tasks, or use the framework. . I believe that using the commonly used structure, rather than collapsing your own, you are going to get some basic code that is well tested and flexible.

There is nothing wrong with flipping your own decision as an academic pursuit, but I agree that there are people who invest much more time in a reliable solution than I can spend. log4j, for example, is pretty easy to collapse your registrar, but log4j is well tested and maintained, and they took the time to improve flexibility and performance to the extent that most of your own registrars cannot touch. The end result is a foundation that is reliable, but also simple enough to use even in the most basic applications.

+3
Apr 23 '09 at 15:47
source share

What worked for me is: you shouldn't just study any web structure you've heard about, take a look at it, see if the code is convenient, ask about stackoverflow or forums to see its advantages and disadvantages, and then study it and learn it well and just stick to it until you feel it is broken or simple outdated. Any of the web pages you wrote about is good on its own and works with pleasure if you “REALLY” know what it does. if you do not, you simply wander in the desert without a compass! I also found that a 21-day book is a surefire way for you NOT to master a wireframe or technology. The docs, of course, something needs to be considered when taking f / w, it also helps if you look around the code yourself (actually this is what helps me better when I come across some kind of behavior that I find strange .

1-So why is everything that hassle using these frameworks, why not throw them all away and get back to the roots?

if you go back to the roots that you rewrite code that does the same thing over and over +, most of these f / ws are open source, which means they are probably better served than you would do yourself with your f / w.

2-What should I tell my boss when we start the next project again with a new map?

This is my first experience with this f / w. I don't understand why we should use this f / w, which I already know X, and I'm really good at that. not to mention how I know about this f / w, the cost of the alteration, which should be done due to my ignorance of such f / w. I think we should use X if this is a specific requirement, we should fight for it and only do this if we really need to indicate the previous notes.

Or maybe there are frameworks that really affect?

only those who turn to the way you think are not the way you write the code (think that they build the MVC pattern in his golden evening).

Or some hidden benefits that I have ignored?

can't think of any tbh.

+2
Apr 23 '09 at 11:15
source share

You have the same problem in PHP: more frameworks than you have fingers to count them, each of them being the best and biggest (although you have a few tips: clean PHP5 design versus PHP4 compatibility, Rails philosophy (inflexible hierarchy of folders, automatically generated code) against the library approach ...), and you spend more time searching and exploring possibilities than writing code!
But in PHP, it allows you to solve common problems in advance, such as I18N support, plugin integration, session management and authentication, database abstraction, templates, Ajax support, etc. Avoid reinventing the wheel on every project and falling into common traps for beginners.

Of course, there are some tips for Java frameworks: big or small? well documented or not? widely used or confidential? for XML fans or not? Etc.
I believe that most frameworks are aimed at large projects where training time is not a big problem, scalability and ease of deployment, etc. are important. They are probably too small for small projects.

There is also a tendency within such frameworks aimed at making a consistent set of loosely linked libraries a more monolithic structure. This is a case in the PHP world for the Zend framework (some even deny the use of the word "framework" ...).
Therefore, he solves the problem of "solving common problems" without disturbing them.

+1
Apr 23 '09 at 11:18
source share

However, I do not agree with some points that you mentioned, but I agree with you regarding the boring work.

Yes, all web applications relate to pages displaying forms, collecting data, performing validation, sending data for storage in the database and filtering the saved data with search forms and displaying the result in tables and selecting one or more records for manipulation (CRUD or business actions related to changing the status in the database).

however, I only work for 4 years plus, of course, my 4-year academic study. I feel that this type of development is boring because you do not invent algorithms, of course, you were happy when you open a new infrastructure and you would be happier if you integrated one of the AI ​​engines in your application, but in the end I feel that this work it is fictitious work or allows you to talk about the operation of the machine, so why we do not automate all this.

and one more framework;) The architecture, driven by the MDA model, briefly talks about the conversion from PIM (platform-independent model) to PSM (platform-specific model), for example, from UML to code.

And this can solve your problem with the learning curve and technology, since you only need to model well, as there are several frameworks that implement MDA specifications, such as AndroMDA , because it has cartridges that accept class diagrams, usage examples, diagrams sequences and action diagrams and generate database script creation, POJOs, hibernation mapping, Spring / EJB, JSF / Struts, .NET code.

Of course, such a framework will not generate 100% of the code, but will generate a large percentage, and, of course, you ask, where will this structure solve complex and complex requirements scenarios? Today I will say no, tomorrow yes.

So, why do not we invest in the development of this excellent structure.

0
Apr 23 '09 at 11:22
source share

So, you think it is better if we all reinvent the wheel in every project?

You can see excess frameworks as a problem, and this makes it difficult to choose your own set. But, on the other hand, you do not need to try each; and even if you do, you will eventually prefer some of them. You will have a favorite framework for ORM, another for web development, IoC, etc.

It helps to read on some forums to find out which ones are the most popular; they must be popular for some reason, and even if this is not the right reason (for example, technically excellent, maybe it is popular only among managers because of word overload or something else), knowledge of this structure will be useful, because that you can participate in several projects that use it.

Plus, using a framework instead of writing your own will help you save a ton of problems. Errors are not always detected and resolved by the authors; which are often performed by structure users. You said you were done with your own private map in PHP; I am sure that this was not a mistake, but perhaps you did not know about it, since you were the only user and the only encoder.

0
Apr 23 '09 at 14:53
source share



All Articles