I develop server-sided products using websites as interfaces. The underlying logic is usually complex, however, the user interfaces are VERY simple (most of them are simple CRUD operations on mysql tables. The most complicated query usually takes a few joins, and everything is usually performed in an stateless way, except for user credentials).
Until now, I've designed my projects in this way:
- Executable file(s) with the complex logic, usually in C++, sometimes in Python or Java if time is a rush or there are really good libraries available and performance is not a key issue. It runs in background as service or gets invoked by PHP, depending on the project't needs. They're mostly Python, Java or C++. Background processes usually write directly to DB, while executed files give their output via stdout/err
As I said before, normally our websites are REALLY simple, so I built the base API and base website on top of Code Igniter for simplicity; as I said, that part of the application is really simple and covered by my own general classes.
I've two main problems:
- I'm the only PHP developer left on the company, so my boss feels bad about project maintainability. He likes Java and I know Java, so he prefers to use Tomcat.
- I've no professional experience on Java frameworks and I don't like to code the same things over and over again for every project, neither filling'em with boilerplate copy/pastes, so if I want some structured, pretty piece of code other's can understand frameworks are the way to go, as I'm not experienced enough with Tomcat to do it from scratch.
The next project I'll face would be much easier to implement with a state-aware server, such as Tomcat. I'd also like to be able to declare classes on an application scope (or some equivalent thing that makes them instantiated only once when Tomcat starts, if the framework discourages that practice).
Which Java frameworks are the most suitable for my problem and overall situation? My plan is to make a seed-project to make my projects homogeneous, however, it may be better to use generation tools, what's your experience about it?.I've time to play around with the framework before starting the project itself.
Right now, my colleagues who code Tomcat are currently using a mixture of the following:
- Mybatis for DB abstraction. It seems to be too big. It looks like I'll be using just 5% of it's power for my projects.
- Tiles for visualization homogenization
I've no experience with struts, but it looks easy, so my first thought was to follow their schema to make the projects more homogeneous, which the side-advantage of having people I can ask questions sitting next to me, however, it looks like it produces too much boiler-plate, and that modifying certain things get tedious after the automatic generation process, but it may be just the lack of experience.
As I said, our endpoints are very simple, so I'd prefer a light-footprint framework. I know the best framework is the one you're most comfortable with, and that if my colleagues know a specific framework it is much better to just play along, but as I said, I've no experience with java frameworks, so I've to learn one anyway, so I wanted opinions based on experience.
SIDE question: As I said before, most my projects have a REST Api endpoint. PHP looks perfect for this, as is not type enforced, however, with arbitrary shape data structures, Java is not as easy as PHP. I remember from my Java times that I used Google's Gson library to handle JSON encoding/decoding, and it seems to still be trendy right now. It used to fulfill my needs in the past. Any thoughts on this?
side question 2: Imagine the following scenario: I've a Tika parser to extract plain text from documents. My first thought is to instantiate the Tika parser on application scope and then call it's methods when needed. In C I'd need to handle concurrency by myself, is Tomcat doing it properly? what are the best practices with tomcat? I'll be on an intense tomcat documentation reading this night, so I'll probably be able to answer myself on this one soon enough.