Slide 1

Slide 1 text

AngularJS in Patterns Minko Gechev github.com/mgechev twitter.com/mgechev

Slide 2

Slide 2 text

Second lightning talk in English…

Slide 3

Slide 3 text

Minko Gechev [ "Freelance software developer", “Assistant Professor at Sofia University", { "Open Source Advocate": [ "AngularJS Style Guide", "AngularAOP", "plainvm", "angular-webrtc", "a bunch of deprecated software" ], "Currently": [ "Based in San Mateo, California", "Works with LearnCapital" ] }, "SofiaJS & BeerJS, Bulgaria" ] github.com/mgechev twitter.com/mgechev

Slide 4

Slide 4 text

Content • What is “AngularJS in Patterns?” • Why talking about this? • Why that approach? • A few patterns

Slide 5

Slide 5 text

What is “AngularJS in Patterns?”

Slide 6

Slide 6 text

“An academic paper, which introduces AngularJS in terms of already known concepts such as design and architectural patterns”

Slide 7

Slide 7 text

Or basically…

Slide 8

Slide 8 text

A lot of text with only a few pictures and code snippets…

Slide 9

Slide 9 text

…which lives @ GitHub

Slide 10

Slide 10 text

Why talking about this?

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

Why that approach?

Slide 13

Slide 13 text

New frameworks almost every day!

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

Impossible to stay up to date by learning everything from scratch

Slide 17

Slide 17 text

What is a development framework?

Slide 18

Slide 18 text

–docs.angularjs.org “Framework - a particular implementation of a web application, where your code fills in the details. The framework is in charge and it calls into your code when it needs something app specific. E.g., angularjs, knockout, ember, etc.”

Slide 19

Slide 19 text

In other words - generic architecture of a web application

Slide 20

Slide 20 text

Each developer must have… • Software engineering skills, including: • Software development principles (GRASP, SOLID, etc.) • Software design & architectural patterns • Computer Science skills, including: • Complexity analysis • Algorithms and data structures

Slide 21

Slide 21 text

Each developer must have… • Software engineering skills, including: • Software development principles (GRASP, SOLID, etc.) • Software design & architectural patterns • Computer Science skills, including: • Complexity analysis • Algorithms and data structures

Slide 22

Slide 22 text

As software developers we already know most of the frameworks by being aware of the traditional design and architectural patterns

Slide 23

Slide 23 text

When I get frustrated, I open the GoF book and be awesome instead!

Slide 24

Slide 24 text

“AngularJS in Patterns” just fills the gaps

Slide 25

Slide 25 text

A few patterns

Slide 26

Slide 26 text

–Gang of Four “Chain of Responsibility”

Slide 27

Slide 27 text

The chain-of-responsibility pattern is a design pattern consisting of a source of command objects and a series of processing objects. Each processing object contains logic that defines the types of command objects that it can handle; the rest are passed to the next processing object in the chain.

Slide 28

Slide 28 text

$scope ($broadcast, $emit)

Slide 29

Slide 29 text

–Gang of Four “Observer”

Slide 30

Slide 30 text

The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods.

Slide 31

Slide 31 text

$scope ($on, $broadcast/$emit)

Slide 32

Slide 32 text

–Martin Fowler “Active Record”

Slide 33

Slide 33 text

The Active Record object is an object, which carries both data and behavior. Usually most of the data in these objects is persistent, responsibility of the Active Record object is to take care of the communication with the database in order to create, update, retrieve or delete the data. It may delegate this responsibility to lower level objects but calls to instance or static methods of the active record object cause the database communication.

Slide 34

Slide 34 text

$resource

Slide 35

Slide 35 text

References • AngularJS Inheritance Patterns • The magic of $resource (or simply a client-side Active Record) • AngularJS in Patterns • Patterns of Enterprise Application Architecture • Design Patterns: Elements of Reusable Object- Oriented Software

Slide 36

Slide 36 text

Thank you! speakerdeck.com/mgechev github.com/mgechev twitter.com/mgechev