A Samurai must always think about death
One who is supposed to be a warrior considers it his foremost concern to keep death in mind at all times, every day and every night, from the morning of New Year's Day through to the night of New Years Eve.
As long as you keep death in mind at all times, you will furfill the ways of loyalty and family duty. You will also avoid myraid evils and calamities, you will be physically sound and healthy, and you will ive a long life. What is more, you character will improve and you virtue grow.
What lesson can we learn here from the book, well the book is telling the reader to always think about the worst outcome in order to prepare yourself to avoid it.
This lesson can be easily be related to coding, always think about systems failure, think about how things might go wrong and program definsivley so that systems will only accept input that meets the required criteria. Use exception handeling correctly for systems to fail gracefully and log the error and stack trace for debuging. Think about sql injection attacks on your system. Think about how it could be compromised. Think how to alert developers to problems in the system.