Alternatives to Freemarker when using Spring/Hibernate? [closed] - java

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
What are some modern, more-productive alternatives to Freemarker as view technology for rich web-applications using Spring? Is Spring MVC/Freemarker still one of the best combinations, or are there others?
The application I have to build is small, but complex that will likely require a lot of custom javascript as all of the controls and ui is very non-standard (it's not really a business application). Blizzard's gaming websites like for Diablo 3 is an example of what I'm trying to do.
Is this combination still the best to suite my needs, or are there other technologies I should take a look at?
Thanks

There are several good and well established template engines on the market. Most of them play nice with Spring.
Velocity - a classic and one of the most popular template engines out there. Quite good, quite flexible, ugly syntax but good Eclipse plugin.
Thymeleaf - one of the most feature rich and flexible template engine on the market. Performance is good, although not ground breaking. My personal choice for most of the projects.
String Template - really good performance, quite hard to use. Very flexible, thought...
MVEL - seems to be really, really fast and quite feature-rich. For me it was to complex and quite hard to use in a project with junior devs.
Rhythm - from a Play framework to Java, nice and very flexible. Razor syntax is great. Rhythm is really fast, very flexible and nice to use. Another personal choice for my projects, next to Thymeleaf. There is a nice article on how to use this engine in Java.
httl - small, easy to use, not that fast but still good enough. Quite flexible but not that feature rich.
Trimou - another fairly new kid on the block. Looks decent, uses Mustache templating syntax and is fairly easy to use. But for my taste a bit too simplistic and missing some features.
Rocker - apparently a fairly new development, actively maintained and extended at this time. I like it, it has a nice idea for the syntax but it is nothing that resembles other syntaxes. A lot of simple features, missing some advanced ones IMHO. Very performant according to a test we just made.
Pebble - we used it for a couple of different purposes and it proved rather simple to use with a decent syntax inspired by Twig from PHP world. Performance is really good, one of the fastest we tried.
Performance wise, according to our tests, in order from the slowest:
Thymeleaf
Freemarker
Velocity
Trimou
Mustache
Pebble
Rocker
Your mileage may vary!...
There is a nice comparison of few of those (quite old article).
Also a nice tutorial on how to use some of them by Baeldung
There are plenty of template engines out there. Check this directory if you need more...

Related

Phonegap vs native for ease of developing? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I know it has been asked many times before but I am still confused.
I need to develop an application that works mainly with data, something similar to facebook for example.
I want to target both Android and ios.
I do know some Html/css/javascript though I am not an expert.
I find it very difficult to work with Javascript, difficult to debug etc.
Will it be easier to work with Java/ Objective C?
From my experience .Net is 100 times easier then Javascript. Is it the same with Java/Objective C?
Also I am looking for the long run on how to work in the next projects(which will also be information based), so I am willing to sacrifice time and learn platforms. What will be the learning curve for on against the other, and once you know the platforms, what will be easier?
Another question: do you think there will be a demand for phonegap developers in the future? since I don't think that now it is in demand/use, as the expectations were from this platform.
I'll try to answer some of your questions:
If your app is data-intensive (facebook example, a lot of multi
threads to load a lot of data) you should use native language for
your app because it will be a lot less slow. I develop both in iOS
and Android, the learning curve really depends your own experience.
If you are better at object-oriented languages and have experience
with listeners Android will be easy as pie. But learning to develop
in ObjectiveC requires to have some experience with pointers and
structure/funcion-oriented languages (C,C#,C++). I find Android to be
easier for beginners tho ;)
Phonegap at the moment is a very good choice for small, light apps,
and it's community is growing bigger and bigger (you got Cordova
also, works just like Phonegap) and if you have experience with web
development and design it will be a LOT easier to develop your first
app.
There is a big BUT in using Phonegap/Cordova: the UI is slow at the moment, by that I mean that when you click a button or icon it is somewhat slow to react compared with native...if your app is client-oriented I wouldn't use Phonegap. This "slow" effect worsens with data-heavy apps so take care what you decide.
Hope that I've helped you out, feel free to ask anything ;)
Will it be easier? Not so much when you get the hang of it. I have made a web app using PhoneGap and I still liked writing it in the native enviroment (PhoneGap did not produce the results which I have hoped for).
If you really have time and you're willing to learn then you should go native. That way you will learn more languages which will benefit you more in the long run. Java is going to be easier if you're used to OOP. But don't be scared of anything. Go for it!
In the future? Well JavaScript, HTML5+CSS3 is already popular and might grow even more.
Use PhoneGap for small and light apps and not for "Facebook" type apps:)
Thats just my humble opinion.

