$30 off During Our Annual Pro Sale. View details »

Platform Independent Architecture V2

HIFILEO
March 14, 2017

Platform Independent Architecture V2

Version 2 of a platform independent architecture talk I gave. The ending now has videos.

HIFILEO

March 14, 2017
Tweet

More Decks by HIFILEO

Other Decks in Education

Transcript

  1. Mobile Platform Independent Architecture Daniel J Leonardis

  2. None
  3. None
  4. Goal • It all starts with Business Requirements • Let’s

    get clean with ‘Clean Code’ • MVP / VIPER Base Patterns • NHL Example
  5. WHAT AM I BUILDING….?

  6. Requirements & Engineering • Business Requirements are Use Cases •

    Use Cases are Business Logic • An app’s business logic should be well defined and testable.
  7. Ready, Set, Code?

  8. Let’s Architect!

  9. MVC

  10. Test?

  11. Clean Code

  12. None
  13. MVP Android

  14. VIPER iOS

  15. None
  16. Same Thing! =

  17. None
  18. MVP Detailed

  19. Viper Details

  20. Example

  21. None
  22. Ready, Set, Code?

  23. Let’s Think

  24. State Pattern

  25. Document Software Requirements

  26. State Diagram

  27. None
  28. None
  29. Testing State Machine

  30. State Pattern

  31. public class NHLSetupContext { private User user; private NHLSetupState nhlSetupState;

    private Set<SetupContextCallback> callbacks... public NHLSetupContext(User user) { this.user = user; setState(new NHLSetupStateSplash()); } void setState(final NHLSetupState state) { this.nhlSetupState = state; /*Callbacks Handled here...*/ } public void processMessage(final NHLSetupMessage message{ nhlSetupState.processMessage(this, message); } /*Additional Code...*/ }
  32. /* Base class for the setup state pattern*/ public abstract

    class NHLSetupState { public abstract void processMessage( final NHLSetupContext nhlSetupContext, final NHLSetupMessage nhlSetupMessage); } /* Represents the Splash screen state.*/ public class NHLSetupStateSplash extends NHLSetupState { @Override public void processMessage(NHLSetupContext nhlSetupContext, NHLSetupMessage nhlSetupMessage) { /* Do work… Determine Next State*/ /* Set Next State*/ nhlSetupContext.setState(new NHLSetupStateABC()); } }
  33. public class NHLSetupStateControllerSplashTest implements SetupContextCallback { private SetupState currentState; @Before

    public void setUp() throws Exception { /*Register Callback for State Machine*/ } @Test public void testSplashToABC() { //Setup State To Test .. //Perform Test nhlSetupContext.processMessage(/*Some Value*/); assertEquals(SetupState.ABC, currentState); } @Override public void transitionToState(SetupState setupState) { currentState = setupState; }
  34. @protocol NHLSetupContextDelegate <NSObject> - (void)willTransitionFromState:(NHLSetupState *)fromState toState:(NHLSetupState *)toState; @implementation NHLSetupContext

    - (void)setCurrentState:(NHLSetupState *)currentState { _currentState = currentState; /*Callbacks Handled Here*/ } /*Additional Code...*/ @end
  35. /* Base class for the setup state pattern*/ @implementation NHLSetupState

    // Stubs - (void)process {} /* Represents the Splash screen state.*/ @interface NHLSetupStateSplash : NHLSetupState @implementation NHLSetupStateSplash - (void)process { /* Do work… Determine Next State*/ /* Set Next State*/ self.context.currentState = [[NHLSetupStateABC alloc] initWithContext:self.context]; }
  36. NHL

  37. Arena

  38. Wrap Up • It all starts with Business Requirements •

    Let’s get clean with ‘Clean Code’ • MVP / Viper Base Patterns • NHL & Arena Examples
  39. Polar Thinking

  40. Questions