Related
I am fairly new to the programming world . I work with web applications in Java . I am learning struts2 / hibernate / spring .
I am thinking , instead of reading hibernate from the tutorials , it's good to read the complete source code . Basically I am planning to learn the complete framework code , to understand how caching is implemented , how transactions are handled , how multiple threads are handled etc.
Have anyone of you done this kind of thing before ? My intention is , if we know one particular framework in and out , then it will be very helpful for designing applications .
The best way is the simplest way: Build something! Start small, but treat it like an incremental, iterative exercise and add features that cover all the aspects of the framework you want to cover. Peruse as many books, blogs, and Stack Overflow entries as possible to learn more from people who've actually used the framework before and apply what you learn. It's the best way to learn a full stack framework!
You learn a framework and programming like you learn to do most anything else well: spend a lot of time on it. See this question and its answers and its duplicates. Keep reading, learning and experimenting. Start to build small projects. You're on the right track, keep at it.
Diving straight in framework code isn't a great starting point. Here is how you should progress:
Think of a project you'd like to work
on related to the framework i.e.
project idea
Failing to satisfy point
1, just follow the examples in the
official documentation and try to get
your hands wet with things
Help out
folks on the IRC/forums since this
would surely force you to dive
deeper than the normal stuff
Look
into bug reports and try to make
sense of things. Can you understand
the problem in consideration? If no,
you might want to look into the
"developers getting started guide"
for that project.
But, I'd just like to point out that though knowing a framework inside out from a code view point might be a nice thing, it certainly isn't a requirement to effectively use a framework. That's the entire point of using a framework (apart from reinventing the wheel that is :>).
For beginning understanding on how a framework solves your problem, you often need an example that is much less than the fully featured framework. Since all of your examples cover web presentation to differing degrees, I suggest "Bitter Java" by Bruce Tate. It does an excellent example of presenting a very poorly written web application, and then reworking it to improve it. It will give you a good understanding of the MV2 architecture, on which most modern frameworks are based.
The frameworks are merely the "improved versions" made reusable by asking you to provide your "plug-in content components".
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I have an application written in Java. In is stored in several files. It uses different classes with different methods. The code is big and complicated. I think it would be easier to understand the code if I have a graphical model of the code (some kind of directed graph). Are there some standard methods for visualization of code. I am thinking about usage of UML (not sure it is a correct choice). Can anybody recommend me something?
ADDED:
I consider two possibilities:
Creating the graph by hands (explicitly).
Creating graph in an automatic way. For example to use some tools that read the available code and generate some graph describing the structure of the code.
ADDED 2:
It would be nice to have something for free.
I tried using a number of UML tools and found that the reverse-engineering capabilities in most UML tools were not helpful for understanding code. They focus on designing needs and reverse-engineering capabilities often just ends up showing huge pictures of lots of useless information. When I was working on the Microsoft Office codebase, I found using a pen-and-paper more helpful that the typical design/modelling tools.
You typically want to think about doing this in a number of ways:
Use your brain: Someone else mentioned it - there is no substitute to actually trying to understand a code base. You might need to take notes down and refer back to it later. Can tools help? Definitely. But don't expect them to do most of the work for you.
Find documentation and talk to co-workers: There is no better way than having some source describe the main concepts in a codebase. If you can find someone to help you, take a pen and paper, go to him and take lots of notes. How much to bug the other person? In the beginning - as much as is practical for your work, but no amount is too little.
Think about tools: If you are new to a part of a project - you are going to be spending a significant amount of time understanding the code, so see how much help you can get automatically. There are good tools and bad tools. Try to figure out which tools have capabilities that might be helpful for you first. As I mentioned above, the average UML tool focuses more on modeling and does not seem to not be the right fit for you.
Time vs Cost: Sure, free is great. But if a free tool is not being used by many people - it might be that the tool does not work. There are many tools that were create just as an exploration of what could be done, but are not really helpful and therefore just made available for free in hopes that someone else will adopt it. Another way to think about it, decide how much your time is worth - it might make sense to spend a day or two to get a tool to work for you.
Once there, keep these in mind when going trying to understand the project:
The Mile High View: A layered architectural diagram can be really helpful to know how the main concepts in a project are related to one another. Tools like Lattix and Architexa can be really helpful here.
The Core: Try to figure out how the code works with regards to the main concepts. Class diagrams are exceptionally useful here. Pen-and-paper works often enough here, but tools can not only speed up the process but also help you save and share such diagrams. I think AgileJ and Architexa are your best bets here, but your average UML tool can often be good enough.
Key Use Cases: I would suggest tracing atleast one key use case for your app. You likely can get the most important use cases from anyone on your team, and stepping through it will be really helpful. Most IDE's are really helpful here. If you try drawing them, then sequence diagrams arethe most appropriate. For tools here I think MaintainJ, JDeveloper and Architexa are your best bets here.
Note: I am the founder of Architexa - we build tools to help you understand and document Java code, but I have tried to be unbiased above. My intention is to suggest tools and options given that this is what I focused on as part of my PhD.
The most important tool you should use is your brain, and it's free.
There's no reason why you have to use any sort of standard method of visualization, and you can use whatever media you like. Paper, whiteboard, photoshop, visio, powerpoint, notepad: all of these can be effective. Draw a diagram of classes, objects, methods, properties, variables - whatever you think is useful to see in order to understand the application. The audience is not only other members of your team, but also yourself. Create diagrams that are useful for you to look at and quickly understand. Post them around your workspace and look at them regularly to remind yourself of the overall system architecture as you build it.
UML and other code documentation standards are good guidelines for the types of diagrams you can do and the information you should consider including. However, it is overkill for most applications and basically exists for people who can't take personal responsibility for documenting without standards. If you follow UML to the letter, you'll end up spending way too much time on your documentation instead of creating your application.
It is stored in several files. It uses different classes with different methods. The code is big and complicated.
All Java code written outside the school is like that, particularly for a new developer starting on a project.
This is an old question, but as this is coming up in Google searches, I am adding my response here so that it could be useful to the future visitors. Let me also disclose that I am the author of MaintainJ.
Don't try to understand the whole application
Let me ask you this - why do you want to understand the code? Most probably you are fixing a bug or enhancing a feature of the application. The first thing you should not try to do is to understand the whole application. Trying to understand the entire architecture while starting afresh on a project will just overwhelm you.
Believe me when I say this - developers with 10+ years of solid coding experience may not understand how certain parts of the application work even after working on the same project for more than a year (assuming they are not the original developers). They may not understand how the authentication works or how the transaction management works in the application. I am talking about typical enterprise applications with 1000 to 2000 classes and using different frameworks.
Two important skills required to maintain large applications
Then how do they survive and are paid big bucks? Experienced developers usually understand what they are doing; meaning, if they are to fix a bug, they will find the location of the bug, then fix it and make sure that it does not break the rest of the app. If they need to enhance a feature or add a new feature, most of the time, they just have to imitate an existing feature that does a similar thing.
There are two important skills that help them to do this.
They are able to analyze the impact of the change(s) they do while fixing a bug. First they locate the problem, change the code and test it to make sure that it works. Then, because they know the Java language well and the frameworks 'well enough', they can tell if it will break any other parts of the app. If not, they are done.
I said that they simply need to imitate to enhance the application. To imitate effectively, one needs to know Java well and understand the frameworks 'well enough'. For example, when they are adding a new Struts Action class and adding to the configuration xml, they will first find a similar feature, try to follow the flow of that feature and understand how it works. They may have to tweak a bit of the configuration (like the 'form' data being in 'request' than in 'session' scope). But if they know the frameworks 'well enough', they can easily do this.
The bottom line is, you don't need to understand what all the 2000 classes are doing to fix a bug or enhance the app. Just understand what's needed.
Focus on delivering immediate value
So am I discouraging you from understanding the architecture? No, not at all. All I am asking you is to deliver. Once you start on a project and once you have set up the development environment on your PC, you should not take more than a week to deliver something, however small it may be. If you are an experienced programmer and don't deliver anything after 2 weeks, how can a manager know if you really working or reading sports news?
So, to make life easier for everyone, deliver something. Don't go with the attitude that you need to understand the whole application to deliver something valuable. It's completely false. Adding a small and localized Javascript validation may be very valuable to the business and when you deliver it, the manager feels relieved that he has got some value for his money. Moreover, it gives you the time to read the sports news.
As time passes by and after you deliver 5 small fixes, you would start to slowly understand the architecture. Do not underestimate the time needed to understand each aspect of the app. Give 3-4 days to understand the authentication. May be 2-3 days to understand the transaction management. It really depends on the application and your prior experience on similar applications, but I am just giving the ballpark estimates. Steal the time in between fixing the defects. Do not ask for that time.
When you understand something, write notes or draw the class/sequence/data model diagram.
Diagrams
Haaa...it took me so long to mention diagrams :). I started with the disclosure that I am the author of MaintainJ, the tool that generates runtime sequence diagrams. Let me tell you how it can help you.
The big part of maintenance is to locate the source of a problem or to understand how a feature works.
MaintainJ generated sequence diagrams show the call flow and data flow for a single use case. So, in a simple sequence diagram, you can see which methods are called for a use case. So, if you are fixing a bug, the bug is most probably in one of those methods. Just fix it, ensure that it does not break anything else and get out.
If you need to enhance a feature, understand the call flow of that feature using the sequence diagram and then enhance it. The enhancement may be like adding an extra field or adding a new validation, etc. Usually, adding new code is less risky.
If you need to add a new feature, find some other feature similar to what you need to develop, understand the call flow of that feature using MaintainJ and then imitate it.
Sounds simple? It is actually simple, but there will be cases where you will be doing larger enhancements like building an entirely new feature or something that affects the fundamental design of the application. By the time you are attempting something like that, you should be familiar with the application and understand the architecture of the app reasonably well.
Two caveats to my argument above
I mentioned that adding code is less risky than changing existing code. Because you want to avoid changing, you may be tempted to simply copy an existing method and add to it rather than changing the existing code. Resist this temptation. All applications have certain structure or 'uniformity'. Do not ruin it by bad practices like code duplication. You should know when you are deviating from the 'uniformity'. Ask a senior developer on the project to review the changes. If you must do something that does not follow the conventions, at least make sure that it's local to a small class (a private method in a 200 line class would not ruin the application's esthetics).
If you follow the approach outlined above, though you can survive for years in the industry, you run the risk of not understanding the application architectures, which is not good in the long run. This can be avoided by working on bigger changes or by just less Facebook time. Spend time to understand the architecture when you are a little free and document it for other developers.
Conclusion
Focus on immediate value and use the tools that deliver that, but don't be lazy. Tools and diagrams help, but you can do without them too. You can follow my advice by just taking some time of a senior developer on the project.
Some plugins I know for Eclipse:
Architexa
http://www.architexa.com/
nWire
http://www.nwiresoftware.com/
If you want to reverse engineer the code, you should try Enterprise Architect
have you tried Google CodePro Analytix ?
it can for example display dependencies and is free (screenshot from cod.google.com):
Here is a non UML Tool which has very nice visualization features.
You can mapping the lines of code per class / method to colors / side lenght of rectangles.
You can also show the dependencies between the classes.
http://www.moosetechnology.org/
The nice thing is, you can use Smalltalk scripting for displaying what you need:
http://www.moosetechnology.org/docs/faq/JavaModelManipulation
Here you can see how such a visualization looks like:
http://www.moosetechnology.org/tools/moosejee/casestudy
JUDE Community UML used to be able to import Java, but it is no longer the case. It is a good, free tool.
If your app is really complex I think that diagrams won't carry you very far. When diagrams become very complex they become hard to read and lose their power. Some well chosen diagrams, even if generated by hand, might be enough.
You don't need every method, parameter, and return value spelled out. Usually it's just the relationships and interactions between objects or packages that you need.
Here is a another tool that could do the trick:
http://xplrarc.massey.ac.nz/
You can use JArchitect tool, a pretty complete tool to visualize your code structure using the dependency graph, and browse you source code like a database using CQlinq.
JArchitect is free for open source contributors
Some great tools I use -
StarUML (allows code to diagram conversion)
MS Visio
XMind (very very useful for overview of the system)
Pen and Paper!
I recently graduated in Computer Engineering. I don't have a permanent job yet. The recession is making a good difference in my aim and reality. I don't want to just sit down. I want to sharpen my capabilities. I want to learn and practice in a professional work environment.
Now my question is: What are the tools and practices followed in a professional working environment? I mean IDEs, team working tools,debugging tools, unit testing tools etc?
What are the frameworks in Java EE which are must-know, or which will bring me advantages in my job interviews?
Thanks in advance.
Some initial suggestions:
IDE: Eclipse or IntelliJ
Source code management tools like git, Subversion, Mercurial, CVS
JUnit for testing
Read "Code Complete", then sleep with it under your pillow. Maybe keep a copy in your bathroom as well.
IntelliJ is by far the best Java IDE, but it is commercial. Between Eclipse and NetBeans I would recommend NetBeans, it is closer to what an IDE should look and/or do(nothing against Eclipse, but I couldn't get used with it...maybe is just something wrong with me :) ).
You might find this poll (long but) interesting... http://www.java-forums.org/new-java/7315-what-you-using-write-your-code.html
We've been running a co-op (i.e. cadette) program for the last five (or so) years. Here's a list of stuff (in no particular order) that co-ops are clueless about that we really really wish they knew "the basics of" when they arrived:
Testing - Everyone tests, but (IMHO) few do so really effectively. Myself included.
Team development - How to work together on a codebase which is bigger than anyone.
Understanding legacy systems - Hey, this code is twice is my age? WTF?
Project management - That dark arts of delivering quality on time and on budget.
Business analysis - BA's are full of it! You at-least need to know enough to smell the effluent.
Known when to say NO - Practice saying this in front of a mirror: "No sir, I'm sorry, you really can't have this Ferrarri for the price of a second-hand mini."
The technology really is the easy bit. Having said that, your first position is likely to be as a code-monkey... so the more tecken ze spreken, the more likely you are to get a foot in the door.
So I suggest
Tackle the J2EE 1.4 Tutorial
... also look at a web-app MVC framework like Struts 1 or (better) JSF; and
... also look at Hibernate - the psuedo standard persistence layer.
... also look at "early" DHTML - manipulating a html-DOM with javascript.
... also look at Swing, Applets, but try not to drown in it.
then (and only then) tackle the J2EE 1.5 Tutorial (EJB3).
I'm still in the process myself. I've been at it for two months. Anymore than two hours at-a-time makes my brain hurt, a lot... you can teach an old dog new tricks, you just have to do it slowly.
Like already stated: Every position will have it's own technology set... two people sitting next to each other may use vastly different product groups. What I advise you to learn instead of "all the techs" is the process of learning technologies, and the considerations in selecting appropriate technologies to suit a particular problem, and organisation.
The best thing you can do to improve your chances of actually getting that job is to join a "Young IT Professionals" group (like this one in Australia)... they'll probably do a "mock interview" day... constructive criticism (as apposed to spoonfeeding) will improve your job applications, your CV, and your interviewability. Hanging-out with a bunch of people who shre your interests is informative, and fun. You'll miss that "brain stimulation" in the break between uni and IT work.
On the recession thing... I graduated B.Bus(Computing) a month after the dot-com bubble burst. I worked in a supermarket, drove a cab, delivered pizza, did some builders labouring, flogged PC's, vended bad financial advise to people who can't add-up for ${nameless_charlitans}, flogged anti-virus software, tutored at the local TAFE college, got a few short-term contracts writing software for a big accounting firm... then I started voluntarily fixing up the PC's at my local employment exchange (I was there waiting for appointments for hours-on-end anyway, and it was better than doing nothing)... The IT-dude there got me an interview with "a mate" (i.e. my job was never advertised), and the rest is history. Funny how stuff works out. I feel for ya', just please don't take the knock-backs personally... you're likely to get a lot of them... it's just how the game is played.
Cheers. Keith.
For the long term, work on an open source project. You'll learn a lot, and probably more quickly than you'd learn from a job.
My Java colleagues use this for most things.
Eclipse
Oracle or MySQL
Struts
Subversion
Bugzilla
JUnit
They also use Sun's Java Composite Application Platform Suite (JCAPS) for some things.
I think you need to take a close look at the companies you are applying to. The amount of "toolage" in the java world is way too much for you to become familiar with on your own in order to become attractive to any random employer.
I personally vote that the majority of it is overcomplicated crap, despite all the marketing hype that it gets. Find a company that looks like it works with stuff that you're interested in, find out what sort of stuff they use and then familiarize yourself with that. You probably won't be able to demonstrate job-level experience, but you will show yourself to be enthusiastic.
I'm going to go the route of suggesting what I feel are the most popular choices out there, which hopefully will give you more exposure to land that first job. Once you get your feet wet, I would recommend investing some of your free time to evaluate the other options out there. There is so much in the Java ecosystem to explore.
IDE: From people that I talk to, Eclipse seems to be the most popular. Netbeans is solid too but its future is in doubt since Oracle is working on acquiring Sun. A lot of folks swear by IntelliJ but I think it's much smaller community (and costs money).
SCM: Subversion and CVS are probably the most popular and Eclipse has built-in support for both.
Unit Testing: JUnit, it's the de-facto standard.
Builds: Ant, again the de-facto standard for build automation.
Frameworks: I would recommend either (1) Spring and Hibernate, the wildly-popular open source stack or (2) EJB and JPA, the Java standards. My personal preference is towards #1. As far as UI goes, there are a lot of options available, so it's harder to recommend. Struts and Spring MVC are more "old school" classic MVC frameworks whereas GWT and JSF are more "component-oriented" frameworks. You also have less popular ones like Wicket and Tapestry.
Assuming you can get your CV/resume read by someone and get an interview:
Get a copy of Effective Java by Josh Bloch, read it, memorize it and understand it. A lot of interviewers (and I have done more than my fair share) use it as a good source of techniques that people should know and understand.
In terms of tools - you can't go wrong if you know:
Eclipse
Spring
Hibernate
Ant/Maven/Hudson
JUnit
Log4J
These are all Open Source (and hence will fit anyones budget). Most Java shops will use at least one of these!
With below tools you can make sample/demo applications
IDE : JDevloper/Eclipse/Netbeans
Server: Tomcat/Jboss/Glassfish
Technology: Hibernate,Spring,EJB,Struts,Log4J,SLF4J,Hudson,Ant,Maven
Weblogic,Jetty,JBoss or Tomcat with
-Maven build tool (indirectly background Ant and library versioning)
-Prettify ("readify")
-Minify (spaceless)
-Refactoring (batch rename units)
-XML
-Stress test tool
Old tools e.g. rsync, emacs, awk, xargs, dd handle the largest files. less is good for streaming files (shift+F)
This really depends on the jobs in your area. I suggest you take an analytical approach.
Use a job search engine for you area and do keyword searches. This will give you hard numbers of job skills people are looking for in your area.
You may also find these pages useful 10 Hot Skills for 2009 The 2009 IT Salary Guide
Write an own homepage! It shows that you have fun when you write software (so you do it in your free time).
Build something you're interested in building and choose technologies that seem correct to do the job. At the same time, take the extra time -- as you should when working as well -- to use tools that might be a hassle but you think will bring you an advantage. Knowing frameworks like Spring or Maven or whatever may or may not be relevant. A good employer doesn't care what you know, but how you know what you know. Can you learn?
Use some note repository (like Evernote or my own, TheKbase :) and start making notes about your world. Whatever knowledge you have digested should be instantly retrievable and not based on your limited memory.
I was always interested in Swing and teaching, and strangely I got a job teaching Swing (which I knew a bit), but also teaching all kinds of stuff that I didn't know like Struts and XML security (you read the books and put in the time). Plus I taught IDEs, which I always liked even, though everyone thought I was an immature programmer because I wanted autocomplete :) Again, following preferences...
My point is that unless something about learning a framework or tool particularly appeals to you, don't bother learning it. On the other hand, if frameworks are particularly annoying for you (for me they have been), take the most annoying and daunting and build something with it. It's a rite of passage that most people do because an employer asks for it, which is too late, IMO.
You already have a good list of tools from the answers above. Here are a few things you could do to get more attractive to potential employers.
Participate in an Open-Source Project
To become a better programmer, learn
a language completely different from
Java. A good starting point could be
other languages on the JVM - Clojure
/ Scala.
Gain expertise in specific areas in J2EE that will make you stand out - security, performance analysis, etc.
Create your own website using the tools and the frameworks you have learnt
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I'm so tired of having to learn yet another Java web framework every other day.
JSP, Struts, Wicket, JSF, JBoss Seam, Spring MVC to name just a few - all this countless frameworks out there try to address the same issues. However, none of them really solves the fundamental problems - that's why there are still coming up more and more new ones all the time.
Most do look very bright and shiny on the first impression because they simplify doing simple things.
But as soon as it comes to the implementation of a real world use case one is running into problems.
Often the frameworks don't provide any help but are hindering one and limiting the options by forcing things to be implemented according to the frameworks own logic and environment.
In short, I see the following disadvantages when using a framework:
There mostly is a steep learning curve and you first need to understand sometimes quite academic concepts and know meaning and location of a bunch of configuration files before you can get started.
The documentation usually is more or less awful, either missing a public accessible online reference, is helpless outdated, confuses different incompatible versions or all of this together and often doesn't provide any helpful examples.
The framework consist of zillions of classes which makes it practically impossible to understand the intended use only by browsing the sources.
Therefore you need to buy some "XYZ in action for dummies in 21 days" kind of books which have a bad user interface because they are missing a full text search and are heavy to carry around.
To really use one of this frameworks you need to learn by heart how things can be done the way the framework requires it by remembering the adequate classes and method names until your head is full of stupid and useless information you can't use for anything else.
There is a big overhead, slowing down your applications performance and making your brain feeling numb when try to understand what really is going on.
In the real world there is usually no time to get well familiar with something new because of the pressure of being productive. As a consequence of this learning by doing approach one always looks only for the fastest way to get the next task done rather than really understanding the new tool and it's possibilities.
The argument that following a standard would allow people who are new to a project to quickly get started is not valid in my view because every project uses a different framework even within the same company (at least in my case).
It seems to me that the following quote from Albert Einstein fits here very well:
“We can't solve problems by using the same kind of thinking we used when we created them.”
Back in my good old PHP coding days when coding still was fun and productive, I used to write my own frameworks for most things and just copy-pasted and adopted them from one project to the next.
This approach paid out very well, resulting in fast development, no overhead at all and a framework which actually was mightier than most Java frameworks out there but with only a few hundred lines of code in a single file plus some simple mod_rewrite rules.
This certainly wasn't solving all problems of web development, but it was simple, fast and straight to the point.
While perfectly adjusted to the requirements of the current project, it also was easy expandable and had a very high performance due to zero overhead.
So why all that hassle with using this frameworks, why not throwing them all away and going back to the roots?
What should I say to my boss when we're starting tomorrow the next project with a new framework again?
Or are there maybe frameworks which really make a difference?
Or some hidden advantages I have ignored?
Back in my good old PHP coding days
when coding still was fun and
productive, I used to write my own
frameworks for most things and just
copy-pasted and adopted them from one
project to the next. This approach
paid out very well, resulting in fast
development, no overhead at all and a
framework which actually was mightier
than most Java frameworks out there
Forgive me for believing that not one second.
but with only a few hundred lines of
code in a single file plus some simple
mod_rewrite rules. This certainly
wasn't solving all problems of web
development, but it was simple, fast
and straight to the point.
So basically you developed your own framework over the course of months or years, tailored to your own needs, and could work very fast with it because you knew it intimately.
And yet you can't understand why others do the same and then try to turn the result into something useable by everyone?
Where's this great framework you developed? If it's so powerful and easy to use, where are the dedicated communities, thousands of users and hundreds of sites developed with it?
every project uses a different
framework even within the same company
(at least in my case)
Well, that's your problem right there. Why would you throw away the expertise gained with each framework after each project?
The idea is to choose one framework and stick with it over multiple projects so that you get proficient in it. You have to invest some time to learn the framework, and then it saves you time by allowing you to work on a higher level.
The problem with coming up with your own framework is that you will make all of the same mistakes that all of the established frameworks have already stumbled on and addressed. This is true particularly when it comes to security.
Just ask Jeff and the guys about what they had to consider when implementing the WMD in stack overflow. I'd rather use what they have produced in a project rather than implement it from scratch. That is just one example.
Here is a quote from Kev from the thread What’s your most controversial programming opinion? which fit's in here really well:
I think that the whole "Enterprise" frameworks thing is smoke and mirrors. J2EE, .NET, the majority of the Apache frameworks and most abstractions to manage such things create far more complexity than they solve.
Take any regular Java or .NET OMR, or any supposedly modern MVC framework for either which does "magic" to solve tedious, simple tasks. You end up writing huge amounts of ugly XML boilerplate that is difficult to validate and write quickly. You have massive APIs where half of those are just to integrate the work of the other APIs, interfaces that are impossible to recycle, and abstract classes that are needed only to overcome the inflexibility of Java and C#. We simply don't need most of that.
How about all the different application servers with their own darned descriptor syntax, the overly complex database and groupware products?
The point of this is not that complexity==bad, it's that unnecessary complexity==bad. I've worked in massive enterprise installations where some of it was necessary, but even in most cases a few home-grown scripts and a simple web frontend is all that's needed to solve most use cases.
I'd try to replace all of these enterprisey apps with simple web frameworks, open source DBs, and trivial programming constructs.
The problem is of course not just with Java frameworks. I've lost count of the number of C++ MFC projects I've seen floundering around trying to shoe-horn their requirements into the Document/View model (which really only workks for text and graphic editors - database applications are particularly difficult to shoehorn).
The secret of succesful framework use is to change your application to match the framework, not the other way around. If you can't do that, don't even think of using the framework - it will end up being more work than if you had written the app from scratch with the help of some good, reliable and well-documented utility libraries.
So are you saying we should deal in sockets and HTTP every time we want to build a web application!
The servlet container itself can be considered a framework, since it handles all these messy details, and leaves you to write much simpler Servlets/Filters/Listeners (ie: 'extensions' of the framework specific to your application).
All any framework tries to do is separate mundane, repeatable, error-prone, legwork code from the fun application-specific code.
However, for a small application, you can get away with simply having a Model 2 MVC approach 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 as your app becomes more sophisticated, you could look at using Spring MVC to provide looser coupling (and hence more flexible) of controllers, view resolvers etc..
I share your pain when confronted with yet another framework that doesn't do the trick.
Having survived ten years of jsp, struts, EJB, EJB2, struts2, jsf and now more recently all the new web services framworks, the xslt horrors and wsdl-first nightmares, I am definitely fed up.
There is a number of problems with frameworks. They leak so you have to learn more -not less, inhouse frameworks have huge costs, using external frameworks costs too (but much less), as they seldom deliver, and then you end up writing enourmus chunks of xml-configuration and spend days correcting case and spelling errors that you had seen immediately in your favorite content helping code editor.
Maybe the answer is to find less pompous toolkits that tries to solve a problem but not redefine the world, but that is hard too as the fundamental application model (html over http) is awkward - at best.
Add the fact that there seems to be a lot of complicators around, people that seems to be obsessed of trading boring simple problems to complex (but hard) interresting problems ( maybe a variant of Eric Sink’s Axiom of Software Development mentioned above.)
Add the hubris of developers that knows it all and do not hesitate to write a new framework to solve all the hard problems for you, Only that they can't, leaving 10% left, only much harder to fix now.
I have no .NET experience, but the .NET world seems to be less crowded with theorists and complicators, and maybe the lingering stink of VB is scaring them off, but everytime I hear someone telling me that they have spent 1500 hours on their maven config (hello?), I am seriously considering deleting "java" from my resume.
...what was the question again? Are there any frameworks that make a difference?
EDIT - added Stripes and QueryDSL.
I would try Stripes or GWT with QueryDSL + Hibernate or OpenJPA (with annotations) just for the fact that you actually develop in Java, and try to limit the use of wsdl-first web-services, xml-centric frameworks, EJB and ESBs (not the beer) as much as possible.
I once had to work on a project trying to implement it in JSF. It was a nightmare.
Most of the working time was spent to just making things compile. The fact that no less than half of what was compiled didn't work was another story. Almost no tutorials. Documentation is basically an automated source code export with no human comments. How can one be expected to work like this?
Of several frameworks we'd seen only Sun's was able to create a new project that is compilable at all! The other could only produce bunch of stuff it took many days to ring to a compilable state.
The web was almost silent. To any search there we no more than 20 pages of search results, with useful first 1-3. In that relevant what was found, a half of people was crying for help, the other half declared they had cried for help, noone came, they lost time and interest and dropped that technology.
So we spent times and only made something simple that could have been done in a few weeks with ASP.NET for example.
Then we looked at alternative JSF frameworks. To our surprise we found them all quite incompatible.
With not surprise at all, we joined the ranks of those who dropped JSF as well.
Consider the counter point. I am working at a shop right now that doesn't use any frameworks beyond the JSP standard. Everyone has a different way of doing things and we are very lax about concepts like de-coupling and security concerns like validation.
While I don't think use of frameworks automatically makes you a better coder, I do think by using a standard design pattern implemented by most frameworks and by having easy access to utility functions like validation, I think the chances are you are going to be forced to code up to a certain standard.
In web application design you aren't inventing the wheel every time, so you either end up rolling your own solution to common tasks, or using a framework. I make the assumption that by using a commonly used framework rather then roll your own, you are going to get underlying code that is well tested and flexible.
There is nothing wrong with rolling your own solution as an academic pursuit but I accept that there are people out there putting a lot more time into a robust solution then I may be able to spend. Take log4j for example, pretty easy to roll your logger, but log4j is well tested and maintained and they have taken the time to improve on flexibility and performance to a degree that most roll your own loggers can't touch. The end result is a framework that is robust but also simple enough to use in even the most basic applications.
What worked for me is: you shouldn't just learn any web framework you hear about, take a look at it, see if it makes you code comfortably, ask around stackoverflow or forums to see its advantages and disadvantages, then learn it and learn it good and just stick with it until you feel its broken or plain outdated. Any of the webframeworks you wrote about is good by itself and a fun to work with if you "REALLY" know what it does. if you don't you are just wandering in a desert with no compass! I've also found the 21 days book is a sure way for you NOT to master a framework or a technology. Docs is surely something to consider while adopting a f/w it also helps if you look around the code yourself (actually this is what helps me the best when I faced with some behavior that I find wierd.
1-So why all that hassle with using this frameworks, why not throwing them all away and going back to the roots?
if you go back to the roots you rewrite code that does the same thing again and again + most of these f/ws being open source means they are probably better off with maintenance than you would do alone to your own f/w.
2-What should I say to my boss when we're starting tomorrow the next project with a new framework again?
this is my first time working with this f/w I don't see why should we use this f/w I already know X and I am really good at it. bare in mind the cost of me learning this f/w, the cost of rework that has to be done due to my ignorance of such a f/w. I think we are better off using X, if this is a specific requirement we should fight for it and only do it if we really have to stating the previous notes.
Or are there maybe frameworks which really make a difference?
only those who address the way you think not the way you write code (think struts at its golden age enforcing the MVC pattern).
Or some hidden advantages I have ignored?
can't think of any tbh.
You have the same problem in PHP: more frameworks than you have fingers to count them on, each being the best and greatest (although you have some hints: pure PHP5 design vs. PHP4 compatibility, Rails philosophy (inflexible folder hierarchy, auto-generated code) vs. library approach...) and you spend more time searching and exploring the possibilities than writing your code!
But in PHP it allows to pre-solve common problems, like I18N support, integration of plugins, management of sessions and authentication, database abstraction, templates, Ajax support, etc. Avoiding to re-invent the wheel on each project, and to fall in common traps for newbies.
Of course, there are some hints for Java frameworks too: big or small? well documented or not? widely used or confidential? for XML fans or not? Etc.
I suppose most frameworks aim at large projects, where learning time isn't a big problem, scalability and ease of deployment are important, etc. They are probably overkill for small projects.
There is also a trend in such frameworks to aim at doing a consistent set of loosely coupled libraries rather a monolithic framework. That's the case, in the PHP world, for the Zend framework (some even deny the usage of word 'framework'...).
So it solves the issue of "resolving common problems" without getting in the way.
So you think it's better if we all invent the wheel in every project?
You might see an excess of frameworks as a problem, and it does make it harder to choose your own set. But on the other hand, you don't have to try each one; and even if you do, you'll end up preferring some of them. You will have a favorite framework for ORM, another for web development, IoC, etc.
It does help to read up on some forums to learn which are the most popular ones; they must be popular for a reason, and even if it's not the right reason (like being technically superior, maybe it's popular just among managers because of the buzzword overload or whatever), knowledge of said framework will be helpful because you will be able to participate in several projects that use it.
Plus, using a framework instead of writing your own will save you a lot of problems. Bugs are not always found and solved by the authors; that's often done by users of the framework. You said you ended up with your own private framework in PHP; I bet it wasn't bug-free, but maybe you didn't know it since you were the only user and the only coder.
However I disagree on some points that you have mentioned but I agree with you regarding the boring work.
Yes all web applications are about pages displaying forms, collecting data, making validation, sending the data for storage in Database, and filtering the stored data by search forms and displaying the result in tables and selecting one or more records for manipulation (CRUD, or business actions that all about changing status in database).
however I'm working for just 4 years plus of course my 4 years academic study.
I feel this type of development is boring as you are not inventing algorithms, off course you got happy when you discover new framework and will be happier if you integrated one of the AI engines into your application, but at the end I feel that this work is dummy works, or lets say machine work, so why we don't automate all of this stuff.
yes another framework ;)
MDA Model Driven Architecture, in brief is about transforming from PIM (Platform Independent Model) to PSM (Platform Specific Model), i.e for example from UML to Code.
And this may solves your problem of learning curve and technology changes as you will only need to be good at modeling, as there are some frameworks that implements the MDA specs such as AndroMDA as it have cartridges that take the Class Diagrams, Use cases, Sequence Diagrams, and Activity Diagrams and generate Database creation script, POJOs, hibernate mapping, Spring/EJB, JSF/Struts, .NET code.
Off course such frameworks will not generate 100% of the code but will generate a big percent, and off course you will ask whither this framework will solve complex and tricky scenarios of requirements? today I will say no, tomorrow yes.
so why you and I don't invest in the development of this great framework.
Heyja,
a frequently used answer to the question "What is so special about Java?" is "The tools and frameworks". I guess this is correct. I am stunned when i see all the tools and frameworks which make your life as a developer much easier.
My Java skills are not perfect, but good average, and i am still working on it. I have begun to learn Ant for example and i don't want to miss it. It's awesome. The same with Hibernate. Now i ask myself what i should learn next. I want to gain experience for myself and especially my CV. Unfortunately there are so many of it. And everybody is talking about it, like Spring, Struts, JavaServer Faces, Maven, ...
What is widely used in the real world? What tools besides Ant or Subversion/CVS are important? What framework is necessary to learn to be accepted as a "real Java programmer" and to get the interesting jobs? ;-)
If we're talking marketability, then you ideally want to be the kind of developer who can be productive at any layer of a production app. So learn something about each layer.
MVC: Struts, Spring MVC.
Data Access: Hibernate, iBatis, JPA.
IOC: Spring (huuuuge for integrating large systems. If you can, learn the AOP principles that Spring is based on)
App Server: Tomcat, JBoss.
Testing: JUnit
Presentation: JSF, JSP.
Also, don't neglect the non-Java technologies you need to know:
SQL - because you will need to talk directly to the database
HTML
JQuery - never underestimate the importance of neat UI features. For most users, that's the only part of what you do that they understand.
If I had to choose one thing out of this list, I'd go for Spring. If choosing two, I'd take Spring and JQuery.
If you want to be perceived as an expert Java programmer, there's no substitute for knowing the standard Java class libraries inside and out. I've seen way too many examples of Java programmers, even experienced ones, re-implementing things from the standard class libraries because they don't know they're in there.
JUnit is the most important Java framework to learn. Not only is it a valuable tool to use for unit testing, it teaches you what a framework should be: small and focused on doing one thing well.
Maven is worth learning, but I would suggest Spring. Spring will make your coding life much simpler.
The Apache Commons project provides a lot of useful tools that save reinventing the wheel.
+1 for Spring.
Struts 1.x is not the latest hype, but is probably worth knowing, as gazillions of lines of code have been written with it. If you're in the consulting business, you'll run into it one day or another.
Also, if you're improving your Java skills, I definitely recommend the book "Effective Java, 2nd edition" by Joshua Bloch.
Two suggestions, somewhat off topic:
Never put something on your resume unless you really know and remember using it. I came across too many candidates who put COM on their resume' without even knowing what the acronym stands for or how to define it.
IMHO, the ability to quickly find answers, learn and understand is far greater than a specific knowledge. Today it's Java and Spring, tomorrow it's Ruby on Rails. Who cares.
Eclipse is a must. Not only is it a great IDE, but it integrates quite well with other tools (SVN, Ant...).
I highly recommend the Find Bugs tool. It is a static code analysis tool that reports likely bugs in your code. The plugin for Eclipse is fantastic and is one of the primary reasons I don't use another IDE.