Archive for the ‘General’ Category
[DevoxxFR2013] Groovy and Statically Typed DSLs
Lecturer
Guillaume Laforge manages the Groovy project and leads JSR-241 for its standardization. As Vice President of Technology at G2One, he delivers services around Groovy/Grails. Co-author of “Groovy in Action,” he evangelizes at global conferences.
Cédric Champeau contributes to Groovy core at SpringSource (VMware division). Previously at Lingway, he applied Groovy industrially in DSLs, scripting, workflows.
Abstract
Guillaume Laforge and Cédric Champeau explore Groovy’s evolution in crafting statically typed domain-specific languages (DSLs). Building on runtime metaprogramming, Groovy 2.1 introduces compile-time features for type safety without sacrificing flexibility. They demonstrate extensions, AST transformations, and error reporting, culminating in advanced builders surpassing Java’s checks, illustrating implications for robust, expressive DSL design.
Groovy’s DSL Heritage: Dynamic Foundations and Metaprogramming
Laforge recaps Groovy’s DSL prowess: flexible syntax, runtime interception (invokeMethod, getProperty), closures for blocks.
Examples: method missing for fluent APIs, expando meta-classes for adaptations.
This dynamism accelerates development but risks runtime errors. Groovy 2 adds optional static typing (@TypeChecked), clashing initially with dynamic DSLs.
Bridging Static and Dynamic: Compile-Time Extensions
Champeau introduces Groovy 2.1’s static compile-time metaprogramming. @CompileStatic enables type checking; extensions handle DSL specifics.
Trait-like extensions via extension modules: add methods to classes statically.
// Extension class
class HtmlExtension {
static NodeBuilder div(Element self, Closure c) { /* build */ }
}
Register in META-INF, usable in typed code with error propagation.
This preserves DSL fluency under static compilation.
AST Transformations for Deeper Integration
Custom AST transformations inject code during compilation. @Builder variants, delegation.
For DSLs: transform method calls into builders, validate arguments statically.
Example: markup builder with type-checked HTML generation, reporting mismatches at compile-time.
Champeau details global transformations for cross-cutting concerns.
Advanced Type Checking: Custom Error Reporting and Beyond Java
Laforge showcases @TypeChecked with custom type checkers. Override doVisit for context-specific rules.
@TypeChecked
void script() {
html {
div(id: 'main') { /* content */ }
}
}
Checker ensures div accepts valid attributes, closures; errors reference user code lines.
Groovy exceeds Java: infer types in dynamic contexts, enforce domain rules unavailable in Java.
Builder Patterns and Real-World Applications
Demonstrate HTML DSL: nested closures build node trees, statically verified.
Grails integration: apply to GSPs for compile-time validation.
Champeau notes Grails’ metaprogramming complexity as ideal testbed—getProperty, MOP, AST all in play.
Implications for DSL Engineering: Safety, Productivity, Evolution
Static typing catches errors early, aids IDE support (autocompletion, refactoring). Dynamic essence retained via extensions.
Trade-offs: setup complexity; mitigated by community modules.
Future: deeper Grails incorporation, enhanced tooling.
Laforge and Champeau position Groovy as premier for type-safe yet expressive DSLs, blending agility with reliability.
Links:
[DevoxxBE2013] Java EE 7’s Java API for WebSocket
Arun Gupta, Director of Developer Advocacy at Red Hat, unveils the transformative capabilities of the Java API for WebSocket in Java EE 7. A veteran of Sun Microsystems and Oracle, Arun has championed Java technologies globally, authoring extensive blogs and a best-selling book. His session explores WebSocket’s role in enabling efficient, bidirectional communication, eliminating the need for long polling or AJAX. Through live demonstrations, he illustrates server-side endpoints and client-side integrations, showcasing how this API empowers developers to craft responsive web and rich client applications.
WebSocket, a cornerstone of HTML5, facilitates real-time data exchange over a single TCP connection. Arun highlights its scalability, with GlassFish handling thousands of connections, and introduces tools like Autobahn for compliance testing. This API positions Java developers to build dynamic, scalable systems that complement RESTful architectures.
WebSocket Fundamentals and API Design
Arun introduces WebSocket’s departure from HTTP’s request-response model, leveraging a single, persistent connection. Using annotations like @ServerEndpoint, he demonstrates creating a chat application where messages flow instantly. The client API, accessible from browsers or Java applications, enables seamless integration.
This simplicity, Arun notes, reduces latency, making WebSocket ideal for real-time applications like live updates or collaborative tools.
Server-Side Scalability and Performance
Scalability is a key strength, Arun explains, with WebSocket supporting millions of file descriptors on Linux. He recounts Oracle’s GlassFish tests, achieving robust performance with thousands of connections. The Autobahn test suite, he suggests, validates compliance and load capacity.
Forthcoming WildFly tests, Arun adds, will further benchmark performance, ensuring reliability in production environments.
Complementing REST with WebSocket
Arun clarifies that WebSocket complements JAX-RS, not replaces it. He illustrates a hybrid design: REST for stateless queries, WebSocket for real-time updates. A stock ticker demo shows prices pushed to clients, blending both paradigms.
This synergy, Arun argues, enhances application flexibility, with Java EE 8 discussions exploring further integrations.
Community Engagement and Future Directions
Arun encourages joining Java EE expert groups, noting their transparent processes. Recent community gatherings, he mentions, discussed enhancing WebSocket’s role. He advocates contributing to shape Java EE 8, ensuring it meets developer needs.
This collaborative approach, Arun emphasizes, drives innovation, aligning WebSocket with evolving web standards.
Links:
[DevoxxBE2012] FastOQL – Fast Object Queries for Hibernate
Srđan Luković, a software developer at SOL Software, alongside Žarko Mijailovic and Dragan Milicev from the University of Belgrade, presented a groundbreaking solution to a persistent challenge in Hibernate development. Žarko, a senior Java EE developer and PhD candidate with deep involvement in model-driven frameworks like SOLoist4, led the discussion on FastOQL, a Java library that transforms complex Object Query Language (OQL) statements into highly optimized SQL, addressing Hibernate’s HQL performance bottlenecks in large-scale databases.
The trio began by dissecting the limitations of HQL queries, which often generate inefficient joins when traversing class hierarchies or association tables, leading to sluggish execution on voluminous datasets. FastOQL emerges as a targeted remedy, compiling OQL into minimal-join SQL tailored for Hibernate environments. Srđan illustrated this with examples involving inheritance hierarchies and many-to-many relationships, where FastOQL drastically reduces query complexity without sacrificing the object-oriented expressiveness of OQL.
Žarko delved into the library’s design, emphasizing its derivation from SOL Software’s proprietary persistence layer, ensuring seamless integration as an HQL alternative. Dragan, an associate professor and department chair at the Faculty of Electrical Engineering, provided theoretical grounding, explaining how FastOQL’s strategy leverages specific mappings—like single-table inheritance and association tables—to eliminate unnecessary joins, yielding substantial performance gains in real-world scenarios.
A live demonstration highlighted FastOQL’s prowess: compiling an OQL query spanning multiple entities resulted in SQL with fewer tables and faster retrieval times compared to equivalent HQL. The speakers underscored its focus on prevalent Hibernate mappings, driven by practical observations from blogs, documentation, and industry recommendations. In Q&A, they addressed benchmarking queries, affirming that while initial efforts targeted these mappings for maximal impact, future expansions could encompass others, rooted in FastOQL’s extensible architecture.
FastOQL stands as a beacon for developers grappling with scalable persistence, marrying OQL’s conciseness with SQL’s efficiency to foster maintainable, high-velocity applications in enterprise settings.
Tackling HQL’s Performance Hurdles
Žarko unpacked HQL’s pitfalls, where intricate joins across polymorphic classes inflate query costs. FastOQL counters this by analyzing object structures to prune redundant associations, delivering lean SQL that preserves relational integrity while accelerating data access.
OQL Compilation Mechanics
Srđan demonstrated the compilation pipeline, where OQL expressions map directly to optimized SQL via Hibernate’s session factory. This process ensures type-safe queries remain portable, sidestepping the verbosity of native SQL while inheriting Hibernate’s caching benefits.
Real-World Mapping Strategies
Dragan highlighted FastOQL’s affinity for common patterns, such as table-per-class hierarchies and intermediary tables for collections. By prioritizing these, the library achieves dramatic throughput improvements, particularly in inheritance-heavy domains like content management or e-commerce.
Integration and Future Prospects
The presentation touched on FastOQL’s Hibernate-centric origins, with plans to broaden mapping support. Žarko encouraged exploration via SOL Software’s resources, positioning it as a vital evolution for object-relational mapping in demanding environments.
Links:
[DevoxxFR2013] WTF – What’s The Fold?
Lecturer
Olivier Croisier operates as a freelance Java expert, trainer, and speaker through Moka Technologies. With over twelve years in the field, he assists clients in Java 8 migrations, advanced stack development, and revitalizing team enthusiasm for coding.
Abstract
Olivier Croisier elucidates the fold concept from functional programming, demonstrating its abstraction of iteration for enhanced code expressiveness. Using Java 8 streams and Haskell parallels, he dissects implementations, applications in mapping/filtering/reducing, and performance implications. The analysis positions fold as a versatile pattern surpassing traditional loops, integrable even in pre-Java 8 environments.
Origins and Essence: Fold as Iterative Abstraction
Croisier traces fold to functional languages like Haskell, where it generalizes accumulation over collections. Left fold (foldl) processes sequentially; right fold (foldr) enables laziness.
In essence, fold applies a binary operation cumulatively: start with accumulator, combine with each element.
Java analogy: external iterators (for-loops) versus internal (streams). Fold internalizes control, yielding concise, composable code.
Implementing Fold in Java: From Basics to Streams
Pre-Java 8, Croisier crafts a utility:
public static <T, R> R fold(Collection<T> coll, R init, BiFunction<R, T, R> f) {
R acc = init;
for (T e : coll) acc = f.apply(acc, e);
return acc;
}
Usage: sum integers—fold(list, 0, (a, b) -> a + b).
Java 8 streams natively provide reduce (fold alias):
int sum = list.stream().reduce(0, Integer::sum);
Parallel streams distribute: .parallelStream().reduce().
Croisier notes identity requirement for parallelism; non-associative operations risk inconsistencies.
Beyond Reduction: Mapping, Filtering, and Collection Building
Fold transcends summing; rebuild collections:
List<String> mapped = fold(list, new ArrayList<>(), (acc, e) -> { acc.add(transform(e)); return acc; });
Filter via conditional accumulation. This unifies operations—map/filter as specialized folds.
Haskell’s foldr constructs lists lazily, enabling infinite structures. Java’s eager evaluation limits but streams offer similar chaining.
Expressive Power and Performance Trade-offs
Croisier contrasts verbose loops with declarative folds, enhancing readability/maintainability. Encapsulate patterns in methods for reuse/optimization.
Performance: sequential folds match loops; parallel leverages multicore but incurs overhead (threading, combining).
JVM optimizations (invokedynamic for lambdas) potentially outperform anonymous classes. Croisier advocates testing under load.
Versus map-reduce: fold suits in-memory; Hadoop for distributed big data.
Integration Strategies and Broader Implications
Adopt incrementally: utility class for legacy code. Java 8+ embraces streams.
Croisier views fold as expressivity tool—not replacing conditionals but abstracting mechanics.
Implications: functional paradigms ease concurrency, prepare for multicore era. Fold’s versatility—from reductions to transformations—elevates code abstraction.
Links:
[DevoxxFR2013] Security for Enterprises in a Cloudy and Mobile World
Lecturer
Ludovic Poitou serves as Product Manager at ForgeRock, overseeing directory products, and holds the position of General Manager for ForgeRock France. With a background in open-source Java and LDAP, he previously worked at Sun Microsystems as a developer and architect for directory solutions, later engaging in community management.
Abstract
Ludovic Poitou examines evolving enterprise security demands amid mobile proliferation, social networks, and cloud computing. Centering on identity management, he analyzes ForgeRock’s Open Identity Stack—an open-source Java solution—detailing standards like OAuth, OpenID Connect, and SCIM. The discussion evaluates impacts on information systems infrastructure and application architecture, advocating adaptive strategies for secure access in hybrid environments.
Shifting Paradigms: Mobile, Cloud, and Social Influences on Security
Poitou identifies three transformative trends reshaping information security: ubiquitous mobile devices, pervasive social platforms, and cloud services adoption. These necessitate reevaluating traditional perimeters, as data flows beyond firewalls to diverse endpoints.
Mobile introduces BYOD challenges—personal devices accessing corporate resources—demanding granular controls. Cloud shifts storage and processing externally, requiring federated trust. Social networks amplify identity federation needs for seamless yet secure interactions.
At the core lies identity management: provisioning, authentication, authorization, and storage across lifecycles. ForgeRock, emerging post-Sun acquisition, builds on open-source projects like OpenDJ (LDAP server) to deliver comprehensive solutions.
Core Components of Open Identity Stack: Directory, Access, and Federation
ForgeRock’s stack comprises OpenDJ for LDAP-based storage, OpenAM for access management, and OpenIDM for identity administration. OpenDJ handles scalable directories; OpenAM manages SSO, federation; OpenIDM orchestrates provisioning.
Poitou highlights Java foundations enabling portability. Development centers in Grenoble support global operations.
This modular approach allows tailored deployments, integrating with existing systems while supporting modern protocols.
Emerging Standards: OAuth, OpenID Connect, and SCIM for Interoperability
Addressing federation, Poitou details OAuth 2.0 for delegated authorization—clients obtain tokens without credentials. Variants include authorization code for web, implicit for browsers.
OpenID Connect layers identity atop OAuth, providing ID tokens (JWT) with user claims. This enables authenticated APIs, profile sharing.
SCIM standardizes user/group provisioning via REST, simplifying cloud integrations. Poitou contrasts with LDAP’s genericity, noting SCIM’s user-centric focus.
Code illustration (conceptual OAuth flow):
// Client requests token
HttpResponse response = client.execute(new HttpPost("token_endpoint"));
// Server validates, issues JWT
JWTClaimsSet claims = new JWTClaimsSet.Builder()
.subject(userId)
.build();
SignedJWT signedJWT = new SignedJWT(header, claims);
These standards facilitate secure, standardized exchanges.
Architectural Implications: Token-Based Authorization and Device Management
Traditional session cookies falter in mobile/cloud; tokens prevail. Applications validate JWTs statelessly, reducing server load.
Poitou discusses administrative token generation—pre-authorizing apps/devices without logins. OpenAM supports this for seamless access.
Infrastructure evolves: decouple authentication from apps via gateways. Hybrid models blend on-premise directories with cloud federation.
Challenges include token revocation, scope management. Solutions involve introspection endpoints, short-lived tokens.
Practical Deployment and Future Considerations
ForgeRock’s stack deploys flexibly—on-premise, cloud, hybrid. OpenDJ scales horizontally; OpenAM clusters for high availability.
Poitou stresses user-centric policies: dynamic authorizations based on context (location, device).
Emerging: UMA for resource owner control. Standards mature via IETF, OpenID Foundation.
Enterprises must adapt architectures for agility, ensuring compliance amid fluidity.
Links:
[DevoxxFR2013] Java EE 7 in Detail
Lecturer
David Delabassee is a Principal Product Manager in Oracle’s GlassFish team. Previously at Sun for a decade, he focused on end-to-end Java, related technologies, and tools. Based in Belgium, he contributes to Devoxx Belgium’s steering committee.
Abstract
David Delabassee’s overview details Java EE 7’s innovations, emphasizing developer simplicity and HTML5 support. Covering WebSockets, JSON-P, JAX-RS 2, JMS 2, concurrency, caching, and batch processing, he demonstrates features via GlassFish. The analysis explores alignments with modern needs like cloud and modularity, implications for productivity, and forward compatibility.
Evolution and Key Themes: Simplifying Development and Embracing Modern Web
Delabassee notes Java EE 6’s (2009) popularity, with widespread server adoption. Java EE 7, nearing finalization, builds on this via JCP, comprising 13 updated, 4 new specs.
Themes: ease of development (defaults, pruning), web enhancements (HTML5 via WebSockets), alignment with trends (cloud, multi-tenancy). Pruning removes outdated techs like EJB CMP; new APIs address gaps.
GlassFish 4, the reference implementation, enables early testing. Delabassee demos features, stressing community feedback.
Core API Enhancements: WebSockets, JSON, and REST Improvements
WebSocket (JSR 356): Enables full-duplex, bidirectional communication over single TCP. Annotate endpoints (@ServerEndpoint), handle messages (@OnMessage).
@ServerEndpoint("/echo")
public class EchoEndpoint {
@OnMessage
public void echo(String message, Session session) {
session.getBasicRemote().sendText(message);
}
}
JSON-P (JSR 353): Parsing/processing API with streaming, object models. Complements JAX-RS for RESTful services.
JAX-RS 2 (JSR 339): Client API, filters/interceptors, async support. Client example:
Client client = ClientBuilder.newClient();
WebTarget target = client.target("http://example.com");
Response response = target.request().get();
These foster efficient, modern web apps.
Messaging and Concurrency: JMS 2 and Utilities for EE
JMS 2 simplifies: annotation-based injection (@JMSConnectionFactory), simplified API for sending/receiving.
@Inject
JMSContext context;
@Resource(lookup="myQueue")
Queue queue;
context.send(queue, "message");
Concurrency Utilities (JSR 236): Managed executors, scheduled tasks in EE context. Propagate context to threads, avoiding direct Thread creation.
Batch Applications (JSR 352): Framework for chunk/step processing, job management. XML-defined jobs with readers, processors, writers.
Additional Features and Future Outlook: Caching, CDI, and Java EE 8
Though JCache (JSR 107) deferred, it enables standardized distributed caching, usable on EE 7.
CDI 1.1 enhances: @Vetoed for exclusions, alternatives activation.
Java EE 8 plans: modularity, cloud (PaaS/SaaS), further HTML5. Community shapes via surveys.
Delabassee urges Adopt-a-JSR participation for influence.
Implications for Enterprise Development: Productivity and Adaptability
Java EE 7 boosts productivity via simplifications, aligns with web/cloud via new APIs. Demos show practical integration, like WebSocket chats or batch jobs.
Challenges: Learning curve for new features; benefits outweigh via robust, scalable apps.
Forward, EE 7 paves for EE 8’s evolutions, ensuring Java’s enterprise relevance.
Links:
[DevoxxBE2012] What’s New in Groovy 2.0?
Guillaume Laforge, the Groovy Project Lead and a key figure in its development since its inception, provided an extensive overview of Groovy’s advancements. Guillaume, employed by the SpringSource division of VMware at the time, highlighted how Groovy enhances developer efficiency and runtime speed with each iteration. He began by recapping essential elements from Groovy 1.8 before delving into the innovations of version 2.0, emphasizing its role as a versatile language on the JVM.
Guillaume underscored Groovy’s appeal as a scripting alternative to Java, offering dynamic capabilities while allowing modular usage for those not requiring full dynamism. He illustrated this with examples of seamless integration, such as embedding Groovy scripts in Java applications for flexible configurations. This approach reduces boilerplate and fosters rapid prototyping without sacrificing compatibility.
Transitioning to performance, Guillaume discussed optimizations in method invocation and arithmetic operations, which contribute to faster execution. He also touched on library enhancements, like improved date handling and JSON support, which streamline common tasks in enterprise environments.
A significant portion focused on modularity in Groovy 2.0, where the core is split into smaller jars, enabling selective inclusion of features like XML processing or SQL support. This granularity aids in lightweight deployments, particularly in constrained settings.
Static Type Checking for Reliability
Guillaume elaborated on static type checking, a flagship feature allowing early error detection without runtime overhead. He demonstrated annotating classes with @TypeChecked to enforce type safety, catching mismatches in assignments or method calls at compile time. This is particularly beneficial for large codebases, where dynamic typing might introduce subtle bugs.
He addressed extensions for domain-specific languages, ensuring type inference works even in complex scenarios like builder patterns. Guillaume showed how this integrates with IDEs for better code completion and refactoring support.
Static Compilation for Performance
Another cornerstone, static compilation via @CompileStatic, generates bytecode akin to Java’s, bypassing dynamic dispatch for speed gains. Guillaume benchmarked scenarios where this yields up to tenfold improvements, ideal for performance-critical sections.
He clarified that dynamic features remain available selectively, allowing hybrid approaches. This flexibility positions Groovy as a bridge between scripting ease and compiled efficiency.
InvokeDynamic Integration and Future Directions
Guillaume explored JDK7’s invokedynamic support, optimizing dynamic calls for better throughput. He presented metrics showing substantial gains in invocation-heavy code, aligning Groovy closer to Java’s performance.
Looking ahead, he previewed Groovy 2.1 enhancements, including refined type checking for DSLs and complete invokedynamic coverage. For Groovy 3.0, a revamped meta-object protocol and Java 8 lambda compatibility were on the horizon, with Groovy 4.0 adopting ANTLR4 for parsing.
In Q&A, Guillaume addressed migration paths and community contributions, reinforcing Groovy’s evolution as responsive to user needs.
His session portrayed Groovy as maturing into a robust, adaptable toolset for modern JVM development, balancing dynamism with rigor.
Links:
“Apache Maven Dependency Management” by Jonathan Lalou, was published by Packt
Abstract
I am glad and proud to announce the publication of “Apache Maven Dependency Management”, by Packt.
Direct link: https://www.packtpub.com/apache-maven-dependency-management/book
Alternate locations: Amazon.com, Amazon.co.uk, Barnes & Noble.
On this occasion, I’d like to thank all Packt team for allowing me achieving this project.

