Giter Club home page Giter Club logo

mvp-architecture-for-firmware's Introduction

MVP-Architecture-for-Firmware

This is my public brainstorming repo for an idea of MVP architecture for Firmware. If anyone has ideas they'd like to share, please post an Issue!

I've been struggling over the past couple years trying to find a nice, clean, modular architecture for firmware and so far I haven't found anything I've liked. After playing around with writing a mobile app in Flutter, I discovered the MVP architectural model (Model View Presenter) which is diagrammed in the chart below:

MVP Architectural Model

borrowed from: StackOverflow

I've really enjoyed this pattern for mobile, so I'm going to attempt to map it to firmware in this repo, eventually providing example projects and guides (if it ends up being something I want to use). If this works, I believe it will provide a simple architecture that is highly testable (via unit and integration testing) and very clean.

The Basic MVP for Firmware

MVP For Firmware Stack

Model Our model will handle things like storing data to flash, settings, GPIO configuration, etc... This code should really be constant even if our hardware changes.

Presenter Our presenter will handle any necessary logic between the Model and View. It will accept events from the view, tell the model when and what data to update, the provide any updates to the view that are necessary. This code should remain constant even if hour hardware changes.

View Our view is closely related to the hardware itself, so it may change if our hardware changes. The view will take actions (from outside the device) such as user input/buttons/sensors/etc...

Button Example

This isn't the best example because it kind of looks like data is only flowing from View to Presenter to Model, when in reality, the communication is 2 way between both the View and Presenter and the Model and Presenter. Nonetheless, it's making for a decent starting point.

MVC for Firmware Button Example

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.