I wrote about having a crossword approach to writing software, but I haven’t given any real-world examples. I only said it’s better because it doesn’t let you wander around and dip your fingers into everything. It keeps you focused on what’s needed now.
Let’s say you’re building a content management system using Laravel. Here are the steps I’d take to build it:
1. Write the code to display the posts in some kind of list. You can get this done by just having a seeder in place and a simple query on the index method. Don’t worry about filtering or anything like that.
2. Write the code to show, store, update, and delete posts. Completely ignore any validation and authorization for now.
3. Notice I haven’t said anything about writing views. No html&css should be written so far. Views can wait.
4. Go back to the create and update methods and add some validation rules.
5. Sprinkle some authorization too. Don’t forget about the delete method.
6. If you need to filter the posts in any way, now is probably a good time to do it. Don’t forget to write tests that cover every filter.
7. Now that all the logic is in place and thoroughly tested, we can start focusing on the views. Style the index and the show views.
8. Add the create and edit post endpoints and style their views too.
10. Pick the next feature. Make sure it touches as few things as possible.
Rinse and repeat.