Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
We're trying to determine how to implement a simple plugin framework for a service we are implementing that allows different types of calculators to be "plugged-in".
After reading a number of posts about Java plugin frameworks, it seems like the most common options are:
OSGI
"Rolling your own" plugin framework
The Java Plugin Framework (JPF)
The Java Simple Plugin Framework (JSPF)
OSGI seems to be more than we need.
"Rolling your own" is ok but it would be nice to reuse a common library.
So we're down to the JPF and JSPF. JPF doesn't seem to be in active development anymore.
JSPF seems very simple and really all we need. However I haven't heard much about it. I've only seen one post on StackOverflow about it. Does anyone else have any experience with JSPF? Or any other comments on this design choice?
Update: There isn't necessarily a correct answer to this.. however we're going to go with Pavol's idea as we need just a really, really simple solution. Thanks EoH for the nice guide.
(Disclaimer: I am the author of JSPF, so better take my comment with a grain of salt ;-)
The main reason I started with the JSPF was because I had the same problem as you have now: I was looking for a simple solution to make my thesis-project 1) extensible and 2) give it a more or less clear code structure.
The reason why I haven't decided to use an existing framework was because most of them were so heavyweight to start with, that I got lost in reading documentation and was almost forgetting my original task. So, according to your statement
We're trying to determine how to
implement a simple plugin framework
for a service we are implementing that
allows different types of calculators
to be "plugged-in".
I'd think that you could give JSPF a shot and see how far you come within one or two hours.
However, the final decision also depends a bit on what exactly you want to achieve, and the specific circumstances.
I have heard positive results from a number of individuals who have been using it to structure their projects or load plugins in their projects. On the other hand, I also know of one person in our department who discarded it again because he didn't feel it was mixing well with his programming style.
So, to answer your question briefly (and surely in a biased way), I would use
OSGi for projects and teams
which are large and have many people working on it
that justify the overhead of setting up the infrastructure
in need of the specific services offered
JPF for projects and teams
of medium size (?, honestly I am not sure about the project / team size they are targeting)
which are in need of more structured facilities to organize their code, like XML configurations, detailed plugin lifecycle management, extensible plugins ...
JSPF for projects and teams
of small size, following an agile paradigm
that just need something that works out of the box, without the need of configurations or setup
willing to sacrifice some features for simplicity
I hope you find the plugin framework most suitable for your scenario. And, no matter what you try, I would be happy to hear about your results.
If you are planning to have just one (or only a few) not very complex 'extension points' than perhaps a well-defined SPI and a piece of configuration might be sufficient. No need to use a plugin framework.
By piece of configuration I mean some mechanism to find your plugins. For example something like META-INF/services/ or simply listing your plugins in a configuration file.
More details (upon request):
SPI = Service Provider Interface, an "implementer-side equivalent of an API". To learn more try searching for a difference between API and SPI. However in this context it is just a fancy term for an interface to be implemented by your plugins (i.e. defines the contract for your plugins).
A nice, short article "Creating a Service Provider Interface" by Ethan Nicholas describes how to create your own SPI in similar way as it is done in several part of the Java Platform itself.
META-INF/services/ can be seen as a more generalized approach to creating SPIs. More information can be found in the respective section of the JAR File Specification.
If you need a really simple solution, try jin-plugin. It is a minimalistic plugin framework for Java and PHP.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I am about to start a new software project. I know that a good planing and software design leads, eventually, to a successful software project.
I am wondering, How do I go about a software architecture where you have a core module and other plug-able or add-on modules. The modules can be excluded and included based on clients needs and pricing and can be turn off and on based on clients own configurations.
For example, let us take some financial software and there is a module that does statistics about the market clients. Then some client- of my product - does not want to buy this module because they don't need it. What is the best way to design my architecture so that I can exclude with the least efforts and least code touching- without touching it at all if possible - ?
we can discuss several topics like package organization, using some frameworks like JPF, Interface and Inheritance and so on ...
Thanks in advance.
This is a very very broad topic for summarizing it in stackoverflow discussion but lets try. The first really basic need in my opinion is to have a very detailed knowledge of the domain the software is going to serve. Before starting any design not mentioning about coding, the first thing is to have the necessary know-how of the domain.
Once you have that, you start defining some core modules which will be the fundamentals of your software. Typically for example you would need network, configuration, io, core, persistence, tools, etc. Personally i define one module with a package for example if i say core module i would refer to packages such as: com.example.core com.example.core.utils. Core packages are more infrastructure work. like preparing the ground before start building the real software.
Having on a blackboard the design of separate modules and their dependencies, a good practice is to use maven as the build tool. Design each module as a separate project and include it as a dependency via maven for other modules/projects. And this will form the plug-gable modules. within each module provide configuration support (based on xml, json or even plain txt files) so certain features can be turned on/off or modified. So based on license agreement you can easily provide a build with the required modules and modify inside each module the feature configurations.
This is a very Interesting Question that developers often take for granted.
Some Developers think just jumping into code generates the ideas, requirements and functionality overtime - This however may be true but often jeopardizes Good Architecture, Flexibility, and Robustness.
For a new Software, Time should be spent in Requirement gathering (even if possible, reading and getting both broad and specific understanding about the domain and its current process flows, also rules and other constraints.
Get more understanding of the Domain
Come up with a Requirement Document
Identify the key Objects in the domain
Create a simple Model Diagram and identify the relationships in a broad context
Identify Major Use cases
Although this times may seem being wasted and also dead ends in generation of ideas and requirements, looking back, one would always appreciate the time sacrificed to carry this out
I also recently started a new Software project and had really tough time doing the Planning, but on the long run. Both I and others who looked through the Requirement Documentation and Diagrams appreciated it.
Coming specific to your question, Meta-Programming is a very good way to model a core module that scales ............Look into this openMRS opensource software to have an idea of a very good core Architecture
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
I have developed many desktop applications in Swing, even those a bit more complex, with Hibernate and Spring integration. I found out that many things repeats and should be done quickly and in convenient way, like application lifecycle, logging, alerts, authorisation, forms and their validation. I started looking for frameworks. I met Swing Application Framework which is dead since several years, as it turned out. Spring RCP really met with my expectations, especially creating forms basing on Java Bean model is what I liked, but I realised it is dead too. Netbeans RCP is not for me, I am using Eclipse and I don't want to use another IDE for desktop development. I am not really excited about Eclipse RCP, I got feeling that it is too Eclipse oriented, I would prefer something low coupled to any tool, besides it is not so straightforward to learn.
I am surprised that there is so weak support for developing desktop-based business applications in Java. It's like Java was only used in web environment. What is the preferred language for making such apps then? And if I want to stay with Java, is there a chance to find something similar to Spring RCP (so far I couldn't)?
i asked a similar question some time ago, see Swing desktop-development if you are interested.
My conclusion was/is that there simply are no frameworks that can do for your desktop-application, what any of the bazillion great WEBframeworks can do for your webapplication. It seems absurd, but in my experience due to the great web-frameworks and the lack of desktop-frameworks it has become much easier to develop a webapplication.
I have been using Spring-RCP for 2 projects. It was great, but is pretty much unusable nowadays, because you are stuck to spring 2.5 with it. Also it "feels" a bit slow to me and is really memory hungry on 64-bit machines, which is a Spring-Swing problem most likely: https://jira.springsource.org/browse/SPR-9628
I waited for Project Valkyrie, but it seems to be dead already
I think you will not find anything that completely covers your requirements. http://swingx.java.net/ could maybe offer you a few GUI-Widgets, like JXDatePicker. I also recommend JGoodies Binding and JGoodies Form, both are great. IF you use a client-server application i highly recommend using Spring-Remoting (e.g. HTTP Invoker) with Spring-Security. Really makes things simpler.
I enjoy developing desktop-apps with Swing, but unfortunatly you really have to "go the extra mile". Client-Server-communication, security or even validation are only a few examples of the many things that seem overcomplicated these days (compared to modern webframeworks). Also you might find out that it is not as easy to automatically build, sign and deploy an application with java-webstart as it should be.
Spring-RCP was the closest thing to a "complete" desktop-framework that i found so far and it has been dead for years.
Good Luck!
Please try griffon. This is based on groovy language and inspired by grails framework. It runs on JVM, language is very much friendly for java programmers.
Quote from the site
Griffon is an application framework for developing desktop
applications in the JVM, with Groovy being the primary language of
choice. Inspired by Grails, Griffon follows the Convention over
Configuration paradigm, paired with an intuitive MVC architecture and
a command line interface.
....
The architecture is very much extensible.
The Griffon framework is extensible via Plugins. There are many to
choose from. For example you'll find plugins for 3rd party Swing
components like Swingx, Jide and Macwidgets; persistence related
plugins like DataSource, GSQL, Hibernate among others; 3D graphics and
animation support is possible via JOGL, LWJGL and Processing. And many
more!
It mostly depends on the size of the application.
For smaller and medium sized apps it makes sense to use JavaFX 2 that does not use a differnt language, you can start of by some of the basic tutorials .
As you have mentioned for Enterprise level application Eclipse RCP and Netbeans RCP are a good pick.
Netbeans RCP is lot simpler for development, you should not dismiss it just because of the IDE preferences. There is a free book about it that is a good starting point.
There is also the option of e4 that should be significant improvement for eclipse but I can't say that I have used it yet
Related resource worth looking might be :
http://netbeans.dzone.com/why-from-eclipse-rcp-to-netbeans-platform
Netbeans RCP vs Eclipse RCP
Check out JGoodies. Not only is the Look and Feel much better they also offer a framework to design Swing apps.
The big issue when it comes to desktop applications is that it really depends on what you're trying to design. Unlike webapps where it's webpage->request->webpage, desktop application can pretty much do anything. There is no standard cycle, even for business apps. It's much much more like AJAX than say your normal Java EE or PHP webapp. And how many AJAX libraries actually offer a framework other than calling and updating specific components.
You could have menus, buttons, panels being updated, things being rendered on the fly, graphs changing, data being updated, etc.
If you're just looking for forms, then JGoodies is probably your best bet.
I don't know of any framework as such, but Netbeans provides a drag and drop wizard for Swing components. Eclipse also has similar plugin but it is based on the Netbeans plugin.
I found out that many things repeats and should be done quickly and in convenient way, like application lifecycle, logging, alerts, authorisation, forms and their validation.
I'd recommend to extract these into your personal "Core" library that you can share and use across all your projects. Since you already implemented the things you're talking about, it should be easier to generalize them than study a completely new framework. Probably, a private Maven project?
The development focus is moving towards Web and Mobile, so we shouldn't expect any considerable efforts from framework vendors for Desktop.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
And by the right guide, I mean one which doesn't necessarily focus entirely on how to program in Java, but puts forth a bit of effort on everything else. In other words, something which has enough information on the things which IDEs like Eclipse do for you, and how to manage those things without using an IDE.
Some examples of what I'm looking for:
How to import Java files without packaging them first.
How to specify directories for file/package imports, and where that specification needs
to be placed.
How to use Gedit to effectively program in Java with nothing but a few plugins and command line for compilation.
Great compiler error avoidance practices.
Seriously, I've looked enough now to come to the conclusion that Google really can't just hack what I need, and my best bet is an actual resource filled with lots of information.
If anyone has any ideas or thoughts on where I should look, or even an answer to any of these questions specifically, I would greatly appreciate the input.
IMHO you can't effectively program in Java without IDE (especially working on bigger project). You should learn about using/setting CLASSPATH, also check documentation for basic JDK commands (javac, java, jar, javadoc etc.).
Eclipse IDE has support for other important project tools e.g. Ant and Maven (for example with M2Eclipse plugin), so you can learn them too if you want.
Check this question for more lightweight IDE than Eclipse.
Java programming is quite a broad area. You may wish to do web-programming or Swing and there are lots of frameworks and framework combinations to work with.
If you want to be productive there is no way you can survive, especially for large projects, without using one IDE, or maybe even two. You will need a simple JUnit integration, as well as a debugger and automatic code generation for POJO methods, and autocompletion and refactoring capability and you name it.
I think that the best IDE for Swing development is Netbeans7. Matisse is implemented best, stable and fast. You can drag and drop anything you like anywhere and the generated code is always clear and well organized.
Eclipse has a great GWT-Designer. It is also great for Struts2 programming etc. Both work great with Maven and Ant and Hibernate.
If you need three months for a project you can do with an IDE in two weeks, there is no point in not using an IDE. On the other hand there are also masochists between us...
I recommend programming with an editor and the shell only for beginners, until they get the grasp of things and understand layouts, jars etc. Using a graphical tool to get started is wrong, since the students learn to drag and drop components mechanically and relying upon lack to get things straight. Only as soon as one knows how things work, is IDE a one way street. You never look back again. There is amazing free software today.
Eclipse has a very thorough Java dev guide, which should tell you pretty much everything it will do for you. http://archive.eclipse.org/eclipse/downloads/drops/R-3.1-200506271435/org.eclipse.jdt.doc.user.3.1.pdf.zip I think the guide does a decent job as far as helping you help yourself as well, so I think it could still be a worthy source for what you are seeeking.
In other words, something which has enough information on the things which IDEs like Eclipse do for you, and how to manage those things without using an IDE.
So you acknowledge IDEs are great. Why aren't you using one? In particular, IDEs come with step by step documentation on how to accomplish these simple tasks. I suspect the reason there is little IDE agnostic documentation on these things is that most people actually use IDEs.
Great compiler error avoidance practices.
I for one wouldn't want to code without the Quick Fix feature of eclipse ...
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.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I'm working on getting an Introduction to Groovy presentation ready for my local Java User's Group and I've pretty much got it together. What I'd like to see is what you all think I just have to cover.
Remember, this is an introductory presentation. Most of the people are experienced Java developers, but I'm pretty sure they have little to no Groovy knowledge. I won't poison the well by mentioning what I've already got down to cover as I want to see what the community has to offer.
What are the best things I can cover (in a 1 hour time frame) that will help me effectively communicate to these Java developers how useful Groovy could be to them?
p.s. I'll share my presentation here later for anyone interested.
as promised now that my presentation has been presented here it is
I don't know anything about groovy so in a sense I've qualified to answer this...
I would want you to:
Tell me why I would want to use Scripting (in general) as opposed to Java-- what does it let me do quicker (as in development time), what does it make more readable. Give tantalising examples of ways I can use chunks of scripting in my mostly Java app. You want to make this relevant to Java devs moreso than tech-junkies.
With that out of the way, why Groovy? Why not Ruby, Python or whatever (which are all runnable on the JVM).
Don't show me syntax that Java can already do (if statements, loops etc) or if you do make it quick. It's as boring as hell to watch someone walk through language syntax 101 for 20min.
For syntax that has a comparible feature in Java maybe show them side by side quickly.
For syntax that is not in Java (closures etc) you can talk to them in a bit more detail.
Remember those examples from the first point. Show me one, fully working (or at least looking like it is).
At the end have question time. That is crazy important, and with that comes a burden on you to be a psuedo-guru :P.
I'm not sure about how the Java6 scripting support works but I'm fairly sure it can be made secure. I remember something about defining the API the script can use before it's run.
If this is the case then an example you could show would be some thick-client application (e.g. a music player) where users can write their own scripts with an API you provide them in Groovy which allows them to script their app in interesting and secure ways (e.g. creating custom columns in the playlist)
I'd go for:
Closures
Duck typing
Builders (XML builder and slurper)
GStrings
Grails
I'd mention the following things in addition to what has already been stated:
GDK - extensions/additions to existing JDK classes
Interaction between Groovy and Java code (basically a non-issue)
Compiling Groovy code to Java .class files
XML parsing and mechanisms for accessing document content
One thing I like doing with Groovy is implementing an interface defined in Java as a map from method names to closures. It's a cool thing you can do with Groovy, but probably well beyond an introductory presentation though.
Include an example of how making Java code more groovy takes away soooo much code. Wait for them to pick their jaws up off of the floor before continuing. Scott Davis has a simple example at the beginning of Groovy Recipes that takes 35 lines of Java or 3 lines of Groovy.
You should definitely show them how to create a quick Grails application. Two domain classes that are related. Build a basic CRUD app. Explain that tables are being created behind the scenes using GORM(Hibernate). Then explain that you can create a war file and deploy it as you would any other Java war file. You can also add Grails/Groovy to an existing Java/JSP project so it doesn't require a huge commitment or paradigm change.
Groovy/Grails is simply Ruby/Rails for Java people. I'd cover the plugins for Netbeans/Eclipse too. Groovy/Grails are just now getting full support in the major IDE's.
Finally, if you can find a good diagram that shows how Grails is built on top of Spring, Hibernate, Quartz, Sitemesh and Groovy, I think people will understand that there is a treasure chest waiting to be unlocked.