Implementation Clean Code och TDD r exempel p verktyg som vi kan - - PowerPoint PPT Presentation

implementation
SMART_READER_LITE
LIVE PREVIEW

Implementation Clean Code och TDD r exempel p verktyg som vi kan - - PowerPoint PPT Presentation

Vad innebr Software Craftmanship? > Vi r proffs som vill leverera kod vi kan vara stolta ver. Varfr? Drfr att vi vet att det lnar sig i lngden. Vi spenderar tex 90% av tiden med att lsa kod, 10% skriva. Implementation


slide-1
SLIDE 1

Implementation

  • Software Craftmanship
  • Clean code
  • TDD
  • Röda tråden
  • Teststrategier
  • Design patterns
  • Magic tricks of testing

Vad innebär Software Craftmanship? —> Vi är proffs som vill leverera kod vi kan vara stolta över. Varför? Därför att vi vet att det lönar sig i längden. Vi spenderar tex 90% av tiden med att läsa kod, 10% skriva. Clean Code och TDD är exempel på verktyg som vi kan använda.

TDD?

http://blog.cleancoder.com/uncle-bob/2016/03/19/GivingUpOnTDD.html

Den Röda Tråden

  • Vi kan välja utvecklingsmodell
  • Vi kan hantera risk och vet varför behövs
  • Vi kan skriva och estimera krav
  • User stories, -ilities, regler
  • Vi kan ta fram arkitekturkrav
  • Vi kan ta fram arkitektur och design
  • Vi kan skriva Clean Code

VISION KRAV TEST KOD SYSTEM KRAV KRAV TEST TEST DEPLOYABLE … TEST … … KOD KOD … KOD KOD … DEPLOYABLE … KOD … KRAV DESIGN IMPLEMENT TEST DRIFTSÄTTN

slide-2
SLIDE 2

Implementation

  • Software Craftmanship
  • Clean code
  • TDD
  • Röda tråden
  • Teststrategier
  • Design patterns
  • Magic tricks of testing

http://lisacrispin.com/2011/11/08/using-the-agile-testing-quadrants/

Testing Test Automation Pyramid

http://www.minecraftforum.net/forums/mapping-and-modding/ maps/1503376-insanely-enormous-multiplayer-puzzle-pyramid- v0-8

Pyramiden Utforskande tester 5% UI-test (Webtest etc.) 10% Integrationstest 20% Komponenttest 50% Enhetstest 100%

slide-3
SLIDE 3

Test Automation Pyramid

http://watirmelon.com/tag/testing-pyramid/ http://www.agilecoachjournal.com/index.php/2014-01-28/testing-2/the-agile- testing-pyramid/attachment/agiletestingpyramid-3/

Testing

  • Acceptance Testing
  • UI Testing
  • Conformance Testing
  • Configuration Testing
  • Performance Testing
  • Load Testing
  • Stress Testing
slide-4
SLIDE 4

Implementation

  • Software Craftmanship
  • Clean code
  • TDD
  • Röda tråden
  • Teststrategier
  • Design patterns
  • Magic tricks of testing

Designprinciper

– Coupling and Cohesion – Reveal Intent - Naming – SRP: Single Responsibility Principle – DRY: Don’t Repeat Yourself

Design pattern

“Each pattern describes a problem that

  • ccurs over and over again in our

environment, and then describes the core

  • f the solution to that problem...”

Christopher Alexander

slide-5
SLIDE 5

Design pattern

A pattern is a solution to a problem within a certain context that has a set of predictable consequences. Ted Neward

https://dzone.com/articles/reclaiming-design-patterns-20-years-later

Problem/Solution/Context/Consequences)

Software Design Pattern

  • “a general reusable solution to a

commonly occurring problem within a given context”

http://en.wikipedia.org/wiki/Software_design_pattern

GoF

– Creational

  • Builder,
  • Factory method, …

– Structural

  • Adapter, Decorator, …

– Behavioral

  • Iterator, Observer, …

“workarounds for missing features in C++”?

slide-6
SLIDE 6

GoF

“Design patterns provide a common vocabulary for designers to use to communicate, document, and explore design alternatives. Design patterns make a system seem less complex by letting you talk about it at a higher level of abstraction than that of a design notation

  • r programming language. Design patterns

raise the level at which you design and discuss design with your colleagues.”

Creational Design pattern example

SRP: Separate usage and creation!

  • Factory
  • Builder

https://github.com/jonananas/teaching

Static Factory Method

Se also: – http://stackoverflow.com/questions/929021/what-are-static-factory- methods-in-java – http://stackoverflow.com/questions/13029261/design-patterns-factory-vs- factory-method-vs-abstract-factory

Static Factory Method is not Factory, Factory method or Abstract Factory When: Creation is a bit complex for constructor.’ Then: Create a static method that returns an instance of a class “Static factory method is simply a static method that returns an instance of a class” Effective Java by Joshua Bloch

Separate usage from creation, example?

slide-7
SLIDE 7

Builder

– http://en.wikipedia.org/wiki/Builder_pattern

When: Creation is a bit complex for constructor, and even static factory method; several input parameters and/or several optionals leading to multiple variations of constructors. Then: Create a fluent interface Builder that takes each parameter one by one and then returns an instance of a class in a single step.

Builder

– http://en.wikipedia.org/wiki/Builder_pattern

Data persistence patterns

SRP: Separate usage and persistence!

  • DAO
  • CRUD for one entity
  • Repository
  • CRUD* for aggregate: entity and it’s abstractions
  • *Not actually CRUD, but methods reflecting

domain

slide-8
SLIDE 8

Pattern Language

“A pattern language is a method of describing good design practices within a field of expertise”

http://en.wikipedia.org/wiki/Pattern_language

Tactical DDDesign patterns

– DDD Pattern language!

https://domainlanguage.com/ddd/patterns/DDD_Reference_2011-01-3

Strategic DDDesign patterns

– DDD Pattern language!

https://domainlanguage.com/ddd/patterns/DDD_Reference_2011-01-3

slide-9
SLIDE 9

Implementation

  • Software Craftmanship
  • Clean code
  • TDD
  • Röda tråden
  • Teststrategier
  • Design patterns
  • Magic tricks of testing

The Magic Tricks of Testing