Posts Tagged ‘DependencyInjection’
[DevoxxBE2012] Re-imagining the Browser with AngularJS
Misko Hevery and Igor Minar, Google engineers and AngularJS co-leads, re-envisioned client-side development. Misko, an Agile coach with open-source contributions, partnered with Igor, focused on developer tools, to showcase AngularJS’s approach to simplifying web apps.
They posited extending the browser with declarative HTML and JavaScript, reducing code while enhancing readability. AngularJS bridges to future standards like web components and model-driven views.
Misko demonstrated data binding, where models sync with views automatically, eliminating manual DOM manipulation. Directives extend HTML, creating custom elements for reusability.
Igor highlighted dependency injection for modularity, and services for shared logic. Routing enables single-page apps, with controllers managing scopes.
They emphasized testability, with built-in mocking and end-to-end testing.
Declarative UI and Data Binding
Misko illustrated two-way binding: changes in models update views, and vice versa, without boilerplate. This declarative paradigm contrasts imperative jQuery-style coding.
Directives like ng-repeat generate lists dynamically, while filters format data.
Modularity and Dependency Management
Igor explained modules encapsulating functionality, injected via DI. This promotes clean, testable code.
Services, factories, and providers offer flexible creation patterns.
Routing and Application Structure
NgRoute handles navigation, loading templates and controllers. Scopes isolate data, with inheritance for hierarchy.
Testing and Future Alignment
Angular’s design facilitates unit and e2e tests, using Karma and Protractor.
They previewed alignment with web components, where directives become custom tags.
In Q&A, they compared to Knockout.js, noting Angular’s framework scope versus library focus.
Misko and Igor’s presentation framed AngularJS as transformative, anticipating browser evolutions while delivering immediate productivity.
Links:
[DevoxxBE2012] Weld-OSGi in Action
Mathieu Ancelin and Matthieu Clochard, software engineers at SERLI specializing in Java EE and modular systems, showcased the synergy between CDI, OSGi, and Weld in their Weld-OSGi framework during DevoxxBE2012. Mathieu, a member of the CDI 1.1 expert group and contributor to projects like GlassFish, collaborated with Matthieu, who focuses on OSGi integrations, to demonstrate how Weld-OSGi simplifies dynamic application assembly without added complexity.
They started with CDI basics, where dependency injection manages component lifecycles via annotations like @Inject. OSGi’s modularity, with bundles as deployment units and a dynamic service registry, complements this by allowing runtime changes. Weld-OSGi bridges them, enabling CDI beans to interact seamlessly with OSGi services.
A demo illustrated bootstrapping Weld-OSGi in an OSGi environment, registering bundles, and using extensions for event handling. They emphasized transparent service interactions, where CDI observes OSGi events for dynamic updates.
Mathieu and Matthieu highlighted Weld-OSGi’s role in making OSGi accessible, countering perceptions of its difficulty by leveraging CDI’s programming model.
Fundamentals of CDI and OSGi Integration
Mathieu explained CDI’s bean management, scopes, and qualifiers for precise injections. Matthieu detailed OSGi’s bundle lifecycle and service registry, where services publish and consume dynamically.
Weld-OSGi embeds CDI containers in OSGi, using extensions to observe bundle events and register services as beans. This allows injecting OSGi services into CDI components effortlessly.
Dynamic Features and Practical Demonstrations
They demonstrated service dynamism: publishing a service updates dependent beans automatically. Unpublishing triggers alternatives or errors, ensuring robustness.
Demos included hybrid applications where Java EE components interact with OSGi bundles via the registry, deploying parts dynamically without restarts.
Future Prospects and Community Engagement
Mathieu discussed ongoing work for hybrid servers like GlassFish, embedding Weld-OSGi for cleaner integrations. They referenced RFC 146, inspired by Weld-OSGi, for native CDI-OSGi support.
Encouraging trials, they pointed to GitHub repositories with examples and documentation, fostering feedback to evolve the framework.
Mathieu and Matthieu’s presentation illustrated Weld-OSGi’s potential to create fully dynamic modular applications, blending CDI’s elegance with OSGi’s power.
Links:
[DevoxxBE2012] Building Modular Applications with Enterprise OSGi
At DevoxxBE2012, Tim Ward and Holly Cummins, both seasoned experts in OSGi and enterprise technologies, delivered a comprehensive exploration into leveraging Enterprise OSGi for constructing modular applications. Tim, affiliated with Paremus and a key contributor to Apache Aries, alongside Holly from IBM, who focuses on WebSphere and performance tooling, guided attendees through the intricacies of transforming traditional Java EE setups into dynamic, OSGi-based systems. Their session bridged familiar concepts like WAR files and dependency injection with OSGi’s modularity, addressing common pain points in class path management.
They initiated the discussion by outlining Enterprise OSGi’s origins and relevance. Emerging in 2010, this specification enhances OSGi’s core, which has powered embedded systems and IDEs like Eclipse for over a decade, to better suit server-side enterprise needs. Tim and Holly emphasized how it integrates seamlessly with application servers, enabling features such as web applications, database interactions, and transaction management within an OSGi framework.
A key theme was the modularity crisis in large Java EE projects. They illustrated how sprawling WAR files, often exceeding server sizes like Tomcat’s 7MB core, accumulate unnecessary libraries, leading to class path hell. By contrasting tangled dependency graphs with OSGi’s structured approach, they demonstrated how explicit module definitions simplify maintenance and foster cleaner architectures.
Embracing OSGi Modularity Basics
Delving deeper, Tim and Holly explained OSGi’s bundle model, where each bundle—a JAR with added metadata—declares imports and exports via manifests. This enforces visibility rules, preventing accidental dependencies and promoting intentional design. They highlighted how bundles resolve dynamically, allowing runtime adaptability without redeployments.
The duo addressed common misconceptions, asserting that OSGi simplifies both complex and straightforward tasks. For instance, they showcased how dependency injection via Blueprint or Spring works effortlessly in OSGi, maintaining developer familiarity while adding modularity benefits.
They also touched on third-party library integration, noting challenges with non-OSGi JARs but solutions through tools that convert them into bundles. This ensures compatibility, reducing the bloat from redundant inclusions like JavaMail APIs.
Transitioning from WAR to WAB
A pivotal segment focused on evolving WAR files into Web Application Bundles (WABs). Tim and Holly demonstrated this migration, starting with a standard WAR and incorporating OSGi manifests to define it as a bundle. This shift enables deployment in OSGi containers like Apache Karaf or WebSphere Liberty, preserving servlet functionality while gaining modularity.
They illustrated error handling advantages: OSGi fails fast on missing dependencies, unlike runtime surprises in traditional setups. Through live examples, they showed bundles starting only when requirements are met, enhancing reliability.
Furthermore, they explored dynamism, where services can be added or removed at runtime, updating applications without downtime. This transparency in remoting and service interactions aligns with Java EE goals but executes more fluidly in OSGi.
Handling Dependencies and Repositories
Tim and Holly then examined dependency management, advocating explicit declarations to avoid hidden assumptions. They introduced bundle repositories, akin to Maven but tailored for OSGi, which automatically provision required bundles. This centralizes library control, aiding compliance in regulated environments.
In demonstrations, they deployed applications across servers like Liberty and Karaf, resolving dependencies on-the-fly. For instance, adding Joda Time via a repository revived a stalled bundle, showcasing practical modularity.
They stressed architectural enforcement: OSGi’s rules prevent poor practices, but good design remains essential. Tools like Eclipse plugins aid in visualizing and managing these structures.
Demonstrating Dynamism and Best Practices
The session culminated in hands-on demos, where a simple web app evolved into a dynamic OSGi system. Starting with a basic servlet, they integrated services for runtime changes, like toggling UI elements without restarts.
Tim and Holly concluded by reinforcing OSGi’s power in enforcing scalable, maintainable systems. They recommended resources, including their book “Enterprise OSGi in Action,” for further learning. Their presentation underscored how Enterprise OSGi not only resolves class path issues but elevates enterprise development to new levels of flexibility and efficiency.
Links:
[DevoxxBE2012] Spring 3.2 and 3.2 Themes and Trends
In a dynamic presentation, Josh Long, a prominent Spring developer advocate and author, delved into the evolving landscape of the Spring Framework. As someone deeply embedded in the Spring ecosystem, Josh highlighted how Spring continues to address modern development challenges while maintaining its core principles. He began by recapping the framework’s foundational aspects, emphasizing its role in promoting clean, extensible code without unnecessary reinvention.
Josh explained that Spring operates as a lightweight dependency injection container, layered with vertical technologies for diverse needs like mobile development, big data handling, and web applications. This decoupling from underlying infrastructure enables seamless transitions between environments, from traditional servers to cloud platforms. He noted the increasing complexity in data stores, caching solutions, and client interfaces, underscoring Spring’s relevance in today’s fragmented tech world. By focusing on dependency injection, aspect-oriented programming, and portable service abstractions, Spring empowers developers to build robust, maintainable systems.
Transitioning to recent advancements, Josh reviewed Spring 3.1, released in December 2011, which introduced features like environment profiles and Java-based configuration. These enhancements facilitate tailored bean activations across development stages, simplifying configurations that diverge between local setups and production clouds. He illustrated this with examples of data sources, showing how profiles partition configurations effectively.
Moreover, Josh discussed the caching abstraction in Spring 3.1, which provides a unified SPI for various caches like EHCache and Redis. This abstraction, combined with annotations for cache management, streamlines performance optimizations without locking developers into specific implementations.
Core Refinements in Spring 3.2
Shifting focus to Spring 3.2, slated for release by year’s end, Josh outlined its core refinements. Building on Java 7, it incorporates asynchronous support from Servlet 3.0, enabling efficient handling of long-running tasks in web applications. He demonstrated this with controller methods returning Callable or DeferredResult, allowing requests and responses to process in separate threads, enhancing scalability.
Josh also introduced the Spring MVC Test Framework, a tool for unit testing controllers with mocked servlet APIs. This framework, revamped for 3.2, integrates seamlessly with existing test contexts, promoting better code quality through isolated testing.
Additionally, upgrades to the Spring Expression Language (SpEL) and backported features from 3.1.x bolster the framework’s expressiveness and compatibility. Josh emphasized that these changes maintain Spring’s low-risk upgrade path, ensuring stability for enterprise adopters.
Looking Ahead to Spring 3.3
Josh then previewed Spring 3.3, expected in late 2013, which promises substantial innovations. Central to this release is support for Java SE 8 features, including lambdas, which align naturally with Spring’s single abstract method interfaces. He showcased how lambdas simplify callbacks in components like JdbcTemplate, reducing boilerplate code.
Furthermore, Josh touched on enhanced Groovy support and the integration of the Grails Bean Builder, expanding Spring’s appeal for dynamic languages. The release will also track Java EE 7 APIs, such as JCache 1.0 and JMS 2.0, with annotation-centric endpoints for message-driven architectures.
WebSocket support, crucial for real-time web applications, will be fully integrated into Spring MVC, complementing existing messaging capabilities in Spring Integration.
Strategic Motivations and Community Impact
Throughout his talk, Josh articulated the motivations behind Spring’s shorter release cycles, aiming to deliver timely features without overwhelming users. He stressed the framework’s alignment with emerging standards, positioning it as a bridge between Java SE 7/8 and EE 7.
Josh also shared insights into community contributions, mentioning the GitHub-based model and Gradle builds that foster collaboration. He encouraged feedback, highlighting his role in curating community resources like the weekly roundup on springsource.org.
In closing, Josh fielded questions on topics like bean metadata navigation and conditional caching, reinforcing Spring’s commitment to developer productivity. His enthusiasm underscored Spring’s enduring value in navigating the complexities of modern software engineering.