English I: Solution. For Example, If The Task Is Sorting Lists, Sort Some Short Lists Yourself
English I: Solution. For Example, If The Task Is Sorting Lists, Sort Some Short Lists Yourself
To make good progress in your programming task, you need to test your work
as early and as thoroughly as possible. Everybody makes mistakes while
programming and finding mistakes in programs consumes a very large part of a
programmer’s work-day. Finding a problem in a small and easy piece of code is
much simpler than trying to spot it in a large program. This is why you should
try to test each sub task you identified during your task-breakdown by itself.
Only after you’re confident that each part works as you expect you can attempt
to plug them together. Make sure you test the complete program as well; errors
can creep in in the way the different parts interact. You should try to automate
your tests. The easier it is to test your program, the freer you are in
experimenting with changes.
The last important point is how you express your thoughts as code. In the same
way that you can express the same argument in different ways in a normal
English essay, you can express the same problem-solving method in different
ways in code. Try for brevity. The lines that you don’t write are the lines where
you can be sure that the don’t have bugs. Don’t be afraid to Google for idiomatic
ways of doing the things you’d like to do (after you tried doing them yourself!).
Remember that you don’t write the program for the computer, you write it for
other humans (maybe a future you!). Choose names that explain things, add
comments where these names don’t suffice. Never comment on what the code is
doing, only write comments that explain why.