loading words...

May 29, 2019 21:48:28

Complexity: Code

by @craigpetterson PATRON | 207 words | 318πŸ’Œ

Craig Petterson

Total posts: 318πŸ’Œ
Total words: 88277 (353 pages πŸ“„)

Oof, talking about code complexity. What the hell have I got myself into?

I want to pad this section out with a couple of code examples, maybe even just one.


Occam's Razor: effectively, the simplest solution is usually correct.

KISS: Keep it simple, stupid.


In my day to day development, I try to remove any ambiguity from anything I write.

We have several classes that are a nightmare to type out:

  • PA
  • BPF
  • (I)BT
    - This one in particular is my favourite, because in bt is backtrace in byebug
  • (B/S/P)FI
  • GGA

Oh, interesting acronyms… No… what the hell do they mean?

If you gave this to somebody they wouldn't understand any of it and why would they?

It's an understandable mistake though. Naming is hard. Typing out long names is frustrating.

If you can get this right. Give me a shout.


I'm a firm believer in CRUD controllers. These are controllers that adhere to the 7 actions that are needed to do everything.

If you're adding more actions over these 7, then you have just made a CRUD actions that should be in a different controller.

The perfect controller action would be (nearly) empty.

That's 200 words, but I need to elaborate on these…

From Craig Petterson's collection:

contact: email - twitter / Terms / Privacy