Single page Web App in Java framework or examples? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
Has anyone seen an example or done the following in Java:
http://duganchen.ca/single-page-web-app-architecture-done-right/
That is a design a single page web app that will work with Google SEO with out massive violation of DRY using Java technologies?
It doesn't seem terrible hard to do this on my own but I was curious (and lazy) to see if someone had already done it with either Spring or JAX-RS.
I have built quite a large "single-page" javascript website, that generats all HTML on the client. Server provides JSON only responses. I used Google Closure tools for the following reasons:
Google Closure Templates allows designing templates in high level templating language (named soy) which is compiled either to pure javascript functions to run on the client or java code to run on the server site.
Google Closure Compiler, which allows separating javascript code to modules and provides autmatic dependency injection for uncompiled mode. Good program structure and modularisation is necessary for any project exceeding simple html decoration. This is hard to achieve with frameworks like jQuery or dojo. In advanced compiled mode it transforms your javascript to shorter an more efficient equivalent, eliminates dead code and do dramatic reduction in size, which can shrink the original codebase to few % of the original size.
Google Stylesheets is meta css language which works great with closure compiler.
Google Closure Library is huge and well tested javascript library and with closure compiler, you only take what is needed.
To streamline the development, I'm using plovr, written by Michale Bolin, a former googler, one of the members of the original Closure Compiler Team.
I can recommend reading Michale's book: Closure, the Definitive Guide.
I must but warn, the initial leraning curve might be quite steep, but it is well worth the pain. Google used this tools to write almost all their web projects.
Just one more thing
If you feel really adventurous, and want to peep in to the future, I recomend upgrading the former strategy with Clojure/ClojureScript. For the start, watch this very persuasive talk of Rich Hickey and make sure to check Clojurescript one project.
I recommend AribaWEB for its advanced AJAX usage.
http://aribaweb.org/
Take a look to ItsNat, is a Java framework focused on Single Page Interface SEO compatible websites.

Are there any tools for detecting architectural and design patterns in code? [closed]

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 6 years ago.
Improve this question
Our team is doing reverse-engineering on a application with virtually non-existant documentation. We want to detect if there's a use of architectural or design patterns. You may understand that this application is large, so looking manually is no sense for us.
This application is written in Java and we use Eclipse for IDE, so it may be a plugin for Eclipse.
We have found some tools, like "Design Patterns detections Similarity Scoring", but it's not working very well.
So, such tools do exists?
If you have the source code of the app, you are most probably reengineering it, rather than reverse engineering. (The latter means recovering some sort of higher level code from machine- or bytecode).
At any rate, you want to understand the application, i.e. build a mental model of it in your mind. I am afraid automatic tools aren't of much help in this. What use would it be for you to get a list of supposed patterns in the code? Would it help you understand better what the code actually does and why? Especially taking into account the high chances of patterns being misused in legacy code :-(
In the end, you need to get down to reading the code anyway. But here is another similar thread which hopefully helps in the daunting task of taking over a legacy app.
I do not believe these kind of tools exist, because that would be pretty complex. Another approach could be to generate something like an UML diagram. This should give an abstraction of the code which could help you identify the design pattern.
I doubt there are tools out there for detecting patterns or designs in code
Code Bubbles could drastically help the reverse engineering effort, when it eventually comes out !
Lately, am finding it extremely useful to use code coverage tools to identify which parts of the code are called when a particular user/system action is initiated. It's not what the tools were designed for but am increasingly finding it more effective than other approaches. (Can post a link to details here if there is demand for it)
The next best approach is using a tool such as MaintainJ to trace code execution. This link documents that approach (when the author talks about aspects) and various other approaches, and having tried them all, coverage is what I've settled for.
Have you tried running javadoc on the code base? That would give you some idea if the structure (or lack of it) of the code. If you are really lucky design patterns might be mentioned in the comments.
There are lots of other tools for discovering class hierarchy - ClassCycle, Macker, JDepend etc.
Automatic detection of design patterns would be quite difficult I think, because a design pattern carries a lot of scope for variation.

