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
I am developing a MVC rich GUI application in Java and I have to use an external scientific library which already defines most of the classes that I will potentially use in my domain model. What are the best practices in this case? may I need to wrap all the classes defined in the library with interfaces?
Personally I would wrap 3rd party classes into implementation of my interface if:
the 3rd party library is still evolving (new changes are expected)
the 3rd party library is not solving all my issues
I don't want to stick with only one provider (of the scientific library)
my application is long term project
Otherwise I would us the 3rd party classes directly. Introducing unnecessary layers of abstraction at the beginning of the project is very often waste of time.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
It seems to me that there are many instances where implementation of a specific class is the same for different projects.
In Java this is true for classes like ArrayList. So there is obviously reason to reusing generic classes across different projects.
Another generic class that would be usefull would then be ArrayMatrix, but since there is no default implementation in Java I made one myself. It's generic, safe and documented.
Is it common practice to create your own implementation in a situation like this?
If not, what's the preffered way?
If it is, what's the best practice way to share the class/code between projects and organize your "library"?
This is the entire point of having libraries. The best way to share them is to put them in an artifact repository; if possible, Central and JCenter, or some company-internal repository if the libraries can't be open-sourced for some reason. Here's the intro to publishing to Central; it's a minor hassle, but I've done it myself, and it's not too difficult.
I would encourage you to make sure that an equivalent to your class isn't already available in something like Guava or Apache Commons.
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 8 years ago.
Improve this question
I'm trying to make a small crud application using swing, with Authentication features and GUI.
Can you give me the right organization and naming of my packages ??
There's no hard and fast rule, but the rule of thumb is to start with your company's domain name in reverse:
com.mycompany
Then add on the project:
com.mycompany.project
This ensures you're unlikely to have clashes between your classes and those from the libraries you depend on.
Then personally I try break things down by their functional groups, for example
com.mycompany.project.domain // contains the business domain classes
com.mycompany.project.io // contains the classes that deal with network or file-system
com.mycompany.project.persistence // contains the classes that handle persistence of the business domain classes
com.mycompany.project.ui // contains the user interface related classes
Within those packages, I might have further group but that would be very specific to the project.
The important thing is to be consistent across your project.
Short answer: One package per module/feature, possibly with sub-packages. Put closely related things together in the same package. Avoid circular dependencies between packages.
Long answer: I agree with most of this article
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 8 years ago.
Improve this question
A Java developer (with lots of experience in sophisticated, high-performance environments) very recently commented that "composition is not used much anymore." I was surprised by this comment. Is this true?
On the one hand, other answers on this forum indicate that difference between composition and aggregation can be ambiguous (can the whole exist without the part; does the part exist throughout the life of the containing object?). But perhaps in all of these cases the question stands--how to add behavior to an existing class or class hierarchy.
The context of his comment was a discussion of possible alternatives to inheritance. If this developer is correct, what has replaced composition in working practice? Mix-ins through added interfaces?
Any perspectives are welcome!
If anything, it's probably used now more than ever thanks to dependency injection frameworks like Spring. The model that all of the Java developers I know use is to build classes that relate to one another in functionality more by interface and purpose and to use Spring to inject them according to a particular configuration (ex the ability to replace entire security frameworks just by changing a spring configuration file and adding a few new JAR files).
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 9 years ago.
Improve this question
We’re working like hadoop big project. We’ve a problem.
We want to work on Java based CMS (Content management system). But this CMS must include Spring, hibernate, MySQL and must have Responsive interface (our library is twitter bootsrapt).
Our project usually quite big so, what can i do ?
What's your usage to hadoop? Is it just map and reduce? If so, I seriously recommend to write map-reduce part yourself. It's simple to code up as long as you have already object serialization and communication layer; and since you mention your project is big you probably have them already. Then the value of hadoop is just an interface and I am sure you can write it in more compact and adaptive way to suit your usage.
To me this is a typical case where a 3rd party lib gives you 20% of functionality you need while introducing 80% of its own rubbish. So I'd say just write your own.
BTW, if your use case is simple, you might also want to take a look at ForkJoinPool
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 9 years ago.
Improve this question
I'm trying to implement modularity system (J2EE) to allow changes of the type modules/plugins/add ons.
I want to know how to start, what approach I should follow.
Are there any new design patterns for this type of system ?
or do I need a new technology (message bus, osgi) ?
Thanks in advance
Mhadjis
Spring would be a good starting point. Spring context files let you specify most of the architecture in XML and the replace them later. This makes for a very modular architecture. Now in terms of being able to write "plugins" like where a user can provide a jar file and it hooks into the app dynamically that is something you'd have to roll yourself. However, Spring could help you there again by providing a lot of tools for abstracting out the configuration of plugins and loading them (loading them as Spring contexts).