Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Time Driven Development

Time Driven Development

Software architecture is more than blindly following design principles or using design patterns. They come with trade-offs that you should keep in mind before deciding on the right architecture for your project. Use them as tools to achieve simpler code that's easier to maintain as opposed to goals that you aim to achieve regardless of the context.

Katerina Trajchevska

July 25, 2019
Tweet

More Decks by Katerina Trajchevska

Other Decks in Programming

Transcript

  1. TIME DRIVEN DEVELOPMENT
    @ktrajchevska

    View Slide

  2. Exclusive Developers’ Network
    Katerina Trajchevska
    ● 1x Engineer & Mozilla Tech Speaker
    ● Co-founder of Adeva, an exclusive
    developers’ network.
    ● Consultant with startups and Fortune
    500
    @ktrajchevska

    View Slide

  3. @ktrajchevska
    What are we going to talk about?
    1. How to design software for easy maintenance,
    extension and modification.
    2. How to know when to stop and make better use of
    your time.

    View Slide

  4. Example #1
    Developing a module for
    managing user profiles

    View Slide

  5. View Slide

  6. App\ZohoCandidate.php

    View Slide

  7. App\Http\Controllers\CandidateController.php
    ! We directly depend on the CRM storage.

    View Slide

  8. profile.blade.php
    ! Using arrays to access the data.

    View Slide

  9. App\Http\Controllers\CandidateController.php

    View Slide

  10. @ktrajchevska
    Red Flags
    Controller knows too much and is open for modification.
    Methods depend directly on the CRM storage and their naming
    conventions.
    View uses arrays that should be replaced with Collections in
    future.

    View Slide

  11. Demo #1
    Changing the
    storage to MySQL

    View Slide

  12. @ktrajchevska
    What does it take to switch the storage?
    1. Add Eloquent models to use with MySQL.
    2. Change controller dependencies from CRM class to Eloquent.
    3. Use Eloquent instead of CRM to pull data for the view.
    4. Switch all variables to the new naming convention.
    5. Change the way we access data in the views.
    6. Adjust the unit tests to work accordingly.

    View Slide

  13. How can we
    save time
    by improving
    the code design?

    View Slide

  14. 1. Don’t depend on concrete
    implementations.

    View Slide

  15. App\Repositories\Interfaces\CandidateRepositoryInterface.php

    View Slide

  16. App\Http\Controllers\CandidateController.php

    View Slide

  17. App\Http\Controllers\CandidateController.php

    View Slide

  18. 2. Be mindful about what your
    program expects.

    View Slide

  19. App\Crm\Candidate.php

    View Slide

  20. profile.blade.php

    View Slide

  21. 3. Bind abstractions with
    concrete implementation.

    View Slide

  22. App\Providers\AppServiceProvider.php

    View Slide

  23. Demo #2
    Changing the
    storage to MySQL

    View Slide

  24. @ktrajchevska
    What does it take to switch the storage?
    1. Add Eloquent models to use with MySQL.
    2. Create MysqlCandidateRepository that implements
    CandidateRepositoryInterface.
    3. Change the binding for CandidateRepositoryInterface in
    AppServiceProvider.

    View Slide

  25. Example #2
    Developing a module for
    integrating Github

    View Slide

  26. Integrations\VersionControl\VersionControlFactory.php

    View Slide

  27. App\Integrations\Interfaces\AbstractVersionControl.php

    View Slide

  28. Integrations\VersionControl\Github.php

    View Slide

  29. App\Http\Controllers\Admin\CandidateController.php

    View Slide

  30. View Slide

  31. You Aren’t Gonna Need It

    View Slide

  32. Is there a better way to do it?

    View Slide

  33. App\Http\Controllers\Admin\CandidateController.php

    View Slide

  34. Why Time Driven Development?

    View Slide

  35. @ktrajchevska
    Why Time Driven Development?
    ● Software design practices come with trade-offs. Know them.
    ● Software design principles should simplify your life, not
    complicate it.
    ● Thinking about the bigger picture will help you create more
    than just software. It will help you create value.

    View Slide

  36. Software Design Principles are
    your tools, not your goals.

    View Slide

  37. @ktrajchevska
    How to start practicing Time Driven Development?
    ● Talk to your lead to understand the business goals before
    proposing an architecture.
    ● Always have the context in mind when designing software.
    ● Don’t shame others for not adhering to “the best” software
    design practices.

    View Slide

  38. Thanks!
    @ktrajchevska
    adeva.co
    Exclusive developers’ network.

    View Slide