Bonnes Pratiques Web & Cloud
59.3K views | +0 today
Follow
Bonnes Pratiques Web & Cloud
Administration cloud et développement web
Curated by Mickael Ruau
Your new post is loading...
Your new post is loading...

Popular Tags

Current selected tag: 'design pattern'. Clear
Scooped by Mickael Ruau
December 21, 2021 7:28 AM
Scoop.it!

Learning JavaScript Design Patterns

Learning JavaScript Design Patterns | Bonnes Pratiques Web & Cloud | Scoop.it
The classic JavaScript design patterns book, updated to ES2015+ syntax.
No comment yet.
Scooped by Mickael Ruau
September 15, 2021 7:44 AM
Scoop.it!

Design Patterns for Microservices - Examples Java Code Geeks - 2021

Design Patterns for Microservices - Examples Java Code Geeks - 2021 | Bonnes Pratiques Web & Cloud | Scoop.it
Welcome readers, in this tutorial, we will learn the basics of different design patterns under the Microservices architecture. You can also check a
No comment yet.
Scooped by Mickael Ruau
February 12, 2021 2:39 AM
Scoop.it!

Inversion de contrôle — Wikipédia

Inversion de contrôle

L' inversion de contrôle ( inversion of control , IoC) est un patron d' architecture commun à tous les frameworks (ou cadre de développement et d'exécution). Il fonctionne selon le principe que le flot d'exécution d'un logiciel n'est plus sous le contrôle direct de l'application elle-même mais du framework ou de la couche logicielle sous-jacente.

Mickael Ruau's insight:

L’inversion de contrôle est un terme générique. Selon le problème, il existe différentes formes, ou représentation d'IoC, le plus connu étant l'injection de dépendances (dependency injection) qui est un patron de conception permettant, en programmation orientée objet, de découpler les dépendances entre objets.

No comment yet.
Scooped by Mickael Ruau
October 18, 2020 6:10 AM
Scoop.it!

AddyOsmani.com - Faster Web App Delivery with PRPL

AddyOsmani.com - Faster Web App Delivery with PRPL | Bonnes Pratiques Web & Cloud | Scoop.it

Addy Osmani (Adnan Osmani) is an engineering manager at Google working on Chrome. His teams work on tools like Lighthouse and PageSpeed Insights. He is author of open-source projects like Yeoman, TodoMVC and Material Design Lite. He has also written books like Learning JavaScript Design Patterns with O'Reilly.

Mickael Ruau's insight:

PRPL is a pattern for structuring and serving web applications and Progressive Web Apps (PWAs) with an emphasis on improved app delivery and launch performance. The letters describe a set of ordered steps for fast, reliable, efficient loading:

  • Push all resources required for the initial route – and only those resources – to ensure that they are available as early as possible
  • Render the initial route and make it interactive before loading any additional resources
  • Pre-cache resources for additional routes that the user is likely to visit, maximizing responsiveness to subsequent requests and resilience under poor network conditions
  • Lazy-load routes on demand as the user requests them; resources for key routes should load instantly from the cache, whereas less commonly used resources can be fetched from the network upon request
Note: The PRPL pattern was first introduced by the Polymer team in 2016, but has demonstrated itself applicable to many other stacks.
No comment yet.
Scooped by Mickael Ruau
June 11, 2020 4:41 AM
Scoop.it!

The MVVM Design Pattern - DZone - Refcardz

The MVVM Design Pattern - DZone - Refcardz | Bonnes Pratiques Web & Cloud | Scoop.it
Learn how to use Silverlight to create gorgeous mobiles apps for the Windows Phone. Included in this Refcard is everything from an explanation of the MVVM Design Pattern to some examples of MVVM Project Templates.
No comment yet.
Scooped by Mickael Ruau
October 9, 2018 8:09 AM
Scoop.it!

Polyfill — Wikipédia

Polyfill - Wikipédia

En programmation web, un polyfill aussi nommé shim ,, ou encore prothèse d'émulation désigne un palliatif logiciel implémentant une rétrocompatibilité d'une fonctionnalité ajoutée à une interface de programmation dans des versions antérieurs de cette interface.

Mickael Ruau's insight:

Voir aussi

No comment yet.
Scooped by Mickael Ruau
February 9, 2018 2:36 AM
Scoop.it!

The PRPL Pattern  |  Web Fundamentals  |  Google Developers

The PRPL Pattern  |  Web Fundamentals        |  Google Developers | Bonnes Pratiques Web & Cloud | Scoop.it

PRPL is a pattern for structuring and serving Progressive Web Apps (PWAs), with an emphasis on the performance of app delivery and launch. It stands for:

  • Push critical resources for the initial URL route.
  • Render initial route.
  • Pre-cache remaining routes.
  • Lazy-load and create remaining routes on demand.

 

Mickael Ruau's insight:

Beyond targeting the fundamental goals and standards of PWAs, PRPL strives to optimize for:

  • Minimum time-to-interactive
    • Especially on first use (regardless of entry point)
    • Especially on real-world mobile devices
  • Maximum caching efficiency, especially over time as updates are released
  • Simplicity of development and deployment

PRPL is inspired by a suite of modern web platform features, but it’s possible to apply the pattern without hitting every letter in the acronym or using every feature.

In fact, PRPL is more about a mindset and a long-term vision for improving the performance of the mobile web than it is about specific technologies or techniques.

No comment yet.
Scooped by Mickael Ruau
November 4, 2017 6:50 AM
Scoop.it!

How to use the mediator design pattern in C#

How to use the mediator design pattern in C# | Bonnes Pratiques Web & Cloud | Scoop.it
Take advantage of the mediator design pattern to promote loose coupling and simplify the coding of object interactions
No comment yet.
Scooped by Mickael Ruau
August 30, 2017 2:27 AM
Scoop.it!

The Observer Pattern in JavaScript explained

The Observer Pattern in JavaScript explained | Bonnes Pratiques Web & Cloud | Scoop.it
This popular pattern used by tons of JavaScript applications may save you from injecting costly dependencies in your project. Easy, clean and very useful.
No comment yet.
Scooped by Mickael Ruau
July 25, 2017 6:27 AM
Scoop.it!

The MVC Design Pattern in Vanilla JavaScript — SitePoint

The MVC Design Pattern in Vanilla JavaScript — SitePoint | Bonnes Pratiques Web & Cloud | Scoop.it
Tired of learning yet another framework? Camilo Reyes teaches you how to implement the MVC design pattern (model-view-controller) in vanilla JavaScript.
No comment yet.
Scooped by Mickael Ruau
July 13, 2017 9:18 AM
Scoop.it!

An Introduction to Node.js Design Patterns | PACKT Books

In this article, we will see how some of the most important GoF design patterns apply to Node.js and its philosophy, thus rediscovering their importance from another perspective.

The design patterns explored in this article are as follows:

  • Factory
  • Proxy
  • Decorator
  • Adapter
  • Strategy
  • State
  • Template
  • Middleware
  • Command
No comment yet.
Scooped by Mickael Ruau
March 16, 2017 4:44 AM
Scoop.it!

Hypermedia API Architectural Patterns

Hypermedia API Architectural Patterns | Bonnes Pratiques Web & Cloud | Scoop.it
Gareth Evans and Rick Mugridge share the patterns that emerged while developing hypermedia APIs for various companies over time.
No comment yet.
Scooped by Mickael Ruau
December 2, 2016 10:55 AM
Scoop.it!

Module pattern en JavaScript • Tutoriels • Zeste de Savoir

Module pattern en JavaScript<br/><br/>                <br/>    • Tutoriels<br/>                •<br/>            <br/>            Zeste de Savoir | Bonnes Pratiques Web & Cloud | Scoop.it
Dans ce cours vous allez découvrir la mise en oeuvre le pattern 'module' en JavaScript qui est une bonne pratique pour structurer son code.
No comment yet.
Scooped by Mickael Ruau
September 16, 2021 7:28 AM
Scoop.it!

Application / Domain / Infrastructure : des mots de la Layered Hexagonal Clean Architecture ? | OCTO Talks !

Application / Domain / Infrastructure : des mots de la Layered Hexagonal Clean Architecture ? | OCTO Talks ! | Bonnes Pratiques Web & Cloud | Scoop.it
 

Depuis quelques années, quand je découvre un projet je vois régulièrement des répertoires qui s’appellent :

  • Application
  • Domain
  • Infrastructure

Je me suis interrogé sur le sens de ces mots. Est-ce qu’ils sont liés à un pattern en particulier ? J’ai eu des réponses diverses en fonction des projets :

  • « C’est une architecture en couches »
  • « C’est une architecture hexagonale »
  • « C’est une Clean Architecture »
  • « On fait du Domain-Driven Design (DDD) »

Quelle est la bonne réponse ? D’où viennent ces mots ? Quel intérêt à les utiliser ou ne pas les utiliser aujourd’hui ? Je me suis documenté sur le sujet et je vous propose un voyage dans le temps pour y voir un peu plus clair.

Mickael Ruau's insight:

 

Annexe : Exemples de code

DDD Sample

Ce repository qui illustrait le Domain-Driven Design, initié vers 2008 par une équipe comprenant Eric Evans, utilise ces mots application / domain / infrastructure :

Dans src/main/java/se/citerus/dddsample, on trouve les répertoires :

. ├── application/ ├── config/ ├── domain/ ├── infrastructure/ └── interfaces/

Le répertoire application contient l’interface de programmation du code métier, une fine couche qui orchestre le code métier :

src/main/java/se/citerus/dddsample/application/ ├── ApplicationEvents.java ├── BookingService.java ├── CargoInspectionService.java ├── HandlingEventService.java └── impl/    ├── BookingServiceImpl.java    ├── CargoInspectionServiceImpl.java    └── HandlingEventServiceImpl.java

Dans domain, on trouve les objets et les règles métier, par exemple pour les marchandises (cargo) :

src/main/java/se/citerus/dddsample/domain/model/cargo ├── Cargo.java ├── CargoRepository.java ├── Delivery.java ├── HandlingActivity.java ├── Itinerary.java ├── Leg.java ├── RouteSpecification.java ├── RoutingStatus.java ├── TrackingId.java └── TransportStatus.java

Et le répertoire infrastructure contient le code de persistance et de messaging :

src/main/java/se/citerus/dddsample/infrastructure/ ├── messaging/ │   └── jms/ ├── persistence/ │   └── hibernate/ └── routing/ └── ExternalRoutingService.java

Modular Monolith with DDD

Cet autre exemple de Kamil Grzybek utilise des répertoires Application / Domain / Infrastructure dans ses modules, qui correspondent chacun à des bounded contexts :

Vous pouvez inspecter chaque module :

No comment yet.
Scooped by Mickael Ruau
May 18, 2021 5:27 AM
Scoop.it!

Les helpers sont-ils anti-pattern?

Les helpers sont-ils anti-pattern? | Bonnes Pratiques Web & Cloud | Scoop.it
A l'époque pré-PHP 5.3 (1), les helpers avaient un sens, surtout s'ils avaient chacun un but précis (par exemple le helper URL), du moins au départ, mais à la fin on se retrouvait le plus souvent avec des classes qui contenaient du code spaghetti.

Certains diront que ceci est dû à un manque de PHP, qui comme Java ne permet pas l'héritage multiple (2), mais je pense qu'il s'agit toujours d'une confusion : du code réutilisable ne devrait pas se trouver dans des classes abstraites devant être héritées de partout (dédicace au framework Magento 1).

(1) PHP 5.3 a introduit la notion de namespace, identique au package Java, ouvrant la voie à la gestion séparée des modules sans collision de nom, à l'injection de dépendance et à Composer, le gestionnaire de dépendances de PHP.

(2) PHP Utilise les traits comme une alternative à ce manque, mais leur utilisation est rare car dangereuse. Quant à Java, il permet depuis sa version 8 de mettre du code dans des interfaces.
No comment yet.
Scooped by Mickael Ruau
February 3, 2021 7:08 AM
Scoop.it!

Design patterns : l'indispensable à savoir

Design patterns : l'indispensable à savoir | Bonnes Pratiques Web & Cloud | Scoop.it
Les design patterns sont inévitables pour tous les développeurs. Si tu ne les connais pas, sache que tu les utilises déjà sans le savoir.
No comment yet.
Scooped by Mickael Ruau
August 28, 2020 8:10 AM
Scoop.it!

Application Android avec MVI et Kotlin Coroutines

Application Android avec MVI et Kotlin Coroutines | Bonnes Pratiques Web & Cloud | Scoop.it
Avec LiveData et ViewModel, les développeurs Android ont à disposition des outils très puissants pour les aider à concevoir des applications plus fluides
Mickael Ruau's insight:

MVI a été conçu autour du paradigme de la programmation réactive et utilise des flux d'observables pour échanger des messages entre différentes entités. Par conséquent, chacune d'entre elles sera indépendante et donc plus flexible et résiliente. De plus, les informations vont toujours circuler dans un sens unique : ce concept est connu sous Unidirectional Data Flow ou UDF. Une fois l'architecture établie, le développeur aura plus de facilité à raisonner et à déboguer si besoin. Il faudra cependant rigoureusement respecter ce concept tout au long du développement.

Dans d'autres design patterns, un Presenter ou un ViewModel possèdent souvent plusieurs entrées et plusieurs sorties. Si ces sorties sont indépendantes, alors il y a un risque de désynchronisation et d'incohérence, ce qui est notamment vrai en multithreading. Selon les cas et l'importance de la cohérence des données affichées, cela peut avoir des conséquences parfois majeures.

Avec MVI, non seulement il y a une source unique pour l'état de la vue (single source of truth), mais en plus, les états produits seront toujours immuables. Grâce à un flux d'observables (LiveData), l'UI reflètera à chaque instant l'état du ViewModel. Les états sont prédictibles et facilement testables.

Autre avantage non négligeable, MVI va également pousser le développeur à se recentrer sur l'utilisateur, car tout commence avec un UserIntent. Le développeur va d'abord se mettre dans la position d'un utilisateur et va commencer à raisonner à haut niveau avant de se tourner vers des questions plus techniques telles que les détails d'implémentation. Cela ne peut être que bénéfique pour l'expérience utilisateur et peut même aider le développeur à mieux penser son code et mieux appréhender le caractère asynchrone inhérent à un grand nombre de tâches.

No comment yet.
Scooped by Mickael Ruau
December 17, 2018 8:35 AM
Scoop.it!

Patrons de conception/Post-Redirect-Get — Wikilivres

Patrons de conception/Post-Redirect-Get — Wikilivres | Bonnes Pratiques Web & Cloud | Scoop.it

Le patron de conception Post-Redirect-Get est une solution spécifique au protocole HTTP pour le développement de serveur web.

Quand un utilisateur soumet un formulaire web (exemples : une commande, une souscription, une nouvelle version de page wiki) dont l'envoi est de type POST, le navigateur l'envoie avec la méthode POST, et reçoit une confirmation du serveur après traitement de la requête et du formulaire.

No comment yet.
Scooped by Mickael Ruau
February 17, 2018 3:34 AM
Scoop.it!

MVC, MVVM and Angular

MVC, MVVM and Angular | Bonnes Pratiques Web & Cloud | Scoop.it

AngularJS is one of the most popular front-end JavaScript frameworks. It is used to create dynamic, interactive and responsive web applications. It is a full-featured Single Page Application (SPA) framework.

Angular supports the principles behind the Model-View-Controller (MVC) design pattern. In this post, let us examine the concepts behind MVC and MVVM; also try to map Angular constructs to the MVVM pattern.

Mickael Ruau's insight:

View Model

The view model acts as an intermediary between the view and the model, and is responsible for handling the view logic. Typically, the view model interacts with the model by invoking methods in the model classes. The view model then provides data from the model in a form that the view can easily use. The view model retrieves data from the model and then makes the data available to the view, and may reformat the data in some way that makes it simpler for the view to handle. The view model also provides implementations of commands that a user of the application initiates in the view. For example, when a user clicks a button in the UI, that action can trigger a command in the view model.

Implementing MVVM in Angular

Angular supports the principles behind MVVM design pattern in the following approach.

  • Model — The model is implemented as an Angular service (Factory or Service).
  • View — The View is implemented using Angular ‘template’ (HTML with data bindings) that is rendered into the Angular view directive (ng-view / ui-view). The View is bound to the ViewModel so that when a property is changed in the ViewModel, it is instantly reflected in the View. Data bindings can work both ways in special cases like HTML forms, where a user can manipulate a property directly.
  • ViewModel — The ViewModel is implemented as an Angular controller. The ‘ngController’ directive is used to specify a controller for a view. It can expose properties and methods to the view. It can also be attached to the DOM by declaring it in a route definition via the ‘$route’ service.

The above implementation suggestions are applicable to Angular 1.x framework.

No comment yet.
Scooped by Mickael Ruau
February 9, 2018 2:29 AM
Scoop.it!

Un modèle d’architecture AngularJS

Un modèle d’architecture AngularJS | Bonnes Pratiques Web & Cloud | Scoop.it
Comment mettre en place une architecture basée sur le MVVM (Model View ViewModel) à l’instar du MVC (Model View Controler) qui est plus souvent utilisé ?
Mickael Ruau's insight:

« Le Modèle-Vue-VueModèle (en abrégé MVVM, de l’anglais Model View ViewModel) est une architecture et une méthode de conception utilisée dans le génie logiciel. MVVM est originaire de Microsoft et adapté pour le développement des applications basées sur les technologies Windows Presentation Foundation et Silverlight via l’outil MVVM Light par exemple. Cette méthode permet, tel le modèle MVC (Modèle-Vue-Contrôleur), de séparer la vue de la logique et de l’accès aux données en accentuant les principes de binding et d’événement. » (source)

Pour vulgariser, la différence entre MVVM et MVC tient du fait que le MVVM, lui, se repose sur le DataBading et l’évènementiel.  Ça tombe bien, c’est ce qu’AngularJS est !

 

La vue est couplée aux données via du DataBinding et invoque les méthodes du ViewModel.

Le ViewModel invoque les méthodes du modèle. Il contient la data spécifique à la gestion de l’écran et les méthodes de réponses aux interactions utilisateurs. Il contient également une référence vers un ou des modèles.

Le modèle contient la data et les méthodes de manipulation de cette dernière (calculs, appels de services, …).

No comment yet.
Scooped by Mickael Ruau
November 4, 2017 6:49 AM
Scoop.it!

How to use the object pool design pattern in C#

How to use the object pool design pattern in C# | Bonnes Pratiques Web & Cloud | Scoop.it
Boost application performance by using the object pool design pattern to recycle objects that are expensive to create
No comment yet.
Scooped by Mickael Ruau
July 29, 2017 9:34 AM
Scoop.it!

La POO en PHP : Middleware

Plus d'infos : https://www.grafikart.fr/formations/programmation-objet-php/middleware-psr15

Mickael Ruau's insight:

Même si vous n'avez jamais entendu le terme "middleware" le concept de ce design pattern ne devrait pas vous sembler étrangé. Un middleware désigne un élément qui va venir se placer entre la requête reçue par le serveur et la réponse renvoyée. En ce sens, votre application PHP est, par nature, un middleware, elle prend en entrée une requête (représentée par des variables globales `$_POST`, `$_SERVER`...) et l'interprète pour renvoyer une réponse HTTP (grâce aux fonctions `echo` et `header()`).

No comment yet.
Scooped by Mickael Ruau
July 21, 2017 9:21 AM
Scoop.it!

Reactive Programming and the Flux Architecture | PACKT Books

 

Reactive programming has its roots in the observer pattern, as discussed in Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides's classic book Design Patterns: Elements of Reusable Object-Oriented Software (the authors of this book are commonly called GoF or Gang of Four). In the observer pattern, there is an observable subject. It has a list of listeners, and notifies all of them when it has something to publish. This is somewhat simpler than the publisher/subscriber (PubSub) pattern, not having potentially intricate filtering of which messages reach which subscriber which is a normal feature to include.

Reactive programming has developed a life of its own, a bit like the MVC pattern-turned-buzzword, but it is best taken in connection with the broader context explored in GoF. Reactive programming, including the ReactJS framework (which is explored in this title), is intended to avoid the shared mutable state and be idempotent. This means that, as with RESTful web services, you will get the same result from a function whether you call it once or a hundred times.

No comment yet.
Scooped by Mickael Ruau
July 10, 2017 9:17 AM
Scoop.it!

Design Patterns | PACKT Books

Design patterns solve the problems by providing guidelines that are industry best practices to handle problems or achieve or implement any requirement. Singleton pattern, for example, is used to create only one instance that is shared among all; whereas, prototype is used to extend the existing functionality of an object by adding more properties, methods, and so on. Design patterns are classified into three categories creational, structural, and behavioral patterns. The topics that we will cover in this article are as follows:

  • Observer pattern
  • Pub/sub pattern
  • Promises
No comment yet.
Scooped by Mickael Ruau
December 7, 2016 4:07 AM
Scoop.it!

Speaking JavaScript

Speaking JavaScript | Bonnes Pratiques Web & Cloud | Scoop.it
Mickael Ruau's insight:
The IIFE Pattern: Introducing a New Scope

Sometimes you want to introduce a new variable scope—for example, to prevent a variable from becoming global. In JavaScript, you can’t use a block to do so; you must use a function. But there is a pattern for using a function in a block-like manner. It is called IIFE (immediately invoked function expression, pronounced “iffy”):

(function () { // open IIFE var tmp = ...; // not a global variable}()); // close IIFE

Be sure to type the preceding example exactly as shown (apart from the comments). An IIFE is a function expression that is called immediately after you define it. Inside the function, a new scope exists, preventing tmp from becoming global. Consult Introducing a New Scope via an IIFE for details on IIFEs.

IIFE use case: inadvertent sharing via closures

Closures keep their connections to outer variables, which is sometimes not what you want

No comment yet.