Top Banner
Who are we?
28

Who are we?. What do we do? Fulfillment Optimization.

Jan 02, 2016

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Who are we?. What do we do? Fulfillment Optimization.

Who are we?

Page 2: Who are we?. What do we do? Fulfillment Optimization.

What do we do?

Fulfillment Optimization

Page 3: Who are we?. What do we do? Fulfillment Optimization.

How do you decide?

$$

$

Demand

Supply

Assignment

Page 4: Who are we?. What do we do? Fulfillment Optimization.

Mmmm… doughnuts NOW!

$$

$ 9h

2h

6h

Page 5: Who are we?. What do we do? Fulfillment Optimization.

Make me a promise!

Page 6: Who are we?. What do we do? Fulfillment Optimization.

Thirsty? I’ll split it with ya

$

$$

$$$

6h

2h

2h

9h

Page 7: Who are we?. What do we do? Fulfillment Optimization.

Additional factors considered

Page 8: Who are we?. What do we do? Fulfillment Optimization.

Java vs. C++

Page 9: Who are we?. What do we do? Fulfillment Optimization.

A major difficulty with SOA

Page 10: Who are we?. What do we do? Fulfillment Optimization.

Problems with devo

• Unstable• Old versions• Co-ordinated changes are hard• Slow• Hard to get support

Page 11: Who are we?. What do we do? Fulfillment Optimization.

What does SOA look like?public class MyFulfillmentOptimizationService {    private AmazonTransportCostService transportationCostService;

    public List<Shipment> pickBestShipments(Demand demand, Supply supply) {        //...        double cost = transportationCostService.calculateShipmentCost(shipment)        //...    }}

My Service

Their Service

Page 12: Who are we?. What do we do? Fulfillment Optimization.

Put a layer in-between

My Service

Their Service

Gateway

public class MyFulfillmentOptimizationService {    private TransportationCostGateway transportationCostGateway;

    public List<Shipment> pickBestShipments(Demand demand, Supply supply) {        //...        double cost = transportationCostGateway.calculateShipmentCost(shipment)        //...    }}

public class AmazonTransportationCostGateway implements TransportationCostGateway {    private AmazonTransportCostService transportationCostService;

    public double calculateShipmentCost(Shipment shipment) {        return transportationCostService.calculateShipmentCost(shipment);    }}

public interface TransportationCostGateway {    double calculateShipmentCost(Shipment shipment);}

Page 13: Who are we?. What do we do? Fulfillment Optimization.

Spy on them!

MyService

TheirService

Gateway

Recorder

public class RecordingTransportationCostGateway implements TransportationCostGateway {    private AmazonTransportCostService transportationCostService;    private DataStorage storage;

    public double calculateShipmentCost(Shipment shipment) {        double returnValue = transportationCostService.calculateShipmentCost(shipment);        storage.store(shipment, returnValue);        return returnValue;    }}

Storage

Page 14: Who are we?. What do we do? Fulfillment Optimization.

Eliminate them

MyService

TheirService

Gateway

Recorder

public class ReplayTransportationCostGateway implements TransportationCostGateway {    DataStorage storage;

    public double calculateShipmentCost(Shipment shipment) {        return storage.get(shipment);    }}

Replay

Storage

Page 15: Who are we?. What do we do? Fulfillment Optimization.

Some extra tips

• Try hard to use your types in the gateway. Not theirs.

• Don’t think about just Services; think of any external dependencies you have. (like a Database).

• Don’t get abstract!Until you have to

Page 16: Who are we?. What do we do? Fulfillment Optimization.

TDD

?

Page 17: Who are we?. What do we do? Fulfillment Optimization.

How I remember things before TDD…

Page 18: Who are we?. What do we do? Fulfillment Optimization.

Prod

Devo

System-Wide

Unit

Day

Hours

Minutes

Msec-Second95%

4%

1%

0%

Page 19: Who are we?. What do we do? Fulfillment Optimization.

How can I get more unit tests?

Page 20: Who are we?. What do we do? Fulfillment Optimization.

Write Failing Test

Code to Pass TestRefactor

Page 21: Who are we?. What do we do? Fulfillment Optimization.

Common TDD Misconceptions

• TDD is just writing tests• Writing the test first• Write TONS of tests before writing any code• Difficult tests represent difficult problems• Bad tests are worse than no tests

Page 22: Who are we?. What do we do? Fulfillment Optimization.

Okay, but why is TDD good?

• # of Bugs– Failing tests

• Documentation / Readability– Self-documenting

• Modularity / Extensibility– Dependency Injection, Safety Net

• Efficiency (ex. runtime)– Okay maybe TDD doesn’t do this (can it?)

Page 23: Who are we?. What do we do? Fulfillment Optimization.

Additional Benefits of TDD

• Feedback on “quality” of code• Focus• Debug units, not systems• Safety Net• Speed (controversial)• Shared Code Ownership

Page 24: Who are we?. What do we do? Fulfillment Optimization.

TDD pitfalls

• I have a legacy system. I can’t write unit tests• Writing tests is hard to do• I don’t understand what tests to write• This is taking too long

Page 25: Who are we?. What do we do? Fulfillment Optimization.

If testing is hard…

Revisit the design

Page 26: Who are we?. What do we do? Fulfillment Optimization.
Page 27: Who are we?. What do we do? Fulfillment Optimization.
Page 28: Who are we?. What do we do? Fulfillment Optimization.

?