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

The Code Cure: Small Steps to a More Organized ...

The Code Cure: Small Steps to a More Organized Front-End Codebase

Working with a clean codebase is like stepping into a well-organized space – it makes you feel right at home. But despite our best intentions, our front-end code has a tendency to get a bit...messy. It's ok, it happens to the best of us! Tight deadlines and one-off fixes can turn that tidy codebase into a dusty attic. The good news is, it isn't difficult to start taking back control. In this session we'll look at practical, bite-sized assignments that you can accomplish at whatever pace your workflow allows. And together we can work towards a cleaner, more organized, and useful front-end codebase.

Matt Wondra

April 30, 2015
Tweet

Other Decks in Technology

Transcript

  1. SMALL STEPS TO A MORE ORGANIZED FRONT-END CODEBASE THE CODE

    CURE Small Steps to a More Organized Front-End Codebase Slides and handout at mattwondra.com / @mattwondra
  2. APARTMENT THERAPY THE KITCHN Saving the world, one room at

    a time Inspiring cooks, nourishing homes
  3. MAXWELL RYAN THE EIGHT-STEP HOME CURE “…the first things that

    follow us when we move are our own bad habits.”
  4. THE CODE CURE 1. Take Inventory 2. Evaluate Tools 3.

    Naming Conventions 4. Emphasize Clarity 5. Modularize 6. Stylistic Conventions 7. Documentation 8. Publish & Party
  5. ASSIGNMENT #CODECURE A 1- or 2-hour task related to this

    step, to be completed with your team.
  6. MAXWELL RYAN THE EIGHT-STEP HOME CURE “When you get your

    house in order, 
 other parts of your life just start to follow.”
  7. THE CODE CURE 1. Take Inventory 2. Evaluate Tools 3.

    Naming Conventions 4. Emphasize Clarity 5. Modularize 6. Stylistic Conventions 7. Documentation 8. Publish & Party
  8. THE BIG IDEA #CODECURE We can only solve the problems

    
 we know about. 1. TAKE INVENTORY
  9. ASSIGNMENT #CODECURE Drop comment tags in your code to help

    you find problems later. 1. TAKE INVENTORY
  10. ASSIGNMENT #CODECURE Write down the biggest challenges 
 in your

    codebase and your goals for The Code Cure. 1. TAKE INVENTORY
  11. THE CODE CURE 1. Take Inventory 2. Evaluate Tools 3.

    Naming Conventions 4. Emphasize Clarity 5. Modularize 6. Stylistic Conventions 7. Documentation 8. Publish & Party
  12. THE BIG IDEA #CODECURE Our tools can help enforce our

    habits and make it hard to do the wrong thing. 2. EVALUATE TOOLS
  13. ASSIGNMENT #CODECURE Document the steps to set up and maintain

    these tools in your README. 2. EVALUATE TOOLS
  14. THE CODE CURE 1. Take Inventory 2. Evaluate Tools 3.

    Naming Conventions 4. Emphasize Clarity 5. Modularize 6. Stylistic Conventions 7. Documentation 8. Publish & Party
  15. PHIL KARLTON “There are only two hard 
 things in

    Computer Science: 
 cache invalidation and naming things.”
  16. #CODECURE - BEM - OOCSS - SMACSS - SUIT CSS

    - Class naming ideas from Sparkbox 3. SET NAMING CONVENTIONS
  17. THE CODE CURE 1. Take Inventory 2. Evaluate Tools 3.

    Naming Conventions 4. Emphasize Clarity 5. Modularize 6. Stylistic Conventions 7. Documentation 8. Publish & Party
  18. THE BIG IDEA #CODECURE Code is for humans, not just

    computers, so we should make it as clear as possible. 4. EMPHASIZE CLARITY
  19. #CODECURE RULE OF THUMB If you need to look at

    the HTML to understand what a CSS selector is targeting, you should make the selector clearer. 4. EMPHASIZE CLARITY
  20. THE CODE CURE 1. Take Inventory 2. Evaluate Tools 3.

    Naming Conventions 4. Emphasize Clarity 5. Modularize 6. Stylistic Conventions 7. Documentation 8. Publish & Party
  21. THE BIG IDEA #CODECURE Our code is easier to write,

    read, and manage if every chunk only has 
 a single job. 5. MODULARIZE
  22. ASSIGNMENT #CODECURE Find modules that still feel too big 


    and write down all the jobs each 
 one is trying to do. 5. MODULARIZE
  23. #CODECURE Fetch comments from API Show a list of comments

    Let users write new comments 5. MODULARIZE asdasd a s aslkjl asdlk jlkasj dlkjla as a lsk dlkl klk. lkj wd oij2oij jdjlk dx as asd poqw p12mpm ask kwdm amwdpkmpam alksjdl dkjkwj d asd asd d 3 qk. 9a8uy98 891 98d 9820 2knlkasldkm a d2kjq w wqkjijoiwqjd ioqwjd d aklsj sadas d asd. SUBMIT COMMENT
  24. #CODECURE 5. MODULARIZE CommentData Reads and writes 
 comments to

    the API CommentList Gets comments from CommentData and renders them in a list CommentForm Displays a form. 
 On submit, sends the 
 data to CommentData.
  25. THE CODE CURE 1. Take Inventory 2. Evaluate Tools 3.

    Naming Conventions 4. Emphasize Clarity 5. Modularize 6. Stylistic Conventions 7. Documentation 8. Publish & Party
  26. THE BIG IDEA #CODECURE Our code is much more readable

    when it’s stylistically consistent throughout. 6. SET STYLISTIC CONVENTIONS
  27. #CODECURE - Douglas Crockford’s Code Conventions - Airbnb JavaScript Style

    Guide - jQuery JavaScript Style Guide 6. SET STYLISTIC CONVENTIONS
  28. #CODECURE - CSS Guidelines - Code Guide by @mdo -

    Wordpress CSS Coding Standards 6. SET STYLISTIC CONVENTIONS
  29. #CODECURE - Code Guide by @mdo - Google HTML/CSS Style

    Guide - w3schools HTML(5) Style Guide 6. SET STYLISTIC CONVENTIONS
  30. THE CODE CURE 1. Take Inventory 2. Evaluate Tools 3.

    Naming Conventions 4. Emphasize Clarity 5. Modularize 6. Stylistic Conventions 7. Documentation 8. Publish & Party
  31. THE BIG IDEA #CODECURE The right documentation can clarify how

    our code is organized and works. 7. INVEST IN DOCUMENTATION
  32. THE CODE CURE 1. Take Inventory 2. Evaluate Tools 3.

    Naming Conventions 4. Emphasize Clarity 5. Modularize 6. Stylistic Conventions 7. Documentation 8. Publish & Party
  33. THE BIG IDEA #CODECURE You’ve learned a lot! Share that

    with the world and give yourself a pat on the back! 8. PUBLISH & PARTY
  34. THE CODE CURE 1. Take Inventory 2. Evaluate Tools 3.

    Naming Conventions 4. Emphasize Clarity 5. Modularize 6. Stylistic Conventions 7. Documentation 8. Publish & Party