|By Lahlali Issam||
|December 7, 2011 08:45 AM EST||
According to the MVC definition from wikipedia:
"Model View Controller (MVC) pattern creates applications that separate the different aspects of the application (input logic, business logic, and UI logic), while providing a loose coupling between these elements."
The question is which one is the best to use?
As with any debate like that, there's no unique solution as it depends on many factors. In this article we try using JavaDepend to discover PureMVC in-depth, and talk about the main difference between it and the other variants.
PureMVC was popularized first by Flex and Flash developers, but it was ported after to many other langugages.The following GWT sample uses the Java PureMVC framework. Let's analyze it to explore PureMVC concepts.
PureMVC Basic Concepts
Here's the structure of the project
This structure shows the main PureMVC concepts:
- Facade: Initializes and caches the core actors (model, view, and controller) and provides a single place to access all of them.
- Proxies: Expose an API for manipulating the data model ,including data retrieved from remote services.
- Mediators: The view communicate with their Mediators using Events and exposing some properties for the concrete Mediator to inspect or manage. A Mediator connects a View Component with its data and communicates with the rest of the system on its behalf.
- Commands: A Command may retrieve and interact with Proxies, communicate with Mediators, or execute other Commands. Commands are often used to orchestrate complex or system-wide activities such as application startup and shutdown.
The PureMVC best practices encourage developers to put each actor into a specific namespace to modularize the application better.
Here's the graph representing the communication between all namespaces.
There's no dependency cycle as it's well layered, which makes it very clear and simple to understand. The matrix gives us more details about dependency weight between all the namespaces.
The PureMVC Glue
To go deep inside the sample let's discover the dependency graph between all classes:
What's interesting in this dependency graph is that almost all classes uses INotification.
PureMVC uses the publish-subscribe pattern to communicate between all actors (Model,View,Controler), and for this reason INotification is mainly used. To check that let's discover the most popular types and for that we can use the TypeRank metric.
SELECT TOP 100 TYPES ORDER BY TypeRank DESC, TypeCa DESC
The three most popular types concern the notification mechanism, the proof that this concept is the glue of the PureMVC framework. Almost all communication between actors use notification, which makes them less coupled.
Publish–subscribe is a messaging pattern where senders of messages, called publishers, do not program the messages to be sent directly to specific receivers, called subscribers. Published messages are characterized into classes, without knowledge of what, if any, subscribers there may be. Subscribers express interest in one or more classes, and only receive messages that are of interest, without knowledge of what, if any, publishers there are.
This allows asynchronous, event-driven communications between the actors of the system, and also promotes a loose coupling between those actors, since the subscriber never needs to have direct knowledge of the publisher.
For our sample we can search for all classes using Notifier class to notify other actors.
SELECT METHODS FROM JARS "PureMVC" WHERE IsDirectlyUsing
Almost all actors: Mediators,Commands and proxies use the notification mechanism to communicate with each others.
Here's a concrete example of adding a new user from view.
In this sample the mediator ask the proxy to add a user and afterward sends a notification to inform all other components that a user was added.
What's interesting to note here is that the mediator communicates directly with the proxy. In PureMVC, proxies can't act as subscribers, and can only publish notification.
Inside PureMVC Concepts
Facade is singleton
If we search where the facade is instantiated
SELECT METHODS WHERE DepthOfCreateA
"org.puremvc.java.multicore.patterns.facade.Facade" == 1
Only one static method getInstance instantiates it, but this method has one parameter so we can create many facades. Each component has its own singleton facade identified by a name, and that's why we talk about PureMVC MultiCore.
SELECT METHODS WHERE IsDirectlyUsedBy
The facade initializes all other actors.
Facade and notification:
The facade caches all actors, and when a notification is published, the facade notifies all observers.
Let's search for all methods used by DeleteUserCommand, the command responsible for deleting a user.
SELECT METHODS WHERE IsDirectlyUsedBy
The command doesn't communicate directly with other components, except for the proxy as we observed earlier.
SELECT METHODS WHERE IsDirectlyUsedBy
Like Commands, mediators mainly use notifications to interact with other classes except for proxies.
The question that makes a difference using PureMVC and gives us three more other variants is: Who communicates with the proxy?
Here are three ways developers are using PureMVC:
1. Only commands use proxies: We suppose that only commands have to abstract the logic of the application. This solution makes the code more reusable, for example, deleteuser could be used by many classes, and if this logic exists in a mediator instead of a command, we have to duplicate the code if another mediator need to also delete a user.
2. Commands and mediators use the proxy: For our sample it's what happens.The AddUser is invoked from a mediator and the deleteuser from a command.
3. Only Mediators use proxies and commands are used only for startup: Some developers prefer not to use Commands and use only Mediators, to not add more classes and maybe more complexity to the code.
The main difference between PureMVC and the other variants is the way that all actors communicate with each others. PureMVC chooses the asynchronous and the less-coupled solution.
Things are being built upon cloud foundations to transform organizations. This CEO Power Panel at 15th Cloud Expo, moderated by Roger Strukhoff, Cloud Expo and @ThingsExpo conference chair, will address the big issues involving these technologies and, more important, the results they will achieve. How important are public, private, and hybrid cloud to the enterprise? How does one define Big Data? And how is the IoT tying all this together?
Oct. 31, 2014 08:30 AM EDT Reads: 1,884
We certainly live in interesting technological times. And no more interesting than the current competing IoT standards for connectivity. Various standards bodies, approaches, and ecosystems are vying for mindshare and positioning for a competitive edge. It is clear that when the dust settles, we will have new protocols, evolved protocols, that will change the way we interact with devices and infrastructure. We will also have evolved web protocols, like HTTP/2, that will be changing the very core of our infrastructures. At the same time, we have old approaches made new again like micro-services...
Oct. 31, 2014 07:00 AM EDT Reads: 1,624
The only place to be June 9-11 is Cloud Expo & @ThingsExpo 2015 East at the Javits Center in New York City. Join us there as delegates from all over the world come to listen to and engage with speakers & sponsors from the leading Cloud Computing, IoT & Big Data companies. Cloud Expo & @ThingsExpo are the leading events covering the booming market of Cloud Computing, IoT & Big Data for the enterprise. Speakers from all over the world will be hand-picked for their ability to explore the economic strategies that utility/cloud computing provides. Whether public, private, or in a hybrid form, clo...
Oct. 30, 2014 05:30 PM EDT Reads: 1,286
SYS-CON Events announces a new pavilion on the Cloud Expo floor where WebRTC converges with the Internet of Things. Pavilion will showcase WebRTC and the Internet of Things. The Internet of Things (IoT) is the most profound change in personal and enterprise IT since the creation of the Worldwide Web more than 20 years ago. All major researchers estimate there will be tens of billions devices--computers, smartphones, tablets, and sensors – connected to the Internet by 2020. This number will continue to grow at a rapid pace for the next several decades.
Oct. 30, 2014 05:30 PM EDT Reads: 2,184
SYS-CON Events announced today that Gridstore™, the leader in software-defined storage (SDS) purpose-built for Windows Servers and Hyper-V, will exhibit at SYS-CON's 15th International Cloud Expo®, which will take place on November 4–6, 2014, at the Santa Clara Convention Center in Santa Clara, CA. Gridstore™ is the leader in software-defined storage purpose built for virtualization that is designed to accelerate applications in virtualized environments. Using its patented Server-Side Virtual Controller™ Technology (SVCT) to eliminate the I/O blender effect and accelerate applications Gridsto...
Oct. 30, 2014 02:00 PM EDT Reads: 2,560
SYS-CON Events announced today that Red Hat, the world's leading provider of open source solutions, will exhibit at Internet of @ThingsExpo, which will take place on November 4–6, 2014, at the Santa Clara Convention Center in Santa Clara, CA. Red Hat is the world's leading provider of open source software solutions, using a community-powered approach to reliable and high-performing cloud, Linux, middleware, storage and virtualization technologies. Red Hat also offers award-winning support, training, and consulting services. As the connective hub in a global network of enterprises, partners, a...
Oct. 30, 2014 12:15 PM EDT Reads: 2,067
As the Internet of Things unfolds, mobile and wearable devices are blurring the line between physical and digital, integrating ever more closely with our interests, our routines, our daily lives. Contextual computing and smart, sensor-equipped spaces bring the potential to walk through a world that recognizes us and responds accordingly. We become continuous transmitters and receivers of data. In his session at Internet of @ThingsExpo, Andrew Bolwell, Director of Innovation for HP’s Printing and Personal Systems Group, will discuss how key attributes of mobile technology – touch input, senso...
Oct. 30, 2014 12:00 PM EDT Reads: 1,729
The Internet of Things (IoT) is making everything it touches smarter – smart devices, smart cars and smart cities. And lucky us, we’re just beginning to reap the benefits as we work toward a networked society. However, this technology-driven innovation is impacting more than just individuals. The IoT has an environmental impact as well, which brings us to the theme of this month’s #IoTuesday Twitter chat. The ability to remove inefficiencies through connected objects is driving change throughout every sector, including waste management. BigBelly Solar, located just outside of Boston, is trans...
Oct. 30, 2014 11:00 AM EDT Reads: 2,174
Connected devices and the Internet of Things are getting significant momentum in 2014. In his session at Internet of @ThingsExpo, Jim Hunter, Chief Scientist & Technology Evangelist at Greenwave Systems, will examine three key elements that together will drive mass adoption of the IoT before the end of 2015. The first element is the recent advent of robust open source protocols (like AllJoyn and WebRTC) that facilitate M2M communication. The second is broad availability of flexible, cost-effective storage designed to handle the massive surge in back-end data in a world where timely analytics...
Oct. 30, 2014 08:00 AM EDT Reads: 1,573
Internet of @ThingsExpo Silicon Valley announced on Thursday its first 12 all-star speakers and sessions for its upcoming event, which will take place November 4-6, 2014, at the Santa Clara Convention Center in California. @ThingsExpo, the first and largest IoT event in the world, debuted at the Javits Center in New York City in June 10-12, 2014 with over 6,000 delegates attending the conference. Among the first 12 announced world class speakers, IBM will present two highly popular IoT sessions, which will take place November 4-6, 2014 at the Santa Clara Convention Center in Santa Clara, Calif...
Oct. 30, 2014 07:30 AM EDT Reads: 2,274
The Internet of Things (IoT) promises to evolve the way the world does business; however, understanding how to apply it to your company can be a mystery. Most people struggle with understanding the potential business uses or tend to get caught up in the technology, resulting in solutions that fail to meet even minimum business goals. In his session at Internet of @ThingsExpo, Jesse Shiah, CEO / President / Co-Founder of AgilePoint Inc., will show what is needed to leverage the IoT to transform your business. He will discuss opportunities and challenges ahead for the IoT from a market and tec...
Oct. 29, 2014 11:00 PM EDT Reads: 1,547
SYS-CON Events announced today that TeleStax, the main sponsor of Mobicents, will exhibit at Internet of @ThingsExpo, which will take place on November 4–6, 2014, at the Santa Clara Convention Center in Santa Clara, CA. TeleStax provides Open Source Communications software and services that facilitate the shift from legacy SS7 based IN networks to IP based LTE and IMS networks hosted on private (on-premise), hybrid or public clouds. TeleStax products include Restcomm, JSLEE, SMSC Gateway, USSD Gateway, SS7 Resource Adaptors, SIP Servlets, Rich Multimedia Services, Presence Services/RCS, Diame...
Oct. 29, 2014 05:00 PM EDT Reads: 1,640
From a software development perspective IoT is about programming "things," about connecting them with each other or integrating them with existing applications. In his session at @ThingsExpo, Yakov Fain, co-founder of Farata Systems and SuranceBay, will show you how small IoT-enabled devices from multiple manufacturers can be integrated into the workflow of an enterprise application. This is a practical demo of building a framework and components in HTML/Java/Mobile technologies to serve as a platform that can integrate new devices as they become available on the market.
Oct. 29, 2014 02:15 PM EDT Reads: 2,071
SYS-CON Events announced today that O'Reilly Media has been named “Media Sponsor” of SYS-CON's 15th International Cloud Expo®, which will take place on November 4–6, 2014, at the Santa Clara Convention Center in Santa Clara, CA. O'Reilly Media spreads the knowledge of innovators through its books, online services, magazines, and conferences. Since 1978, O'Reilly Media has been a chronicler and catalyst of cutting-edge development, homing in on the technology trends that really matter and spurring their adoption by amplifying "faint signals" from the alpha geeks who are creating the future. An...
Oct. 29, 2014 01:00 PM EDT Reads: 1,616
SYS-CON Events announced today that Aria Systems, the recurring revenue expert, has been named "Bronze Sponsor" of SYS-CON's 15th International Cloud Expo®, which will take place on November 4-6, 2014, at the Santa Clara Convention Center in Santa Clara, CA. Aria Systems helps leading businesses connect their customers with the products and services they love. Industry leaders like Pitney Bowes, Experian, AAA NCNU, VMware, HootSuite and many others choose Aria to power their recurring revenue business and deliver exceptional experiences to their customers.
Oct. 29, 2014 10:00 AM EDT Reads: 2,124
The Transparent Cloud-computing Consortium (abbreviation: T-Cloud Consortium) will conduct research activities into changes in the computing model as a result of collaboration between "device" and "cloud" and the creation of new value and markets through organic data processing High speed and high quality networks, and dramatic improvements in computer processing capabilities, have greatly changed the nature of applications and made the storing and processing of data on the network commonplace.
Oct. 29, 2014 10:00 AM EDT Reads: 2,051
The Internet of Things (IoT) is going to require a new way of thinking and of developing software for speed, security and innovation. This requires IT leaders to balance business as usual while anticipating for the next market and technology trends. Cloud provides the right IT asset portfolio to help today’s IT leaders manage the old and prepare for the new. Today the cloud conversation is evolving from private and public to hybrid. This session will provide use cases and insights to reinforce the value of the network in helping organizations to maximize their company’s cloud experience.
Oct. 29, 2014 09:00 AM EDT Reads: 2,086
As a disruptive technology, Web Real-Time Communication (WebRTC), which is an emerging standard of web communications, is redefining how brands and consumers communicate in real time. The on-going narrative around WebRTC has largely been around incorporating video, audio and chat functions to apps. In his session at Internet of @ThingsExpo, Alex Gouaillard, Founder and CTO of Temasys Communications, will look at a fourth element – data channels – and talk about its potential to move WebRTC beyond browsers and into the Internet of Things.
Oct. 29, 2014 08:00 AM EDT Reads: 1,648
SYS-CON Events announced today that Gigaom Research has been named "Media Sponsor" of SYS-CON's 15th International Cloud Expo®, which will take place on November 4-6, 2014, at the Santa Clara Convention Center in Santa Clara, CA. Ashar Baig, Research Director, Cloud, at Gigaom Research, will also lead a Power Panel on the topic "Choosing the Right Cloud Option." Gigaom Research provides timely, in-depth analysis of emerging technologies for individual and corporate subscribers. Gigaom Research's network of 200+ independent analysts provides new content daily that bridges the gap between break...
Oct. 28, 2014 11:45 PM EDT Reads: 1,684
The Industrial Internet revolution is now underway, enabled by connected machines and billions of devices that communicate and collaborate. The massive amounts of Big Data requiring real-time analysis is flooding legacy IT systems and giving way to cloud environments that can handle the unpredictable workloads. Yet many barriers remain until we can fully realize the opportunities and benefits from the convergence of machines and devices with Big Data and the cloud, including interoperability, data security and privacy.
Oct. 28, 2014 12:00 PM EDT Reads: 1,954