Well the question looks more like a why instead of a how..
Well the question looks more like a why instead of a how.. answering the how is simple, if you are starting on a new project (as you seem to be), start with unit tests for all functions, for anything that talks to DBs/external APIs use mocks. Answering the why, scenario 0 - it forces you to have functions that do one thing and one thing well. Unit testing mostly helps people keep functions small and focused. scenario 1 - assume you are working on a fun app without tests. Everything is fine and the app works great. After some time you decide to add a new feature X, and you realize you need to modify an existing function to achieve that.. you modify that, and the new feature X works fine, but two days later you will realize that an old feature Y is broken. scenario 2 - scenario 1 but with collaborators instead of yourself revisiting the app. scenario 3 - people use unit tests to understand code - while reading/working on other people's code. Unit tests also serve as excellent examples on how to call/use something, which params to pass etc. There are a lot more reasons esp for large projects, and you never know when a small one off project grows into something big and critical so its recommended to always start with unit tests as adding them later is usually 10x more work as it would require refactoring etc.
Posted by jezclaremurugan on Feb 21, 2015, 4:46 PM
Tags
Related issues
- You obviously did this for fun, I don’t want to throw any shade on it and have no criticism, I also make fun things just because.¹ So ta...
- Many devs love to shit on the guy from the 'I just want the exe.
- Now imagine how poor people stress if their smartphone bricks or gets damaged or lost.
- Resuming an extended-thinking session fails permanently with 400 "thinking blocks cannot be modified" (transcript stores thinking text as empty but keeps signat
- I'll preface this with a statement that as a European I want European alternatives to succeed, and MS-owned GitHub to shrivel and disappear.
- Yeah, but there’s a world of difference between “not perfect” and “we rounded a few sliders, and now the modal is a nightmare to use”.
Raise real-world problems, find people facing the same issue, and discuss solutions.8,000 issues0 comments
reliability (SaaS)
You obviously did this for fun, I don’t want to throw any shade on it and have no criticism, I also make fun things just because.¹ So ta...
Many devs love to shit on the guy from the 'I just want the exe.
Now imagine how poor people stress if their smartphone bricks or gets damaged or lost.
Resuming an extended-thinking session fails permanently with 400 "thinking blocks cannot be modified" (transcript stores thinking text as empty but keeps signat
I'll preface this with a statement that as a European I want European alternatives to succeed, and MS-owned GitHub to shrivel and disappear.
Yeah, but there’s a world of difference between “not perfect” and “we rounded a few sliders, and now the modal is a nightmare to use”.
I used to write a lot of native Windows corporate software in the 90's and 2000's and my standard login window was a floating draggable o...
App broken with Mosquitto broker 7.0.0
Well the question looks more like a why instead of a how..
Well the question looks more like a why instead of a how.. answering the how is simple, if you are starting on a new project (as you seem to be), start with unit tests for all functions, for anything that talks to DBs/external APIs use mocks. Answering the why, scenario 0 - it forces you to have functions that do one thing and one thing well. Unit testing mostly helps people keep functions small and focused. scenario 1 - assume you are working on a fun app without tests. Everything is fine and the app works great. After some time you decide to add a new feature X, and you realize you need to modify an existing function to achieve that.. you modify that, and the new feature X works fine, but two days later you will realize that an old feature Y is broken. scenario 2 - scenario 1 but with collaborators instead of yourself revisiting the app. scenario 3 - people use unit tests to understand code - while reading/working on other people's code. Unit tests also serve as excellent examples on how to call/use something, which params to pass etc. There are a lot more reasons esp for large projects, and you never know when a small one off project grows into something big and critical so its recommended to always start with unit tests as adding them later is usually 10x more work as it would require refactoring etc.
Comments (0)
No comments yet. Start the discussion.