Microsoft Cloud Authors: Liz McMillan, David H Deans, Automic Blog, Pat Romanski, Janakiram MSV

Related Topics: Microsoft Cloud

Microsoft Cloud: Article

Mercado Eletrônico Case Study

Migrating from ASP/COM to .NET using Spring.NET

Mercado Eletrônico is the leading B2B company in Latin America. Founded in 1994, it provides services for supply chain management, such as e-procurement, catalog, sourcing and collaboration, based on an advanced technology platform supporting more than 30,000 transactions a day and a complex buyer/supplier user community.

The development of Mercado Eletrônico's technology platform started in 1994 using BBS software, which evolved to client/server and, in 1998, to the Web using Microsoft Active Server Pages. In 2005, with an accumulated two million lines of code ranging from stored procedures to AJAX interfaces, most of the code was complex and hard to maintain IDL/COM+ transactional components, implemented in a mix of Visual C++, Borland Delphi, and C#, and used by classic ASP and ASP.NET pages directly.

When .NET 2.0 was released, it was made the primary target for the new technology platform. It offered a great base library and excellent language support. As such, it was a natural choice since most of our code was already Windows-based. However, many years of watching and learning from the advances made in the Java community showed that application frameworks could make development simpler, faster, and easier to test compared to using the base libraries directly. Enter Spring.NET.

Mercado Eletrônico's architecture follows a traditional layered design as shown in the diagram in Figure 1.

Previous architectures started out with the same good intentions of having cleanly separated layers, but in practice the enforcement of this fundamental architectural principal broke down. No matter how hard we tried to keep our less experienced developers from mixing together data access, business logic, and user interface code, they couldn't resist the temptation to add references that would cross layers, e.g., database-specific code inside the business logic layer. The lack of a component in the architecture to help ensure proper isolation from the start resulted in a lot of work to refactor and keep things organized before the release.
Spring.NET addresses this practical concern in a simple and easy-to-follow manner through the use of its Dependency Injection features. Just as important, it provides additional features to help implement each layer.

The central components of Mercado Eletrônico's platform architecture and how they leverage Spring.NET include:
•  Data Access: This layer is designed using Data Access Objects (DAOs) to interact with the database. The DAOs are split into two assemblies. The interfaces defining the data access contract are in one assembly and the implementations are in another separate assembly. This lets us code against the interface contracts, greatly enhancing testability and keeping the data access layer loosely coupled to the service layer. Our primary DAO implementation is built on Spring.NET's ADO.NET Framework, providing a simple yet powerful programming model that requires less code to implement typical data access operations. There is also a second DAO implementation based on the open source .NET object-relational mapping product NHibernate. Using dependency injection, swapping one implementation in and out is extremely simple. This gives us flexibility in easily changing parts of the application over time in a well-controlled manner.
•  Services: The service layer contains our business logic and is also separated into interface and implementation assemblies for each service. The implementation is coded as a standard C# class agnostic to any distributed technology, a "Plain Old C# Object" or POCO. This lets us expose the same implementation as a COM+ component, a Web Service, or via .NET Remoting using Spring.NET's portable service abstraction features. In case we don't need to distribute the object, changing the configuration to use a standard .NET local in-process instance is easy. All of the services are also configured into each other and into the UI layer using Spring.NET. Spring.NET can then also apply declarative transaction management and business logging to the service layer through the use of its Aspect Oriented Programming features.
•  UI layer: Web applications built using ASP.NET make use of Spring.NET's ASP.NET handler, so that we can configure and inject services into our pages just like any other object. Adobe Flex and AJAX applications benefit from using the configuration-exposed Web Services, saving a lot of work in repetitive coding.

Challenges and Spring.NET Benefits
Since our conversion from ASP/COM to .NET, Spring.NET has proved to be an incredibly effective tool for developing the complex, mission-critical applications required by our organization. Mercado Eletrônico has seen substantial improvements in a number of areas:

Loose Coupling and Dependency Injection
In addition to the practical issues previously mentioned regarding the development of a layered application architecture, there was also the common problem of how one layer gets access to its neighbors and how to swap different implementations in and out. Every team found a different way, each with its own associated problems, such as complex component registrations, failure-prone CreateObject() invocations, or even pre-processor directives.

