Skip to content

Instantly share code, notes, and snippets.

@joejag
Last active December 15, 2015 04:28
Show Gist options
  • Save joejag/5201270 to your computer and use it in GitHub Desktop.
Save joejag/5201270 to your computer and use it in GitHub Desktop.
ScotRUG talk: Joe finally gets it

Abstract

Joe likes to think about how and why he does things, he doesn't always understand what he's doing, but he's good at looking competent. Come to ScotRUG to hear about what Joe learned over the last 6 months about SOLID, Git, regex and tooling choice while moving from looking competent to finally getting it.

Topics

  • Choosing a tool
  • SOLID
  • Git
  • Quick Tips
  • Regex

FLOW

Intro

Worked with EmergeAdapt coming from heavy Java. First time overt ruby. Learnt a load along the way, and dug deeper into certain topics, especailly SOLID, Git, modern web debugging, Regex.

While researching these things I heard the phrase "best practice" a lot. It's somethig I don't like as it says that you shouldn't learn in your own situation, you should blindly follow this advice.

Choosing a tool

  • We like fads (weight loss, cash quick, even in tech)
  • You need to know your context, then look at pulling tools to solve
  • Given a new practice. What problem does it solve? How? Benefits? Will it work in my context?
  • Cucumber example (Angus vs Bruce) (Ubiquituous langague, living docs, automated acceptance tests, outside in dev)
  • Misapplication leads to pessimisim, we should of opptomistic about tools but grounded in our own context.
  • Best Practice is bullshit. It inhibits learning. Substitute for less glamourous but powerful idea of learning how to do your job.

SOLID

  • Current requirements: Make me a square. But requirements may change.
  • Volunteer: Putty vs Lego: Make me a smooth cube. Make me a smooth oblong. Make me a smooth sphere. Software is malleable.
  • Change will happen, unexpected dependencies that are killing you
  • SOLID: What's that stand for? Who know's the freeman ones? Loosley Coupled. High Cohesive, Easily Composable, Context independent (isn't aware of it's env)
  • Static languages are heavy on all parts. Dynamic languages aren't. DI is easy, IS isn't required. L, less inheritance, more modle sharing.
  • SRP: AND/OR, One reason for change, based on responsbilitiy, more flexible.
  • Question: Sandi Metz says methods as well as classes should have one function.
  • O/C: Modules (localised example), hook methods.
  • DInjection: Dependencies/Coupling can be class, methodname, param types, parm order.
    • Question: Sandi uses hashes for params, how do you feel about this? named params?
  • TDD is a living hell if your design is off.
  • Is it DRY? Does it have one responsibility? Does everything change at the same rate? Does it depend on things that change less often than it does?
  • Make things more likely to change, depend on the ones less likely to change. About dependencies, so DI.

Git

  • standup: git log ––since yesterday ––author joe
  • purr: git pull ––rebase ** public/private branches. Tracking/Topic. integrating changes Merge/Rebase. ** Merge leads to pointless commits. Should only be for topic merges. Tracking should be linear. ** Rebase resets base HEAD to be remote, then replays you commits. Also useful for bisect
  • st: git status -sb ** Take off training wheels.
  • ready: git rebase -i @{u} ** Squash and reword commits.
  • lg: long log ** SHA, the commit message, who made the commit and how long ago

Quick Tips

  • Chrome $0, youtube gimmick
  • Chrome purple, copy as CURL, format JS, open file
  • Tmux setup
  • Bash history with CTRL+R
  • You can CTRL+Z out of vim then go back again

Regex

  • Useful for validation and extracting info
  • Target String + expression. Literal Chars. Metachars & esacpe chars.
  • Capture groups (plus OR)
  • Iteration: single char, {3}, {3,4}, {3,}, ? + *
  • Positioning: ^ $
  • Character Classes: [0123], [0-9], [^0-9], \d, \w, \s, \D
  • Subgroups extendeded: (?:), (?), (\1)
  • Rubular + Regexper
  • There is a crossword

Finish

I love programming because there's always more to know, or to dive deeper into one subject. If you want tools then there's loads to learn. Next time you have to do something, and you don't quite grok it, go read some articles, or a book, then write your own articles or even go show what you've learned at your local ScotRug.

I'd love to hear about what you've learned recently, thanks for listening.

Props

  • Putty and Lego to demonstrate software vs hardware
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment