Jason Swett Profile Banner
Jason Swett Profile
Jason Swett

@JasonSwett

6,343
Followers
8
Following
378
Media
9,876
Statuses

Podcaster, speaker, author, consultant.

Sand Lake, MI
Joined May 2009
Don't wanna be here? Send us removal request.
Pinned Tweet
@JasonSwett
Jason Swett
1 day
In my hand I hold my new book. Soon, ladies and gentlemen, you can too!
Tweet media one
9
3
91
@JasonSwett
Jason Swett
2 years
I once stared at a piece of code for 15 minutes trying to figure out what "par" meant. Eventually I realized it was "parent". Someone saved 50ms by not typing "ent". The savings was paid for by 15 mins of frustration. Don't abbreviate. Thinking is more expensive than typing.
87
438
3K
@JasonSwett
Jason Swett
5 months
Have you considered going straight to hell?
Tweet media one
39
24
675
@JasonSwett
Jason Swett
3 years
The smartest thing you can do as a programmer is realize how stupid you are, and make accommodations.
13
104
452
@JasonSwett
Jason Swett
2 years
I've been waiting a while to publicly share this news... I got a new job!!! Monday is my first day as CTO at GitHub!
28
4
442
@JasonSwett
Jason Swett
2 years
I'm now running Rails 7 in production!
9
2
202
@JasonSwett
Jason Swett
2 years
Today I finished reading Domain-Driven Design! I started it in 2013.
9
1
177
@JasonSwett
Jason Swett
3 years
Scarcities that will throw the world into turmoil in the 21st century: - Water - Oil - Senior-level Rails developers
5
21
178
@JasonSwett
Jason Swett
3 years
Right now the demand for Rails developers seems really high. The supply seems really low. I don't see either of these things changing anytime soon. For people working on getting their first programming job, learning Rails might not be a bad bet.
9
29
170
@JasonSwett
Jason Swett
2 years
Why use Ruby/Rails in 2022, given the options available in other language ecosystems? Because, as far as I can judge, nothing has yet surpassed Rails in terms of developer productivity and happiness.
@Red_Pill_Dev
Nick Taranov 🇨🇦 | Fractional CTO
2 years
@JasonSwett Can you provide compelling reasons why a person should study Ruby in 2022 with current state of Node, Python, PHP, Go and .NET? It literally has the worst from Node w/o the frontend benefits, without Python & PHP ecosystems and the speed of Go and .NET.
4
0
3
10
22
152
@JasonSwett
Jason Swett
10 months
A bit of personal news: I'm leaving my job to pursue consulting, teaching and event hosting full-time. The next chapter starts November 10th.
25
1
148
@JasonSwett
Jason Swett
2 months
Look what came in the mail today!!
Tweet media one
5
5
144
@JasonSwett
Jason Swett
2 years
- Rails engines - Microservices - SPAs - Service objects One of the things I'm most looking forward to in writing Growing Large Rails Applications is explaining why each of these ways of attempting to manage complexity in Rails apps is neither necessary nor helpful.
14
6
135
@JasonSwett
Jason Swett
2 years
A good habit: Always run "git status" and then "git diff" before making a commit. You might be surprised how many mistakes you catch.
23
17
135
@JasonSwett
Jason Swett
1 year
Precision in naming matters. file = "input.txt" is wrong. That's not a file, it's a file name. Call it filename. It's not a nitpick. Little "lies" like this synergize with each other and create a whole that's much harder to understand than it needs to be.
10
19
125
@JasonSwett
Jason Swett
3 years
Ever curious how Factory Bot syntax works? Me too, so I decided to code a clone of it myself.
Tweet media one
5
12
118
@JasonSwett
Jason Swett
2 years
I'm working on a new book. It's about how to solve the problems that most Rails apps have: - Bloated junk-drawer models - Nasty controllers with a bunch of custom methods - Views with too much view-related logic that can't seem to find a good home - Etc. More on this soon!
6
6
103
@JasonSwett
Jason Swett
2 years
Git tip: You can do "git checkout -" to switch to the last branch you had checked out.
4
11
101
@JasonSwett
Jason Swett
3 years
This is obviously just an opinion, but if you're programming and not using Vim as your editor, I think you're missing out on life.
40
4
94
@JasonSwett
Jason Swett
3 years
The Complete Guide to Rails testing is now available for purchase. Use discount code CGRTMAY2021 to get 25% off.
14
45
93
@JasonSwett
Jason Swett
2 years
Big announcement: Because Sin City Ruby went so swimmingly well, I've decided that I AM indeed going to put on another Ruby conference next year! But not in Vegas. Guess next year's city to win a prize!
41
3
93
@JasonSwett
Jason Swett
3 years
Today I started working on my next mini-project: a Rails application template that will help you set up a Rails project "the Jason way": RSpec, Capybara, Devise, Sidekiq, Tailwind, and Docker.
8
5
90
@JasonSwett
Jason Swett
3 years
Rails tip: The entities represented by your controllers don't have to have anything to do with your database tables. For example you can have a UserProfilesController even though you don't have a user_profiles db table. I use this tactic a LOT.
4
5
92
@JasonSwett
Jason Swett
2 years
Today I made a cover for my new book.
Tweet media one
4
3
88
@JasonSwett
Jason Swett
5 months
Never in 20+ years of professional programming have I encountered the "brilliant asshole" archetype of coder you hear so much about. I've only encountered a few genuine assholes. Every single one of them has been a complete fucking idiot.
13
5
86
@JasonSwett
Jason Swett
1 year
Much software is built based on a dev’s misunderstanding of what a manager asked for, which is based on a misunderstanding of what the customer asked for, which is based on a misunderstanding of what the customer actually needs.
4
17
85
@JasonSwett
Jason Swett
1 year
My friend @andatki is working on a new book. It's called High Performance PostgreSQL for Rails. This will be a very useful topic for many, and knowing Andy, I'm sure the content will be excellent. Follow the link to get early access to the book.
2
11
79
@JasonSwett
Jason Swett
2 years
Ruby tip: Only add memoization if a) you're sure it's needed and b) you have a plan to measure the before/after performance. Otherwise you're not optimizing, you're just randomly doing stuff.
9
12
82
@JasonSwett
Jason Swett
3 years
A new edition of The Complete Guide to Rails Testing, which will include 8 new chapters on Ruby DSLs, is coming out February 7th.
2
2
83
@JasonSwett
Jason Swett
1 year
I don't think writing new code is a particularly impressive skill. Maintaining existing systems, while not exponentially increasing the cost of maintenance as time goes on, is the hard part.
4
3
82
@JasonSwett
Jason Swett
3 years
Good way for Rails devs to improve coding skills: Build a non-trivial cmd-line project using just Ruby, no Rails (e.g. restaurant ordering system). Use tests. Try hard to use OOP, not procedural. I've done this and it has caused me to look at Rails code a lot differently.
5
9
82
@JasonSwett
Jason Swett
3 years
Programming tip: When it feels like you're about 90% done, that usually means you're about 30% done.
9
12
80
@JasonSwett
Jason Swett
1 year
It came!!
Tweet media one
9
3
78
@JasonSwett
Jason Swett
2 years
A big part of writing understandable code is simply a matter of picking good names. And a big part of picking good names is simply calling things what they are.
14
12
76
@JasonSwett
Jason Swett
3 years
Git tip: Always run these before every commit $ git status $ git diff About 10% of the time I catch something that I didn't intend to commit.
10
8
75
@JasonSwett
Jason Swett
1 year
Today I signed a book deal with Manning. The book I'm writing teaches programmers how to use AI to do more work with less effort. My deadline is January 8th. Expecting release not long after.
12
2
71
@JasonSwett
Jason Swett
3 years
Question for devs who don't natively speak English: Is it basically true that you have to learn English in order to be a programmer?
73
7
71
@JasonSwett
Jason Swett
1 year
RailsConf 2024 is happening in Detroit, about 2.5 hours from my house in the wilderness. Crazy idea: after the conf we load up a handful of folks in a van. Then it’s off to my house for fire + food + beers + camping.
Tweet media one
Tweet media two
Tweet media three
Tweet media four
12
0
67
@JasonSwett
Jason Swett
3 years
Do you like Ruby? Do you like Las Vegas? Do you like fun? I can promise at least TWO of those things at my new conference, Sin City Ruby!
12
7
65
@JasonSwett
Jason Swett
3 years
Programming tip: Never underestimate your ability to fuck stuff up.
3
5
65
@JasonSwett
Jason Swett
2 years
The latest Code with Jason episode is out! In this one I talk with David Heinemeier Hansson ( @dhh ) about car racing, productivity, COVID-19, cryptocurrency, and the Canadian trucker protests. Enjoy!
5
4
63
@JasonSwett
Jason Swett
5 months
@sylarruby For 99% of humanity, it does.
5
0
63
@JasonSwett
Jason Swett
6 months
Yippee!!
Tweet media one
5
5
63
@JasonSwett
Jason Swett
5 months
Don't be envious of people who post pics of themselves working on a laptop outside in full sun. There is literally nothing worse.
9
3
61
@JasonSwett
Jason Swett
11 months
I met an Evil Martian!
Tweet media one
2
4
62
@JasonSwett
Jason Swett
2 years
I bought a Moonlander! I also switched to Dvorak. I now type at around 6 WPM.
Tweet media one
8
0
61
@JasonSwett
Jason Swett
3 years
I'm nearly done making my "Understanding Ruby Procs" video. I put WAY more work into this video than any of my previous ones. I decided 2022 will be the year of me making a shit-ton of coding videos.
Tweet media one
2
0
61
@JasonSwett
Jason Swett
2 years
And we're off of Webpacker as of this morning!
@JasonSwett
Jason Swett
2 years
I'm now running Rails 7 in production!
9
2
202
3
2
61
@JasonSwett
Jason Swett
2 years
Now that I've used Turbo Frames a bit I can see what all the hype is about. It's so much better than the old way.
6
4
58
@JasonSwett
Jason Swett
3 years
Rails tip: Try to keep all your background jobs to one-liners. Background jobs are a mechanical device, not a code organization device.
5
8
59
@JasonSwett
Jason Swett
3 years
The bigger a Rails app gets, the more I think it makes sense to not be afraid to move from "the Rails way that generally works" to "the custom way that works better for us".
5
6
58
@JasonSwett
Jason Swett
6 months
Tweet media one
3
9
51
@JasonSwett
Jason Swett
3 years
Programming tip: Run a "git status" and a "git diff" before each commit. It reduces the risk of committing something you didn't mean to commit.
11
4
57
@JasonSwett
Jason Swett
3 years
I don't understand why HAML is no longer en vogue. To me it seems clearly better than regular HTML.
30
8
55
@JasonSwett
Jason Swett
5 months
Rails conventions can only get you so far. Once an app grows to a non-trivial size, the team needs to impose its own architecture on the codebase in order for the app not to be an unstructured mess.
10
2
57
@JasonSwett
Jason Swett
6 months
We have been welcomed!
Tweet media one
4
0
56
@JasonSwett
Jason Swett
1 year
Next time you're debugging, try this ChatGPT prompt: "I want you to help me diagnose a problem. I'll explain the problem and paste error messages. You should ask me to paste relevant files from my codebase that will help you." I've tried this. It blew my mind.
6
3
56
@JasonSwett
Jason Swett
6 months
The King of Ruby
Tweet media one
6
3
56
@JasonSwett
Jason Swett
3 years
Finally tried out ViewComponent. Verdict: awesome. I put VC in my production app and I can already see a lot of opportunities for tidying up messy templates and converting slow system specs to fast component specs.
10
1
56
@JasonSwett
Jason Swett
2 years
I have a few more episodes in the queue, but after that I plan to take an indefinite hiatus from the Code with Jason Podcast in order to focus on other things. A huge thanks to everyone who has listened and guested over the years!
6
2
55
@JasonSwett
Jason Swett
1 year
The other day @palkan_tula gave me the tip that you can speed up your test suite by disabling logging in the test env. That small change alone took my test suite from ~16m to ~13m. Nice tip!! We also recorded a whole podcast episode about test performance...coming soon.
5
5
53
@JasonSwett
Jason Swett
1 year
My office now doubles as a music studio!
Tweet media one
9
0
52
@JasonSwett
Jason Swett
3 years
My new Dockerized Rails application template, Instant Rails, is now available for free. Run one command and get a Rails app with Devise and RSpec installed + a PostgreSQL instance. Works even if you don't have Ruby, Rails or PostgreSQL installed.
1
7
50
@JasonSwett
Jason Swett
11 months
Romania
Tweet media one
3
0
52
@JasonSwett
Jason Swett
6 months
Most engineering teams don't need a code review. They need---among other things---a domain model review. If the domain model is sound, it's not too hard to fix the code to match. If the domain model isn't sound, any code "improvement" superficial and almost pointless.
8
5
52
@JasonSwett
Jason Swett
2 years
Seeing this makes me very proud. Not QUITE as proud as if they had used a fresh uncreased piece of printer paper, but still proud.
Tweet media one
3
2
51
@JasonSwett
Jason Swett
2 years
Programming tip: Avoid using boolean flags to change behavior. Such code asks too much hard thinking of the reader. Instead of trying to get one thing to behave in two ways, just make two separate things.
7
3
50
@JasonSwett
Jason Swett
3 years
Ruby tip: Blocks, procs, lambdas, etc., despite what you may have read, are not simple and not easy. You can't "master" those concepts from a single blog post. If you don't get it, you're not dumb. There's just actually a lot to learn and it takes time and effort.
3
6
50
@JasonSwett
Jason Swett
3 years
Productivity tip: Before you end the workday, make a note of a task (preferably a small and easy one) that you can immediately start working on when you sit down tomorrow. Doing this makes the next morning easier, more enjoyable and more efficient.
3
6
50
@JasonSwett
Jason Swett
6 months
Programming tip: Do a git status and git diff before every commit. It helps keep you from committing things you didn't intend to.
19
2
49
@JasonSwett
Jason Swett
3 years
For anyone wanting to get started with web dev, I think it's still true that Rails is the best web framework there is. I also think it's still true that @mhartl 's tutorial is the best way to learn Rails.
@chloewchia
chloe chia
3 years
done with finals ~~ and can finally get back into fun startup stuff 😋 1st goal: learning how to code web apps would be GREAT to hear anyone's tips for learning!
26
2
112
2
9
48
@JasonSwett
Jason Swett
3 years
A programmer who tries to save time by skipping tests will experience the same thing as a cook who tries to save time by skipping mise en place. The job will be more hectic, more stressful, take longer, and the end product will probably be worse.
2
15
48
@JasonSwett
Jason Swett
3 years
A long time ago I stopped writing tests for validations. So far nothing bad has happened. Probably won't ever write one again.
10
2
48
@JasonSwett
Jason Swett
2 years
PR reviews go better when the reviewer approaches it not as an authority figure scanning for transgressions, but as a fellow team member helping to figure out the best solution.
2
9
48
@JasonSwett
Jason Swett
1 year
Programming tip: Avoid premature generalization. It's good to consider the possible needs of the future, but usually, it's good to write code only for the needs of today.
4
3
47
@JasonSwett
Jason Swett
9 months
I thought about it a million times but suppressed the urge. Then I started working on it, and stopped myself. Now I'm starting again. I'm building a CI product to compete with CircleCI, GitHub Actions, etc. And I'm building it all live and recording it on video!
4
3
47
@JasonSwett
Jason Swett
3 years
Everyone is desperate to hire devs right now but nobody has a UNIQUE reason to work for them. I have one: we actually have clean code and we give you the empowerment + permission + education to keep it that way. If that appeals to you, I'm hiring.
1
5
47
@JasonSwett
Jason Swett
8 months
The view from just outside my office.
Tweet media one
8
0
46
@JasonSwett
Jason Swett
3 years
Don't be afraid to give things long names. I just created a class called DownloadedForClearingHouseChargeBatchesController. Long and clear beats short and mysterious. Typing is cheaper than thinking.
4
2
46
@JasonSwett
Jason Swett
3 years
The new edition of The Complete Guide to Rails Testing, which will contain 8 new chapters on Ruby DSLs, will be available February 7th.
0
1
44
@JasonSwett
Jason Swett
4 months
I've started keeping a list of people I know in the Ruby community who are either a) looking for work or b) looking to hire someone If you fall into either category, let me know, and share any relevant details, and I'll add you to my list.
12
14
44
@JasonSwett
Jason Swett
7 months
Rails tip: If a scope is only used in one place, don't make it a scope. Just put it inline in the place that it's used.
3
1
44
@JasonSwett
Jason Swett
2 years
PSA: after_commit is NOT equivalent to after_save + after_destroy. after_save/after_destroy run inside the db transaction. after_commit runs after the transaction has been committed. Ignorance of this distinction can result in some surprising and pernicious bugs!
4
5
43
@JasonSwett
Jason Swett
2 years
Programming tip: It's better to be all the way done with half your tasks than to be halfway done with all your tasks.
2
4
44
@JasonSwett
Jason Swett
6 months
@adrianthedev ⁩ kicking off Sin City Ruby
Tweet media one
2
5
42
@JasonSwett
Jason Swett
6 months
Ideally, code tells a high-level story about what's happening, and hides the machinery that gets in the way of the storytelling. It shows the essential and hides the incidental. I feel like this code does roughly the opposite.
@solnic_dev
Peter Solnica
6 months
As a Rails dev, when you see code like this - what are your thoughts? 🤔
Tweet media one
96
6
138
4
1
43
@JasonSwett
Jason Swett
3 years
Programming tip: Conditionals read more easily and naturally (IMO) when you put the "normal" case first and the less common case second. "Normally we do this, otherwise we do this."
Tweet media one
4
3
43
@JasonSwett
Jason Swett
3 years
Someone suggested to me to have some jr devs on the Rails with Jason podcast, to talk about the kinds of challenges people run into early on. Great idea. If you're a jr dev and interested, email jason @codewithjason .com. RTs appreciated.
1
37
43
@JasonSwett
Jason Swett
1 year
ChatGPT prompt to try: "I need to build [your project here]. Help me plan this project. You should ask me questions about my project, and each time I respond, you should ask me more questions if appropriate." You might be astonished by what you see. I was.
3
1
42
@JasonSwett
Jason Swett
4 months
Most Rails apps - and I suspect most apps in general - are SO much more bloated than they need to be.
5
0
42
@JasonSwett
Jason Swett
3 years
RubyConf has been a treat so far from a linguistic perspective. I've been spoken to in English, Spanish, French, German, Turkish, Russian and Hindi. At one point I even spoke a little Lisp.
2
2
41
@JasonSwett
Jason Swett
3 years
The more I use ViewComponents, the more I'm sure I'll never go back to the old way. Otherwise the logic that belongs to the view doesn't have a good home, and has to lodge with friends, permanently. It was an awkward arrangement.
6
3
42
@JasonSwett
Jason Swett
2 years
I've spent the last ~3 months doing nothing but fixing flaky tests. I'm working on a blog post this week that will help you understand why flaky tests happen, how to fix them, and how not to write them in the first place.
5
0
41
@JasonSwett
Jason Swett
5 months
People who advocate the idea of hurriedly and sloppily building an MVP and then cleaning it up after product-market fit are forgetting that cleaning up a sloppy codebase is usually so staggeringly expensive that doing so isn't a remotely realistic option.
8
3
42
@JasonSwett
Jason Swett
3 years
I know I'm super late to the party, but: I just tried out Turbo Frames for the first time. Pretty great.
2
0
41
@JasonSwett
Jason Swett
5 months
@walkingriver It’s not built in, it has to be added by an “activist”.
1
0
40
@JasonSwett
Jason Swett
2 years
One of the biggest benefits of TDD is one that I rarely hear anyone talk about: Writing a test lets you empty your mind of *what* you want to do so that you can then focus 100% on *how* you want to accomplish it.
2
8
38