Habits of Efficient Developers - Daniel Lebero
Habits of Efficient Developers
Efficiency is doing things right; effectiveness is doing the right things. - Peter Drucker
What is more important? to be more efficient or to be more effective?
no sense to go really fast if we end up in the wrong place
if we know where we want to go but we never achieve the place, it does not make sense either.
There is synergy between efficiency and effectiveness.
Efficient -> less time to do things -> more time to stop, look around and make sure we are travelling in the right decision.
More efficient -> more effective.
FOCUS
Average cost of interruption for developers is 10-15 minutes.
After every interruption, it takes about 10-15 minutes to load the context of the task and be productive.
Two types of interruptions:
Ones that other people control
Ones that we control
Brains are sensitive to unexpected movement -> even simple alerts can take attention
Disable all notifications:
It is easier to deal with email in batches.
prefer asynchronous communication.
Only urgent communication should be enabled.
Pair programming
if there is interruption, one of two developers should walk away and deal with interruption.
Even after interruption, it takes less time for developers to get back to productive state.
Because another developer is there, less interruptions
Rest
Adequate rest is necessary
Do one thing at a time.
when we try to do multiple things at the same time, the quality of our work suffers.
always focus on one thing, finish it and move to the next task.
MASTER YOUR IDE
We spend thousands of hours in front of our IDE
We need to know it inside out.
Any efficiency that we gain is multiplied by thousands of hours we are spending in front of it.
We need to know two things
Functionality
Shortcuts
Even though we are spending hours using it, it does not mean we are going to master it.
Read release notes, follow blogs of people using it,
Pair programming - we can see how other people use IDES
NO MENIAL WORK
You are a developer, you don’t do things that a computer can do for you
Write programs(for yourself)
Bash
Set a time limit when you are trying to automate, if you cannot finish it by that time limit, do it manually.
Avoid GUIs
you cannot put UIs inside for loop.
useful when starting, but when you want to do more, they are constraining.
Automate testing
Automate tests instead of clicking and filling forms.
Bugs are massive time wastes, automated testing helps fix bugs.
Worse than a bug, is having the same bug twice
Before fixing a bug, write a test to prove that you are able to reproduce the bug
Repeatable development environment.
just one command should build, run and test your application.
eg. if database is needed, the command should install the database, configure it and seed it with data.
FAST FEEDBACK
Try to find the shortest and tightest feedback loop possible.
You want feedback often and early to make sure we are not wandering on the wrong path for too long.
Test Driven Development
Best time to write test is before you start doing any coding.
write one test, run it, make it fail, write code to make the test pass.
Benefits of TDD
fast feedback - does the code do exactly what we expect it to do?
automated tests save you time
organizational:
no time to write tests(what it means):
I write my code, finish my feature and then I write my test,
Because of time pressure, you dont write tests
You dont refactor code as you need a very good automated test suite
Because you dont refactor, your code accumulates garbage
It takes more time to add new features
you have less time to write tests, closing a vicious circle.
Seeing a test fail is the test that finds out if the test is testing what it is supposed to test
I don't know what i am going to build: can mean two things
you don’t understand what the business is asking you to do.
you cannot write production code either
go back to business and ask for clarification -> what do you want to do.
You understand business and logic but don’t know how you are going to structure
You know the logic and side effects
When you are exploring new tools, technologies and don’t understand the side effects, TDD is not possible.
REPL
Read eval print loops are good way to experiment
write little programs, run it and check the outputs.
Code reviews
Code reviews help us to find bugs, and share knowledge
Efficient developers want their code to be reviewed.
Small changes:
useful feedback
code reviews for small changes: immediate feedback
Pair program
Stop and reflect on how you work.
Never stop learning.
Summary
Focus
a. disable notifications
b. pair program
c. rest
d. one thing at a timeMaster your IDE
a. Functionality
b. Shortcuts
c. Pair ProgramNo menial work
a. Write programs
b. Avoid GUIs
c. Automate testing
d. repeatable dev env - DockerFast Feedback
a. TDD
b. REPL
c. Pair program