With Spring.NET, our Data Access Objects are auto-wired into our service objects, which in turn are auto-wired into our client code, indirectly, using Spring.NET's dependency injection features. This allows for cleaner and more loosely coupled code, i.e., free of hard-coded infrastructure related lookups for collaborating classes. Since every layer only references the neighbor's interface, not a specific implementation, and gets an appropriate implementation injected via configuration, this allows for an easy external swapping of implementations. Even when there's only one implementation of a given interface, following this pattern lets us enjoy many other features of Spring.NET detailed below.

Most of our code was difficult to test due to the way data access and service classes were implemented, since it had implicit hard-coded dependencies on the runtime environment and other layers. With Spring.NET and its promotion of a code-to-interface style, we can more easily unit-test our code. For example, we could use mock implementations of our Data Access Objects to test business logic in our test cases without changing a single line of application code.

We were also able to use NUnit and its Spring.NET extensions for writing complete integration tests. These extensions can perform a transaction rollback on test case completion, allowing for more comprehensive test coverage and quicker test writing.

More Stories By Ricardo Pardini

Ricardo Pardini has been a technical lead at Mercado Eletrônico for five years and led the developer team on this .NET migration project. He specializes in virtualization, designing and developing rich Internet applications, and enjoys being a part of the prolific .NET and Java communities.

More Stories By Eric Lemes

Eric Lemes is a lead application designer and developer at Mercado Eletrônico. He focuses on the development of Web services and code infrastructure, and implemented many of the integration aspects discussed here.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.

