Laravel

A few days back I wrote about Python-based web application framework called Django. Let’s talk about another framework for web app development framework which is built in PHP. It is called as Laravel and has become popular in PHP community for various reasons.

What is Laravel?

Laravel is a PHP based framework which is build using Symphony2 components. Being a framework it provides services and libraries to handle web requests, database etc. This implements MVC architecture (Model-View-Controller) and has 3 different components meant for MVC.

Eloquent provides Object Relational Mapping (ORM) component, which interacts with an underlying database such as MySQL, PostgreSQL or MSSQL.

Blade is a component that provides the view in this framework. It is the templating engine that Laravel uses, supports inheritance and support extensible control structures

Controllers provide a way to group request handling logic and is used in conjunction with Routes to handle the HTTP requests.

Laravel - MVC
Laravel – MVC architecture

Why is Laravel becoming popular?

  • Routing system
  • Intuitive Templating Engine – Blade
  • Open source
  • Built-in support for authentication
  • Uses Inversion of Control (IoC) design pattern to remove dependencies on third-party components, yet maintaining the functionality and flexibility for the developers
  • Built-in support for unit testing.
  • Built-in command line tool – Artisan
  • Security
  • Support database migration to facilitate incremental development.
  • Interface to various Queues such as Amazon SQS, IronMQ, Redis Queues
  • Abstraction layer for filesystem – supports Amazon S3, FTP/SFTP, Local or Dropbox!

Laravel has shown consistent releases at regular intervals. It has great community support and hence has gained a lot of traction and attention from PHP community in last 2-3 years. You can see complete timeline on Wikipedia page

Related Links

Related Keywords

Web app Framework, PHP, MVC, Software Architecture, CodeIgnitor, Symfony, Yii

ESB

Ever wondered how heterogeneous applications communicate with each other? e.g. A Java application that needs to communicate with a .Net application. And not just one-to-one communication. Consider use cases where there are several applications talking to more than one applications. How does it happen? Does each application need to implement an interface for every other application? Enterprise Service Bus i.e. ESB comes to your rescue.

What is Enterprise Service Bus?

ESB implements a communication system between various applications which need to communicate with each other. The primary goal of ESB is to enable faster integration between Enterprise applications commonly referred as EAI.

ESB
Consider a set of applications which need to communicate with each other. This is a heterogeneous set and each one talks separate standard, protocol. And many of them need to talk to more than one applications. ESB removes the need that each application needs to implement communication with more than one other applications. If one tries to implement point-to-point communication between apps, it is going to get messy. Changing one part would result in breaking something else. ESB handles the communication transparently and hence eases up the process of communication.

Key capabilities of ESB

  • Transport protocol conversion – JMS to file
  • Message transformation
  • Routing e.g. content based routing
  • Message enhancement e.g. Order data that only has a client ID can be enhanced to pass Order Data and client details together to next level. In this case, client details are pulled from a different source and the incoming message is “enhanced” with additional client data before passing it to next application.
  • Security / Authorization – incoming messages are checked for required authorization before processing them further.
  • Mediation
  • Monitoring

Key providers of Enterprise Service Bus software

  • Microsoft BizTalk Server
  • MuleSoft
  • Oracle Enterprise Service Bus
  • Tibco Software
  • Apache ServiceMix

Related Links

Related Keywords

Software Architecture, Service Oriented Architecture

 

Circuit Breaker Pattern

As the name suggests, the “circuit breaker” is a design pattern in software architecture, which has gain prominence in the distributed environment.

MCB
Miniature Circuit Breaker

Circuit Breaker Pattern in detail

Almost each one of us knows about the MCB – miniature circuit breaker that is used in our homes. Its function is to break the electric supply of a particular circuit – either of a room or of an entire house – if it detects some anomaly in the electric supply or usage. Once the anomaly is removed, we can restore earlier state and the electricity resumes.

In this design pattern, there’s a component named “Circuit Breaker” which does exactly same. It acts as a proxy for certain function/API calls. If the call fails beyond a certain threshold, this component starts returning an error to the caller, even without checking if the proxied function/API is working.

Unlike MCB, this being a software component, it can be made more intelligent. This Circuit Breaker component can have a threshold and timeout defined. Once the error rate crosses the threshold, the component starts returning an error to the caller for a timeout period. After that, it tries to call the proxied function/API few times. If successful, it can slowly resume the service over a period of time.

Circuit Breaker
Circuit Breaker diagram – Source: https://martinfowler.com/bliki/CircuitBreaker.html

But, wait, wouldn’t it cause a problem for the users?

It could. However, in the distributed architecture, failure is always a possibility. This design pattern teaches to embrace failure rather than denying the possibility of failure. The overall architecture can handle such failures gracefully. e.g. if a service providing recommendations for titles of movies or books, you could easily show something else or not show anything at all. That would still allow your users to use the overall application – albeit w/o some functionality. This would anyway be better than failing entire application.

Also, the component can include the monitoring feature as well. This can push data about the failure rate to a central dashboard, which will allow administrators to check the failed components and take corrective measures.

Example of Circuit Breaker Pattern

Netflix has implemented this pattern very effectively and has also released the library which provides various functionalities they are using internally – Hystrix. There are some very good articles available which are mentioned in the links below.

Related Links

Related Keywords

Microservices Architecture, Hystrix, API Gateway

 

Edge Computing

Edge computing is distributed architecture methodology which brings some very specific advantages due to the distributed nature of the architecture. Using this architecture, businesses can enjoy benefits such as lower latency, reduced network bandwidth usage and near real-time processing of time-critical data.

Edge Computing
Edge Computing!! Ain’t it funny??

But what is Edge Computing after all?

With the rise of IoT (Internet of things) we are having several sensors or devices located at multiple locations. These sensors collect a massive amount of data. The businesses need to analyze and use this data for further processing. If all sensors are to send data to central server continuously, that would mean each one will need uninterrupted internet connectivity. It will end up in consuming huge network bandwidth. Also, sending data over the internet would also involve latency, which at least in certain cases may not be acceptable. All these things are expensive from a business perspective and here Edge Computing comes into the picture.

In this architecture, the collected data is processed near the edge by deploying some compute power – which could be low cost – near to the devices. This is referred as Device Edge. On these local machines, the data received could be received through local networks, not necessarily needing internet. Collected data could be processed near real-time and only actionable data is sent back to the central server immediately. Rest of the data could be archived as per the need on a periodic basis. As you can see, by deploying compute power near the devices, we have addressed all the three issues mentioned above.

There is another variant of Edge Computing. In above example, “Edge” is treated as an edge of the network where devices are located. Whereas in this other variant, “Edge” is treated as an edge of the cloud infrastructure. A close example of this is CDN – the static contents are cached on various edges across the globe and served based on geolocation of the request. However, CDN doesn’t involve any computing power.

There are some concerns about the security of the data at the edge locations, however, with careful planning, those could be handled satisfactorily.

Related Links

Related Keywords

Software Architecture, Cloud, IoT

Django

Django is a web app framework built using Python language. It is free and open-source (BSD license) framework used by many leading and well-known websites.

Django
Django Developer at work

What are the features of Django?

It uses Model-View-Controller architecture. The framework consists of:

  • Object-relational-mapper (ORM) which connects the data model with backend database (Model).
  • Web templating system to process HTTP requests (View)
  • URL dispatcher (Controller)

Being a framework, it also includes several components to ease the creation of complex web apps such as authentication module, web server, form component, cache module, support for XML and JSON representations and many more. As an addon, the distribution also contains tools to generate RSS/Atom feeds, Google Sitemaps, built-in mitigation for several vulnerabilities and also administrative interface.

Django framework implicitly enforces a certain way of developing your application, which might be construed as a limitation. However, this in itself maintains the sanctity of the code that is getting developed and keeps the code readable/maintainable even for your teammates.

Which websites are using Django framework?

The list is impressive. Disqus, Bitbucket, Instagram, Mozilla Firefox. Even Pinterest was built using Django, which later was migrated to Flask, another web app framework.

Alternatives for Django:

  • Flask
  • Falcon
  • Ruby On Rails
  • Laravel
  • Spring MVC
  • ASP .NET MVC

Why would you choose Django?

This framework is written in Python, which is easy to learn and also is one of the most popular languages. Built-in components and supporting modules make the development of the web app very fast. The add-ons provide the modules required for security. However, one of the important features of Django is template inheritance! You can define a base template and extend it for your further use.

Trivia

  • It is pronounced as Jango (D is silent with emphasis on J)
  • It was created in 2003 by two developers working at a newspaper.
  • It was made open source and Django Software Foundation was formed to maintain the software.
  • Framework as has been named after a guitarist  Django Reinhardt.

Related Links

Related Keywords

Web App Frameworks, Python, MVC, Software Architecture, Flask, Falcon