What you will learn from this book
- Learn how to use profiles, POM, parent POM, and modules
- Increase build-speed and decrease archive size
- Set, rationalize, and exclude transitive dependencies
- Optimize your POM and its dependencies
- Migrate projects to Maven including projects with exotic dependencies
In Detail
Managing dependencies in a multi-module project is difficult. In a multi-module project, libraries need to share transitive relations with each other. Maven eliminates this need by reading the project files of dependencies to figure out their inter-relations and other related information. Gaining an understanding of project dependencies will allow you to fully utilize Maven and use it to your advantage.
Aiming to give you a clear understanding of Maven’s functionality, this book focuses on specific case studies that shed light on highly useful Maven features which are often disregarded. The content of this book will help you to replace homebrew processes with more automated solutions.
This practical guide focuses on the variety of problems and issues which occur during the conception and development phase, with the aim of making dependency management as effortless and painless as possible. Throughout the course of this book, you will learn how to migrate from non-Maven projects to Maven, learn Maven best practices, and how to simplify the management of multiple projects. The book emphasizes the importance of projects as well as identifying and fixing potential conflicts before they become issues. The later sections of the book introduce you to the methods that you can use to increase your team’s productivity. This book is the perfect guide to help make you into a proud software craftsman.
Approach
An easy-to-follow, tutorial-based guide with chapters progressing from basic to advanced dependency management.
Who this book is for
If you are working with Java or Java EE projects and you want to take advantage of Maven dependency management, then this book is ideal for you. This book is also particularly useful if you are a developer or an architect. You should be well versed with Maven and its basic functionalities if you wish to get the most out of this book.
Table of content
- Preface
- Chapter 1: Basic Dependency Management
- Chapter 2: Dependency Mechanism and Scopes
- Chapter 3: Dependency Designation (advanced)
- Chapter 4: Migration of Dependencies to Apache Maven
- Chapter 5: Tools within Your IDE
- Chapter 6: Release and Distribute
- Appendix: Useful Public Repositories
- Index
[DevoxxFR2013] JCP & Adopt a JSR Workshop
Lecturer
Patrick Curran chairs the Java Community Process (JCP), overseeing membership, processes, and Executive Committee. With over 20 years in software, including 15 at Sun, he led Java Conformance Engineering and chaired related councils. Active in W3C and OASIS.
Arun Gupta directs Developer Advocacy at Red Hat, focusing on JBoss Middleware. A Java EE founding member at Sun, he drove global adoption; at Oracle, he launched Java EE 7.
Mike Seghers, an IT consultant since 2001, specializes in Java enterprise web apps using frameworks like Spring, JSF. Experienced in RIA and iOS, he engages developer communities.
Abstract
Patrick Curran, Arun Gupta, and Mike Seghers’s workshop guides joining the Java Community Process (JCP) and participating in Adopt-a-JSR. They explain membership, transparency, and tools for JUG involvement like hackathons. Focusing on Java EE 8, the session analyzes collaboration benefits, demonstrating practical contributions for standard evolution.
Understanding JCP: Membership and Participation Pathways
Curran outlines JCP membership: free for individuals via jcp.org, requiring agreements; paid for corporations/non-profits ($2,000-$5,000). Java User Groups join as associates, nominating representatives.
Adopt-a-JSR encourages JUGs to engage JSRs: review specs, test implementations, provide feedback. This democratizes development, ensuring community input.
Gupta details Java EE 8 focus: HTML5, cloud, modularity. Adopt-a-JSR aids via mailing lists, issue trackers, wikis.
Practical Engagement: Tools and Initiatives for Collaboration
Tools include mailing lists for discussions, JIRA for bugs, GitHub for code. JUGs organize hack days, building samples.
Seghers demos Belgian JUG’s app: uses JSF, EJB, JPA for urban travelers game. Source on GitHub, integrates WebSockets.
This hands-on approach educates, uncovers issues early.
Case Studies: Global Adopt-a-JSR Impact
Examples: London JUG’s multiple JSR contributions; SouJava’s CDI focus; Morocco JUG’s hackathons. Chennai JUG built apps; Egypt JUG presented at conferences.
These illustrate visibility, skill-building, influence on standards.
Broader Implications: Enhancing Transparency and Community
JCP 2.8 mandates open Expert Groups, encouraging participation. Adopt-a-JSR amplifies this, benefiting platforms via diverse input.
Curran urges minimal commitments: feedback, testing. Gupta highlights launch opportunities.
Workshop fosters collaborative ecosystem, strengthening Java’s future.
Links:
[DevoxxFR2013] Live Coding: A WOA Application in 50 Minutes
Lecturer
Guillaume Bort co-founded Zenexity, specializing in Web Oriented Architecture. Previously a J2EE expert, he developed web frameworks for large enterprises, creating Play Framework to prioritize simplicity. He leads Play’s development.
Sadek Drobi, Zenexity’s CTO, focuses on enterprise applications, bridging problem and solution domains. As a programming languages expert, he contributes to Play Framework’s core team.
Abstract
Guillaume Bort and Sadek Drobi’s live coding demonstrates building a Web Oriented Architecture (WOA) application using Play Framework and Scala. Consuming Twitter’s API, they handle JSON, integrate MongoDB, and stream real-time data via Server-Sent Events to an HTML5 interface. The session analyzes reactive programming, asynchronous handling, and scalability, showcasing Play’s efficiency for modern web apps.
Setting Up the Foundation: Play Framework and Twitter API Integration
Bort and Drobi initiate with Play Framework, creating a project via activator. They configure routes for homepage and stream endpoints, using Scala’s async for non-blocking I/O.
Consuming Twitter’s search API: construct URLs with keywords like “DevoxxFR”, include entities for images. Use WS (WebService) for HTTP requests, parsing JSON responses.
They extract tweet data: user, text, images. Handle pagination with since_id for subsequent queries, building a stream of results.
This setup leverages Play’s stateless design, ideal for scalability.
Building Reactive Streams: Enumerators and Asynchronous Processing
To create a continuous stream, they employ Enumerators and Iteratees. Poll Twitter periodically (e.g., every 5 seconds), yielding new tweets.
Code uses concurrent scheduling:
val tweets: Enumerator[Tweet] = Enumerator.generateM {
Future {
// Fetch and parse tweets
Some(newTweets)
}
}
Flatten to a single stream. Handle errors with recover, ensuring resilience.
This reactive approach processes data as it arrives, avoiding blocking and enabling real-time updates.
Persisting Data: Integrating MongoDB with ReactiveMongo
For storage, integrate ReactiveMongo: asynchronous, non-blocking driver. Define Tweet case class, insert via JSONCollection.
val collection = db.collection[JSONCollection]("tweets")
collection.insert(tweetJson)
Query for latest since_id. Use find with sort/take for efficient retrieval.
This maintains asynchrony, aligning with WOA’s distributed nature.
Streaming to Clients: Server-Sent Events and HTML5 Interface
Output as EventSource: chunked response with JSON events.
Ok.chunked(tweets &> EventSource()).as("text/event-stream")
Client-side: JavaScript EventSource listens, appending images with animations.
Handle dynamics: form submission triggers stream, updating UI.
This enables push updates, enhancing interactivity without WebSockets.
Optimizing for Scalability: Backpressure and Error Handling
Address overload: use onBackpressureBuffer to queue, drop, or fail. Custom strategies compress or ignore excess.
Play’s Akka integration aids actor-based concurrency.
Implications: Builds resilient, scalable apps handling high loads gracefully.
Collaborative Development: Live Insights and Community Resources
Session highlights rapid prototyping: zero slides, GitHub commits for following.
Drobi comments on concepts like futures unification in Scala 2.10, inter-library interoperability.
They encourage exploring Play docs, plugins for extensions.
This methodology fosters understanding of reactive paradigms, preparing for distributed systems.