@ThingsExpo Stories
SYS-CON Events announced today that SoftLayer, an IBM Company, has been named “Gold Sponsor” of SYS-CON's 18th Cloud Expo, which will take place on June 7-9, 2016, at the Javits Center in New York, New York. SoftLayer, an IBM Company, provides cloud infrastructure as a service from a growing number of data centers and network points of presence around the world. SoftLayer’s customers range from Web startups to global enterprises.
SYS-CON Events announced today that Auditwerx will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Auditwerx specializes in SOC 1, SOC 2, and SOC 3 attestation services throughout the U.S. and Canada. As a division of Carr, Riggs & Ingram (CRI), one of the top 20 largest CPA firms nationally, you can expect the resources, skills, and experience of a much larger firm combined with the accessibility and attent...
SYS-CON Events announced today that CA Technologies has been named “Platinum Sponsor” of SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY, and the 21st International Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. CA Technologies helps customers succeed in a future where every business – from apparel to energy – is being rewritten by software. From ...
SYS-CON Events announced today that Technologic Systems Inc., an embedded systems solutions company, will exhibit at SYS-CON's @ThingsExpo, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Technologic Systems is an embedded systems company with headquarters in Fountain Hills, Arizona. They have been in business for 32 years, helping more than 8,000 OEM customers and building over a hundred COTS products that have never been discontinued. Technologic Systems’ pr...
SYS-CON Events announced today that HTBase will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. HTBase (Gartner 2016 Cool Vendor) delivers a Composable IT infrastructure solution architected for agility and increased efficiency. It turns compute, storage, and fabric into fluid pools of resources that are easily composed and re-composed to meet each application’s needs. With HTBase, companies can quickly prov...
SYS-CON Events announced today that Loom Systems will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Founded in 2015, Loom Systems delivers an advanced AI solution to predict and prevent problems in the digital business. Loom stands alone in the industry as an AI analysis platform requiring no prior math knowledge from operators, leveraging the existing staff to succeed in the digital era. With offices in S...
Buzzword alert: Microservices and IoT at a DevOps conference? What could possibly go wrong? In this Power Panel at DevOps Summit, moderated by Jason Bloomberg, the leading expert on architecting agility for the enterprise and president of Intellyx, panelists peeled away the buzz and discuss the important architectural principles behind implementing IoT solutions for the enterprise. As remote IoT devices and sensors become increasingly intelligent, they become part of our distributed cloud enviro...
SYS-CON Events announced today that T-Mobile will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. As America's Un-carrier, T-Mobile US, Inc., is redefining the way consumers and businesses buy wireless services through leading product and service innovation. The Company's advanced nationwide 4G LTE network delivers outstanding wireless experiences to 67.4 million customers who are unwilling to compromise on ...
SYS-CON Events announced today that Infranics will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Since 2000, Infranics has developed SysMaster Suite, which is required for the stable and efficient management of ICT infrastructure. The ICT management solution developed and provided by Infranics continues to add intelligence to the ICT infrastructure through the IMC (Infra Management Cycle) based on mathemat...
SYS-CON Events announced today that Interoute, owner-operator of one of Europe's largest networks and a global cloud services platform, has been named “Bronze Sponsor” of SYS-CON's 20th Cloud Expo, which will take place on June 6-8, 2017 at the Javits Center in New York, New York. Interoute is the owner-operator of one of Europe's largest networks and a global cloud services platform which encompasses 12 data centers, 14 virtual data centers and 31 colocation centers, with connections to 195 add...
SYS-CON Events announced today that Cloudistics, an on-premises cloud computing company, has been named “Bronze Sponsor” of SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Cloudistics delivers a complete public cloud experience with composable on-premises infrastructures to medium and large enterprises. Its software-defined technology natively converges network, storage, compute, virtualization, and management into a ...
In his session at @ThingsExpo, Eric Lachapelle, CEO of the Professional Evaluation and Certification Board (PECB), will provide an overview of various initiatives to certifiy the security of connected devices and future trends in ensuring public trust of IoT. Eric Lachapelle is the Chief Executive Officer of the Professional Evaluation and Certification Board (PECB), an international certification body. His role is to help companies and individuals to achieve professional, accredited and worldw...
In his General Session at 16th Cloud Expo, David Shacochis, host of The Hybrid IT Files podcast and Vice President at CenturyLink, investigated three key trends of the “gigabit economy" though the story of a Fortune 500 communications company in transformation. Narrating how multi-modal hybrid IT, service automation, and agile delivery all intersect, he will cover the role of storytelling and empathy in achieving strategic alignment between the enterprise and its information technology.
Microservices are a very exciting architectural approach that many organizations are looking to as a way to accelerate innovation. Microservices promise to allow teams to move away from monolithic "ball of mud" systems, but the reality is that, in the vast majority of organizations, different projects and technologies will continue to be developed at different speeds. How to handle the dependencies between these disparate systems with different iteration cycles? Consider the "canoncial problem" ...
The Internet of Things is clearly many things: data collection and analytics, wearables, Smart Grids and Smart Cities, the Industrial Internet, and more. Cool platforms like Arduino, Raspberry Pi, Intel's Galileo and Edison, and a diverse world of sensors are making the IoT a great toy box for developers in all these areas. In this Power Panel at @ThingsExpo, moderated by Conference Chair Roger Strukhoff, panelists discussed what things are the most important, which will have the most profound e...
Keeping pace with advancements in software delivery processes and tooling is taxing even for the most proficient organizations. Point tools, platforms, open source and the increasing adoption of private and public cloud services requires strong engineering rigor - all in the face of developer demands to use the tools of choice. As Agile has settled in as a mainstream practice, now DevOps has emerged as the next wave to improve software delivery speed and output. To make DevOps work, organization...
My team embarked on building a data lake for our sales and marketing data to better understand customer journeys. This required building a hybrid data pipeline to connect our cloud CRM with the new Hadoop Data Lake. One challenge is that IT was not in a position to provide support until we proved value and marketing did not have the experience, so we embarked on the journey ourselves within the product marketing team for our line of business within Progress. In his session at @BigDataExpo, Sum...
Web Real-Time Communication APIs have quickly revolutionized what browsers are capable of. In addition to video and audio streams, we can now bi-directionally send arbitrary data over WebRTC's PeerConnection Data Channels. With the advent of Progressive Web Apps and new hardware APIs such as WebBluetooh and WebUSB, we can finally enable users to stitch together the Internet of Things directly from their browsers while communicating privately and securely in a decentralized way.
DevOps is often described as a combination of technology and culture. Without both, DevOps isn't complete. However, applying the culture to outdated technology is a recipe for disaster; as response times grow and connections between teams are delayed by technology, the culture will die. A Nutanix Enterprise Cloud has many benefits that provide the needed base for a true DevOps paradigm.
What sort of WebRTC based applications can we expect to see over the next year and beyond? One way to predict development trends is to see what sorts of applications startups are building. In his session at @ThingsExpo, Arin Sime, founder of WebRTC.ventures, will discuss the current and likely future trends in WebRTC application development based on real requests for custom applications from real customers, as well as other public sources of information,