|
Sponsored Links
Resources
Enterprise Java Research Library
Get Java white papers, product information, case studies and webcasts
|
News
News
News
|
Messages: 2
Messages: 2
Messages: 2
Printer friendly
Printer friendly
Printer friendly
Post reply
Post reply
Post reply
XML
XML
XML
|
 |
Exjali : EXpressiveness JAva LIbrary
Inspired by the buzz around Java 7 and "new" JVM language (Groovy, JRuby, Scala, ...), Exjali is a small java library, hosted on sourceforge.net, which tries to provide features that are not part of the Java language (yet) with java classes, and allows more expressive and concise statements.
For example, instead of writing a painful for loop like this one :
for (int i = 1; i <= max; i++)
You can write ;
for (int i : range(1, max ))
Here range is a static method provided by Exjali that builds an immutable collection containing all the integers in the (1, max) range. As it's a collection you also call contains :
if (range(2, 45).contains(myInt))
In the same spirit Exjali provides two utility classes to iterate over the content of files with a Java5 foreach loop, one for text files (iterating on lines), the other for object files :
for (String line : lines("test.txt")) { // do somthing for each line
Exjali also support some kind of named parameters, (inspired by groovy) : you can use static methods to create objects while calling the method :
createPerson(params(param("name", "michael"), param("age", 21)))
The method createPerson must then verify the types of the given parameters :
// Method declaration void createPerson(NamedParameters params) { // The client code should verify the parameters params.verify(paramVerify("name", String.class), paramVerify("age", Integer.class)); // Parameters retrieval String name = params.get("name", String.class); Integer age = params.get("age", Integer.class); // actual code ... }
Exjali has more features. Visit http://exjali.sourceforge.net to learn more.
If you have any idea or suggestion in the same spirit, feel free to share it !
|
|
Message #280668
Post reply
Post reply
Post reply
Go to top
Go to top
Go to top
|
 |
Re: Exjali : EXpressiveness JAva LIbrary
uh ... wow.
I don't think i agree that
for (int i : range(1, max ))
is in any way more 'expressive' than the painful for loop
for (int i = 1; i <= max; i++)
nor that
createPerson(params(param("name", "michael"), param("age", 21)));
is either more concise or more 'expressive' than
createPerson("michael", 21);
even though it is inspired by Groovy ... especially since I now have to modify the class itself in other klunky ways.
Although the file thing looks minimally useful, I think I will pass over this one.
|
|
Message #280679
Post reply
Post reply
Post reply
Go to top
Go to top
Go to top
|
 |
Re: Exjali : EXpressiveness JAva LIbrary
Here range is a static method provided by Exjali that builds an immutable collection containing all the integers in the (1, max) range.
I wonder how this will hold against a good performancetest. Lets say I vary MAX from 1 to 100000 and do 100000 loop test with it. The good old way works with primitives but this new method works with collections and Integers I should guess. I will end up with alot of objects in this new way... NOT GOOD. But This is theoretically. I haven't done the tests.
I wish people stop trying to transform Java into some kind of weird construct. The language is good and easy to understand and simple to code in. All those alleged improvements will reduce the readability, usability and maintainability of the code. If you cannot understand the basic simple constructs then you should not be programming in Java.
Kind regards,
Marc
|
|
 |
New content on TheServerSide.comNew content on TheServerSide.comNew content on TheServerSide.com |
 |
 |
Reza Rahman explores the features of the proposed JSR 299, Contexts and Dependency Injection for Java EE (CDI). When approved, it promises to be a key feature of Java EE 6.
(November 2, Article)
SAML is an XML-based standard for exchanging authentication and authorization data between security domains. The single most important problem that SAML was created to solve is the Web browser Single Sign-On problem. Many organizations are debating whether to stay with version 1.1 or move to 2.0. This article makes observations about both options.
(September 28, Article)
Joe Ottinger takes a look at how people learn, and applies it to the practice of programming. He notes that understanding how people learn is an essential part of working in a programming team.
(September 22, Article)
Stephen Maryka gave us an article about the Asynchronous Web and posed a number of questions that get examined like an approach to delivering Asynchronous Web capabilities through extensions to existing Java EE technologies.
(July 14, Article)
Application development teams are increasingly turning to automation in order to improve their processes and produce higher quality software. In this webcast, Peter Varhol will describe how to use static and dynamic analysis to improve the software development process and deliver a quality application.
(July 7, Tech Talk)
JavaServer Faces Flex goal is to provide users capability in creating standard Flex components, part of flexSDK which is open sourced through MPL license, as normal JSF components. This article by Ji Hoon Kim will provide an overview of creating a simple multilingual JSF page consisting of JSF Flex tags.
(June 29, Article)
In this session Jeff explores the key characteristics of successful SOA projects. He covers some of the patterns, and anti-patterns, tool sets, and strategies that he himself learned the hard way. Last, he provides a strategy and blueprint for achieving a high likelihood of success in your SOA project.
(June 23, Tech Talk)
Ari Zilka, CTO of Terracotta, Inc., talks about the new features in Terracotta 3.1, announced during JavaOne and available now.
(June 15, Tech Talk)
In this Tech Talk, Josh Long explores an integration challenge using Spring Integration and walks through the implementation, employing and expanding on the basic patterns of Enterprise Application Integration to tie together components into a function integration solution, and then demonstrates how Spring Integration helps address the integration requirements.
(June 15, Tech Talk)
In this Tech Talk, David Geary teaches you: The basics of Google Web Toolkit; How to implement Ajax-enabled applications in Java; Internationalization; Hooking into the browser history mechanism; Remote procedure calls.
(June 4, Tech Talk)
Jon Kern discusses the best architecture/technical solutions and ensure that they are repeated by all developers. By tackling the architecture up-front in a serial manner, subsequent parallel development will be much more manageable and predictable.
(May 28, Tech Talk)
This keynote describes the frustrations of modern knowledge workers in their quest to actually get some work done, and solutions for how to guard yourself against all those distractions. Neal Ford talks about environments, coding, acceleration, automation, and avoiding repetition as ways to defeat the misguided attempts to sap your ability to produce good work.
(May 26, Tech Talk)
Gil demonstrates how new, aggressive uses of already abundant compute capacity by common applications offer competitive value for application designers.
(May 21, Tech Talk)
Chris Keene introduces WaveMaker as a new way to automate the ability to generate Hibernate classes in order to more quickly bring OR mapping into an application.
(May 19, Article)
In this session Nati Shalom demonstrates how to take a standard Java EE web application and scale it out or down dynamically without changes to the application code. Seeing as most web applications are over-provisioned to meet infrequent peak loads, this is a dramatic change because it enables growing your application as needed, when needed, without paying for unutilized resources.
(May 19, Tech Talk)
Mastering EJB was one of the original and most influential EJB books in the industry. Mastering EJB III now returns with two new expert co-authors, updated for EJB 2.1 and 30% new chapters including security, integration, best practices, open source, and more.
(Book PDF Download)
The Application Server Matrix is a detailed listing of J2EE vendors and their application server products, with information on latest version numbers, J2EE spec support and licensing, pricing, platform support, and links to product downloads and reviews.
(Application Server Comparison Matrix)
|
|