Why should I learn and use struts? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
I'm a java developer, not seasoned, but I am familiar with most concepts reasonably well.
I recently built a website using Tomcat/JSP (~30 dynamic pages). I made the newbie mistake of including large sections of core logic in the JSP, using the rationalization that it's "just a simple project".
I learned the hard way. So I'm re-building the app now in google app engine using servlets and planning to use Velocity to implement it using a Model-View-Controller design pattern.
I'm also looking at Struts, but haven't used the framework before.
Can someone convince me why I should incorporate struts into this project? Is it really going to buy me a lot for a medium sized project of one or two people?
There is a clear cost in an extra learning curve with strut, will the benefits outweigh the costs? Or will the use of Velocity be enough to segregate the logic? Opinions?
I would look longer term than this project. As you saw, first time you use any technology is largely about making mistakes and learning from them. So this first project won't likely be a shining example of Struts usage once you're done.
Using Struts (and Tiles from what you indicate was a main concern: JSP copy and paste) will however be an excellent delve into "proper" MVC, i.e. it forces you to do things in a particularly structured way, and one which I happened to appreciate a lot, I was a big Struts fan.
That said, there are other options, e.g. Spring contains Spring MVC plus much much more. If you're going to invest in overcoming a learning curve, think about which framework will most benefit you overall in the medium term: which frameworks do employers in your area tend to look for, for example? At this point in time, I would go with Spring where I feel the momentum is but Struts is very good at what it does.
If you're going to learn a framework then I'd recommend Spring MVC over Struts. The learning curve isn't too steep and there are lots of Spring resources available on the internet.
Once you've got Spring in place you will find your application is much simpler to maintain and support. You'll also be able to add enhancements, like security, a lot easier.
First: don't let the name confuse you: Struts2 and Struts are very different frameworks.
Second: changing from JSP to Velocity can be a good or bad decisition, but that's not exactly the point. The point is to switch away from Model1 (rather ancient nomenclature, but still useful). That is, decoupling your view layer from your logic layer. (You can use JSP or Velocity for your view layer).
Furthermore, to decide your view layer is just a part of your architecture: you still must decide who will process the request and produce the data that will be sent to the view. The most basic option is to use plain servlets, but, again, it's better to use some framework. For this, there are a lot of frameworks in Java. The "action based" ones are a subset among them, perhaps the most simple to learn. Among them, the oldest is Struts; today the most used for new projects are (in no particular order) Struts2 , Spring MVC and Stripes - they are quite similar.
Learning to separate the logic is excellent. You can do that without using Velocity, Struts or any framework whatsoever, and you'll likely learn more about what it takes to do this separation if you try it with minimal help first.
Learning a framework (in fact multiple frameworks) is also worthwhile, but I wouldn't personally choose Struts as a first framework unless it's the one used by your employer or a prospective employer. If your employer is using Struts, I hope it's Struts 2, as Struts 1 is getting ancient.
The framework I like to work with the most is Wicket, but it's a radical shift from what you're currently looking at. SpringMVC is also definitely worth a look.
If your employer is already doing web development in Java using a framework, try to learn the framework that's actually in use, and ask your co-workers for help learning it.
Why you should learn Struts? My answer is: because employers often require knowledge of it, especially for maintaining of older projects. I didn't make any precise measurements, but I think that at my region JSF and Struts are used for web application development most often.
Struts is a quite old web framework, and it's quite clumsy to write modern AJAX GUIs with it, so there were created better frameworks. JSF is for me a bit less clumsy, but also has some problems. My favourite web frameworks are Vaadin and GWT, but I'm not suggesting anything for you - you should make the decision by yourself.

Tools for converting non-Java into Java source [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
Are there any good tools out there for automatically converting non-Java source code into Java source?
I'm not expecting something perfect, just to get the worst of the grunt work out of the way.
I guess there is a sliding scale of difficulty. C# should be relatively easy (so long as you ignore all the libraries). (well written) C++ not so bad. C requires making a little OO. (Statically type) functional languages may be easy to grok. Dynamic OO languages may require non-local analysis.
One thing you can try is find a Java bytecode compiler for the language you're talking about (there are JVM compilers for all kinds of languages) and then decompile the bytecode back into Java using a decompiler like Jad.
This is fraught with peril. The regenerated code will suck and will probably be unreadable.
Source-to-source migrations fall under the umbrella of Program Transformation. Program-Transformation.org tracks a bunch of tools that are useful for language recognition, analysis, and transformation. Here are few that are capable of source-to-source migrations:
ASF+SDF Meta-Environment - As noted, there is no new development on this tool. Instead, the developers are focusing on Rascal.
Rascal Meta Programming Language
Stratego /XT
TXL
DMS® Software Reengineering Toolkit (commercial)
If you spend any time with one of the open source tools, you'll notice that even though they include source-to-source migration as a feature, it's hard to find working examples. I imagine this is because there's no such thing as a one-size-fits-all migration. Each project/team makes unique use of a language and can vary by libraries used, type complexity, idioms, style, etc. It makes sense to define some transformations per migration. This means a project must reach some critical mass before automatic migration is worth the effort.
A few related documents:
An introduction to Rascal - includes a migration between the toy language Pico and Assembly starting at page 94.
Cracking the 500 Language Problem
An Experiment in Automatic Conversion of Legacy Java Programs to C# (gated) - uses TXL
Google: ANTLR
The language conversion is fairly simple, but you will find the libraries are different.
This is likely to be most of your work.
If you just want to use some legacy C/Pascal code, you could also use JNI to call it from Java.
If you want to run it in a Java applet or similar constrained environment, and it does not have to be very efficient, you can use NestedVM (which is a MIPS to Java bytecode converter) in conjunction with a gcc cross-compiler that compiles to MIPS). But don't expect to get readably Java code from that.
Any of those tools might help only if your non java code is not huge enough.
If its huge non java code and if you want to seriously translate it to java, then few things need to be thought of, its not just hundreds of lines of code, there is a design beneath it, there are few decisions taken by people beneath the code due to which certain problems might have been solved and few things have been working there. and investing time on any good translator won't be worth as it won't exist, it's not just syntax translation from one language to another.
If its not so huge code, its better to re write in java, as it has so many APIs packages out of box, it might not be big deal, hiring few interns for this also might help.
ADA to Java can be done with a find-and-replace!

Categories

Resources