Can anyone explain the when to use graph in guava and when to use graph in jung 2.1.1? - guava

I am new to use JUNG and guava. I am trying to use JUNG 2.1.1 graphs but I learned that it uses com.google.common.graph. Please tell me which interface is good, and what are the differences (if any)?
import com.google.common.graph.Graph
or
import edu.uci.ics.jung.graph.Graph;
Syed

JUNG 2.1.1 has its own graph type: edu.uci.ics.jung.graph.Graph
The JUNG 3.0 snapshot (not yet released, but currently at head on the Github repo) uses Guava's graph type: com.google.common.graph.Graph (and its sibling types ValueGraph and Network).
I am responsible for both maintaining JUNG (and was one of the original architects) and for the common.graph package (which I created and whose development I've been driving).
If you just want a graph type and will be mostly writing your own code to work with it, I'd use Guava's graph types; we're still developing that API, but it is (IMO) a much better design; it was based in part on looking at the design warts of JUNG's graph model (many of which I was responsible for).
If you need some of the extended capabilities that JUNG provides that Guava's common.graph package doesn't include (algorithms, visualization, etc.) then you've got a choice:
(1) If you want a library that is not going to change, use JUNG 2.1.1. It has some known bugs, which are not going to be fixed in 2.x.
(2) If you are willing to use a library that's not yet fully baked, you can check out JUNG 3.0 from GitHub and use its build setup to create the jars you want. JUNG 3.0 has virtually all of the capabilities of JUNG 2.1.1, and has a significantly improved architecture.
Hope that helps.

Related

Can a framework be considered a class of classes?

I have seen this question What is the difference between a class library and a framework
and throughout all the provided answers, the framework is always referenced as a framework. I am looking to get more technical. What exactly is a framework? A class of classes that control all functionality and provide ultimate abstraction and the ability to customize it? I am just looking to understand what exactly a framework is, as far as initializing it, not just what it accomplishes, but how exactly it is implemented. How I believe it's used/implemented is listed below.
variable = Framework() -> Reference the variable
Framework is an infrastructure, ready-made and predefined, with some particular rules of the game on the "development field", according to which, you can build your application, on top of it, by "playing with framework rules" (you can, at some extent, customize those rules).
Spring MVC is a good example of Framework. You don't control how the View Resolving, Dispatching or Template Rendering happen and achieve a goal together.
Think of this as a big machine, where you can plug in and integrate your components which are applicable to that machine.
Library, on the other hand, is just a set of classes, which provide already implemented functionality out of the box, in order to not start inventing the bicycle again and again.
Apache Commons is a good example of the Library. It has a lot of ready tools and functionality to facilitate your work with String objects.
Think of this as a set of instruments and tools, using which, you can build your own machine.
With respect to how it is implemented question. This is like asking how the Boeing A220 is built?. I'm not sure anyone can describe here how the Framework is implemented in the details. But if I understood uour point about whether the Framework is used via classes, then:
Framework might provide some classes as an abstraction, yes, but it's not about them, it's more about mechanics of the entire system. The main thing it provides is the mechanism and mechanics of how the system is designed to work.

Is GEF4 mature enough?

I am familiar to GEF3. GEF4 has a better architecture.
And I have to make decision whether using GEF3 or GEF4 MVC for our project.
My question is: Currently, is GEF4 mature (e.g full editing features like GEF3, documents, API's stability) enough? Or should I use GEF3 instead?
Thanks
Personally, I would say since the GEF 4.0.0 release that bundled GEF4 1.0.0 the framework is quite stable (API-wise). However, some support for common functionality is still lacking, which you would need to implement yourself (e.g. direct editing). If you are still unsure, you can implement a prototype with GEF to see if it fits. If you run into any problems, the GEF forum is a nice place to get help.

How to build a ConcurrentLinkedHashmap using Guava?

Several links show that https://code.google.com/p/concurrentlinkedhashmap/ has been ported to Guava, but I can not find the corresponding API in Guava.
Can anybody show me an example to build a ConcurrentLinkedHashmap using Guava ?
Thanks!
ConcurrentLinkedHashmap API wasn't ported to Guava 1:1, but some solutions from CLHM were used in MapMaker and Cache (with CacheBuilder).
ConcurrentLinkedHashmap's author Ben Manes answers a question which may clarify your doubts: What does it mean that ConcurrentLinkedHashMap has been integrated into Guava?:
Guava is the long term replacement and most of the time you should use it. The history is that ConcurrentLinkedHashMap figured out the algorithms, Guava subsumed it, and then focused on adding features.
I think it's also important to note that he's currently writing another library which may suit your needs:
Caffeine is a Java 8 rewrite of Guava's cache. It tries to provide the best of ConcurrentLinkedHashMap and Guava, modernized with Java 8, and adopting the techniques that I've learned since those previous projects.

What library should I use for accessing Riak from Scala?

For a project I'm using both Scala and Riak (two things I have never worked with before ;) ).
Google searches seem to suggest using Riakki. However, it seems like that particular library hasn't been maintained since 2009 and doesn't even compile on my system. There is a more up-to-date fork on GitHub that does seem to work with more recent Scala versions. But Riakki seems to depend on Jiak, which has been deprecated since february of last year.
Seems like the only reasonable choice would be to use the official Riak Java-library from Scala. That's certainly possible, but I'd like to do things the Scala-way as I'm trying to learn the language. Having to interface with a Java-style API might ruin a bit of the fun. Writing my own wrapper sounds like it will be too much work.
tl;dr: I want to use Riak from Scala. What are other people using?
edit: just found Ryu (can't link to it - annoying limit on amount of hyperlinks per question for new users). Doesn't seem all that mature though.
Stackmob recently opensourced Scalariak.
Scaliak is a scala-ified version of the High-Level Riak Java Client w/
a Functional Twist. It is currently being used in production at
StackMob.
Scaliak is currently feature incomplete vs. the original High-Level
Riak Java Client. What is currently supported are mostly features
being used in production (there have been a few features implemented
and subsequently not used).
There is also Raiku which states that it is async.
I'm in the same bucket - excuse the bad pun - although I have some experience with Scala. I'm thinking of using the official Java client.
When you are toiling up a steep learning curve, you don't need to be dealing with incomplete and potentially wobbly API's. In my experience, using Java API's from Scala is minimally painful.
I think there'll be enough delight in playing with our new Raik toy that we'll forget about whatever un-Scala-ish foibles the Java API inflicts upon us. All the best.
I'm the author of yet another Scala Riak client, simply called riak-scala-client. It is based on Akka and Spray, it is not built on top of the existing Java client, and most importantly it is completely non-blocking.
Check it out at http://riak.scalapenos.com and let me know what you think.

Framework vs. separate libraries

I'm using C++, but I think that my question goes beyond a single programming language.
What is better - use framework's classes or separate libraries. For example, if I'm using Qt in some project is it better to use QHttp or use cURL (QtXml or TinyXML etc.)?
From my point of view using framework's classes has following features:
Better compatibility with other framework's classes (for example, GUI)
Less dependences
But from other hand separate library could provide better functionality.
What do you think about it?
I get nervous about too much 'framework,' as at some point it can become impossible to extract your code from the 'framework'.
Using different libraries from one 'framework' is fine, but I'd hide them behind my own abstractions rather than routing 'their' types through my core code.
At my company, it depends on the needs of the project. Generally we prefer to use the framework classes. But if it seems that we will have write a lot of extensions or helper classes, then we look for separate libraries.
I tend to go for "what provides the best functionality?". I'll use a framework's methods mostly by default unless it doesn't provide something I need. Then I'll be tempted to use a third party library. If I'm using a lot of third party libraries, I might question the need to use the framework. If I'm using third party libraries I can't live without and they conflict with the framework, the framework goes, unless I can't live without it. It really depends on the situation. Is it the framework I need to accomplish my task, or the third party librar(y|ies) implementing the functionality? Inclusion is then prioritised as appropriate.
It's the job of the framework author to lock you in. It's the job of the application writer not to get locked in.