Skip to content

Latest commit

 

History

History
214 lines (184 loc) · 5.94 KB

its_dangerous_to_go_alone.md

File metadata and controls

214 lines (184 loc) · 5.94 KB
marp theme
true
default

bg right

It's dangerous to go alone! Take this!

On finding your way in a code that's new to you


Why did I write this talk?


What do we need to find our way

  • Where can we start our journey?
  • Getting around
  • Retelling the story

Where can we start our journey?


What are good entry points?

  • Have a problem we want to solve
  • We want to start with a place that touches the least amount of code we don't care about

  • Is there a way we can find a test?
  • Is there a way we can activate it through the UI?
  • Is there a pretty specific string we can start looking for in the code?

bg contain


Getting around in Ruby


bg right

How does Ruby get in the way?

The design of Ruby makes it hard for tools that don't run the code (static analysis) to follow the code around


bg right

Jumping with static tools

  • ctags
  • language servers - Solargraph

bg right

Searching and Guessing

  • project wide string search
    • def needle_method

Guessing continued

  • Automating common searching
  • (neo)vim - anyjump.vim
  • VSCode - vscode-dumb-jump

Landmarks

  • Rails conventions
  • project conventions
  • alternate file finders rails.vim, vim-projectionist, VSCode - alternate-file

Ruby Tools

A solution to Ruby is more Ruby

  • Debugger driven development
  • Find an entry point to drop a debugger in
  • Step through executing code

Pry

  • Pry gem
  • show-source command
  • can let you trace through metaproq

Lost in the library?

  • bundler gem
  • command bundle open <library> and drop a binding

bg right

Environmental Changes

  • Type Ruby with RBS

Retelling the story


How do we make sure our story is right

  • What is our vocabulary?
  • Ask someone
  • Building maps

What is our vocabulary?

What level are we talking about?

  • general progamming and technology terms
  • Language specific terms
  • Framework or Pattern specific terms
  • Domain specific terms

Ask someone


Why am I asking?

  • I need a shortcut vs Put me on the path
  • Avoiding XY problems

Why am I not asking?

  • Unproductive
    • I don't want to appear like I don't get it
    • They must be busy
  • Productive
    • We want to understand it our own way and clarify our assumptions
    • What is the fastest way we can prove our model wrong?

Building Maps

Reading and understanding code that is hard to understand is less like geography and more like archaeology. A complete understanding will be more like a story than a map.


Understand our assumptions

  • Evolutionary pressure on code to become one thing when it started as another
  • git commit message archaeology

bg contain


How we can empower those that come after us by changing the environment

  • Empower others to go on code adventures
  • Leave better road signs for our future selves
  • Be kind to ourselves and understand the pressures we and our past selves have been under

Thanks!

Allen Hsu github: aldhsu linkedin.com/in/allendhsu


The Lookout Way

bg right contain