MVC ARCHITECTURE AND PROCESSES IN ELIXIR

M

The Model-View-Controller (MVC) is an architectural pattern that separates an application into three main logical components: the model, the view, and the controller. Each of these components are built to handle specific development aspects of an application.

Model:

  • Representation of domain data
  • Business Logic
  • Persistence Mechanism

Controller:

  • Intermediary between model and view
  • It maps user actions(Model actions)
  • Select the view and provide information to itself

View

  • User Interface
  • Interaction elements

Importance of MVC

  • Organization
  • Reusing code
  • The views and application behavior should reflect the manipulation of the data immediately
  • It allows different user interface standards or port it to other environments where the application code should not be affected

Control Flow of the MVC

  • The user performs an action on the interface
  • The controller takes the input event
  • The controller notifies the user action to the model which may involve a change of state of the model
  • It generates a new view, the view takes the data model
  • The user interface waits for another user interaction, which starts a new cycle.

Processes

Understanding the difference between Synchronous and Asynchronous

In most high-level programming languages, your program starts from top to bottom. it starts by executing the first line of source code and each line of code executed sequentially thereafter.

In synchronous processes/programs, your program is executed line by line one at a time, each time a function is called, the entire program waits until that function returns before moving on to the next line of code.

While in

Asynchronous processes/programs, the entire process does not pause or wait for the return of a function executed before it. In asynchronous, you are essentially saying “I know this function call is going to take a great deal of time, but my program doesn’t want to wait around while it executes”

Concurrency in elixir and erlang is based upon the actor model. Actors are single threaded processes which can send and receive messages amongst themselves. Their memory is completely isolated, which makes having to worry about “shared state” a non-issue.

Putting it simple, a process in Elixir is the actor. It can communicate with another actor by sending a message to a specific PID (Process ID). The recipient can receive a message by checking a message by checking its mailbox for new messages.

About the author

Ayo Ajanaku

WordPress database error: [Table './muji_wp637/wpxi_comments' is marked as crashed and should be repaired]
SELECT SQL_CALC_FOUND_ROWS wpxi_comments.comment_ID FROM wpxi_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 529 AND comment_parent = 0 ORDER BY wpxi_comments.comment_date_gmt ASC, wpxi_comments.comment_ID ASC

Add Comment

By Ayo Ajanaku

Ayo Ajanaku

Get in touch

Quickly communicate covalent niche markets for maintainable sources. Collaboratively harness resource sucking experiences whereas cost effective meta-services.