I'm currently evaluating QI4J, as it provides interesting concepts regarding properties handling, in the context of an application connecting some ontologies together to create a partially semantic application.
As a consequence, I would like to find some alternatives regarding properties handling, composition, and integration in Java EE environment.
The most obvious similar thing to Qi4j, I think, is Scala. However, it is a new language and all the good and bad things that comes with that.
For Qi4j, we are aiming for strong Scala support, so that for instance Scala traits can be used in Qi4j composites.
According to Ohloh page of QI4J, possible alternatives are
Indriagen
javATE
learn-ddd
zipper-framework
I think you can do most of what Qi4j does (and way way more) with AspectJ ITDs (the language not the #AspectJ Java alternative).
Jordao mentions it in his answer to the similar post mentiond by #Ischin.
Here is an example of trait-like functionality I mentioned in another post: https://stackoverflow.com/a/7403617/318174 . Just by adding an interface to a class you can magically add methods.
Related
JVM provides great performance - it's on the one hand. Golang sounds like a new paradigm and extremely productive - on the other hand. If we could bring together the best of two worlds - JVM performance and golang productivity - we could get a lot of benefits. Does anyone know any project that provides golang implementation in java?
A quick search came up with
http://code.google.com/p/jgo/
This link suggest it's the main or only effort.
http://en.wikipedia.org/wiki/List_of_JVM_languages
It may be difficult to make a good JVM implementation of Go. Rob Pike, who is one of Go's creators, spoke about this on episode 0.0.3 of the Changelog podcast:
[timecode 17:05] For instance, it is quite difficult to implement Go's interface model using a JVM: you might have to add a bytecode to deal with some of the type stuff. So for some of these existing systems [(JVM and CLR)] it's not quite obvious how Go would run with them […]
You should check JGO website:
http://jgo.herokuapp.com/
And the JGO Docs: http://jgo.herokuapp.com/api/
A different route might be to use a JVM library which provides the most important features of Go, which are in my opinion and experience the lightweight Go-routines multiplexed on JVM threads, and channels for communication and synchronization.
There is one such library, Quasar, from Parallel Universe (see e.g. this blog post comparing Quasar and Go). Also, it works well with Kotlin, which is getting more popular now as an officially supported Android language, and providing much more compact (productive?) syntax than Java.
Weird title, I know, let me explain.
I am a developer most familiar with C# and Javascript. I am completely sunk into those semi-functional worlds to the point that most of my code is about mapping/reducing/filtering collections. In C# that means I use LINQ just about everywhere, in Javascript it's Underscore.js and jQuery.
I have currently been assigned to an ongoing Java project and am feeling rather stifled. I simply do not think in terms of "create an array, shuffle stuff from one to another". I can (and did) create my own versions of the main map/reduce functions using anonymous types implementing interfaces but why re-invent the wheel? The project I am currently on already has commons-collections-3.1.jar and looking through the classes contained it seems like it likely can do everything that I want and more.
For the life of me, I can't find how to actually use it. Looking through the dozens of classes therein is not very helpful and the only thing I can google up is the api doc which is equally as helpful.
How do you use it to Map/Select, Filter/Where, Reduce/Aggregate? Is there anywhere that gives an actual tutorial on this library?
(Comment as answer for formatting purposes.)
Not so much, other than the limited user guide.
That said, I'm not sure where specifically you're having problems--filtering and selecting is mostly wrapped up in the functors package, and utilized by the CollectionUtils class.
While you're not looking for a replacement, you might find things like Guava or Lambda4J a bit more similar to what you're used to (within Java's constraints), and they're a bit less verbose.
Try these links :
http://commons.apache.org/collections/userguide.html (basic tutorial)
http://larvalabs.com/collections/tutorial.html (advanced tutorial with generic)
#george-mauer, you might have to rely on articles like this or a book like Jakarta Commons Cookbook. I have also found it rather useful to learn by creating samples of my own.
In .NET you can create strongly-typed configuration sections using build-in base classes that do a lot of the mundane heavy lifting with respect to XML Serialization/De-serialization, schema validation, type-casting, etc...
I'm working on a Java application and I'm looking for a similar capability. If there is a built-in facility for this I would prefer to not reinvent the wheel. I don't do a lot of Java so any guidance and links with examples/walk-throughs would be great.
Does anyone have any tips on how I can accomplish this using built-in Java capabilities?
I think the closest you can get to .NET configuration sections is the Preferences API.
This is still a rather low-level approach however. Its intended use is more geared towards user preferences than actual system-wide configuration.
Another option would be Commons Configuration, which provides similar functionality, still not strongly-typed.
If you're using Java 8, you can use https://github.com/backuity/p2s
It is fail-fast and type-safe with almost no reflection (code is generated with an annotation processor, but plays well with IDE).
Note that it is read-only.
I've been using Spring with Java and I've seen that there is a version called Spring.NET. I wonder if there is any significant difference between them (apart from that one is for Java and the other is for .NET). Is it just a "language translation" of the framework or are they different project with just a similar purpose?
Thanks.
As far as I know it's not a one-to-one language translation. Spring.NET is a independent project which is based on original Spring. This project has its own architectors and developers. So the details may vary. Besides that Spring.NET project is younger and therefore may be not so fully functional as original Spring.
By the way, you may find more details on this topic here.
I am an avid fan of the Spring framework for Java (by Rod Johnson).
I am learning Python and was excited to find about Spring for Python.
I would be interested in hearing the community's views on the comparison of
these two flavours of Spring. How well does it fit Python's paradigms etc.
Dependency injection frameworks are not nearly as useful in a dynamically typed language. See for example the presentation Dependency Injection: Vitally important or totally irrelevant? In Java the flexibility provided by a dependency injection framework is vital, while in Python it usually results in unneeded complexity.
This doesn't mean that the principles are wrong. See this example how to achieve loose coupling between classes by using simple idioms:
# A concrete class implementing the greeting provider interface
class EnglishGreetingProvider(object):
def get_greeting(self, who):
return "Hello %s!" % who
# A class that takes a greeting provider factory as a parameter
class ConsoleGreeter(object):
def __init__(self, who, provider=EnglishGreetingProvider):
self.who = who
self.provider = provider()
def greet(self):
print(self.provider.get_greeting(self.who))
# Default wiring
greeter = ConsoleGreeter(who="World")
greeter.greet()
# Alternative implementation
class FrenchGreetingProvider(object):
def get_greeting(self, who):
return "Bonjour %s!" % who
greeter = ConsoleGreeter(who="World", provider=FrenchGreetingProvider)
greeter.greet()
DISCLOSURE: I am the project lead for Spring Python, so you can consider my opinion biased.
I find that several of the options provided by Spring Python are useful including: aspect oriented programming, dependency injection, remoting, security, and easy database access.
Aspect oriented programming is, as they say, easier to implement off the cuff with python than java. But Spring Python makes it easy enough to add to existing python modules without editing their source code. The other solutions require meta-programming or modifying the original source code. I've already had one person visit our forums asking how to add an interceptor to a PyGame application, so he could unobtrusively "tap" some code.
Many people quickly assume "dependency injection" or "IoC" instantly means "XML configuration files". Not the case. While we support an XML configuration, just leap directly into using python decorators.
I already know about one company that is using Spring Python as a key piece of their system. They are interested in making improvements, adding new features, and generally using it as a piece of their solution. They have also experimented with running it inside jython, in case that piques your interest.
At the end of the day, my suggestion is to examine all the features, and see if any of them suit your needs. Whether this is adding needless complexity or succinct value can only be determined by you. You don't have to use everything; only what you need. To get some more info on what is available, I invite you to view Introduction to Spring Python, that I presented at SpringOne Americas 2008 conference.
Good stuff. I have used Spring Java, Spring Dot Net and now starting with Spring Python. Python has always been pretty easy to use for programmers; I think, especially since it's easy to write. I found Spring Dot Net to be a bit confusing, but both Spring Java and Python seem to be similar. I'm sure they have their differences, but so far at least I'm not all so confused with the Python implementation of Spring.