Python Forum
Approach to coding, good/bad
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Approach to coding, good/bad
#20
Get into the habit of writing tests. For one, they give you safety. If you're testing manually, you have the problem of making changes and not really knowing whether you've broken anything else in doing so until you run the application. If you write tests, you can run them after making the changes and find and fix any breakages before running the application. Clearly, when developing software for use in the real world that's very important and I think it's useful to gain those skills. Python comes with a unit testing module (unittest) and Kent Beck's "Test Driven Development: By Example" is a good intro book on writing tests first (the examples in the first part are in Java, mind). Working in a test driven manner also helps you to focus on small chunks of the application at a time, rather than having to keep everything in mind at once.

I'm not a big fan of commenting code, because the only thing that tells you what the code does is the code itself (and the tests, of course!) - comments can be misleading (e.g. if they're out of date) and extra noise (I've seen lots of commented out code just left there in projects I've worked on). I much prefer code to be written in a way that makes the intent clear - by using good names and breaking things down into small pieces (like nice, small functions).
Reply


Messages In This Thread
Approach to coding, good/bad - by j.crater - Mar-22-2017, 01:37 PM
RE: Approach to coding, good/bad - by sparkz_alot - Mar-22-2017, 01:56 PM
RE: Approach to coding, good/bad - by micseydel - Mar-22-2017, 05:45 PM
RE: Approach to coding, good/bad - by Larz60+ - Mar-22-2017, 05:54 PM
RE: Approach to coding, good/bad - by Ofnuts - Mar-22-2017, 08:45 PM
RE: Approach to coding, good/bad - by ichabod801 - Mar-22-2017, 09:22 PM
RE: Approach to coding, good/bad - by Ofnuts - Mar-22-2017, 09:34 PM
RE: Approach to coding, good/bad - by nilamo - Mar-22-2017, 09:45 PM
RE: Approach to coding, good/bad - by Larz60+ - Mar-22-2017, 09:46 PM
RE: Approach to coding, good/bad - by wavic - Mar-22-2017, 10:32 PM
RE: Approach to coding, good/bad - by teenspirit - Apr-13-2017, 04:28 PM
RE: Approach to coding, good/bad - by Larz60+ - Apr-13-2017, 07:13 PM
RE: Approach to coding, good/bad - by volcano63 - Apr-19-2017, 09:55 PM
RE: Approach to coding, good/bad - by Ofnuts - Apr-22-2017, 12:34 PM
RE: Approach to coding, good/bad - by volcano63 - Apr-23-2017, 07:16 PM
RE: Approach to coding, good/bad - by Ofnuts - Apr-23-2017, 09:19 PM
RE: Approach to coding, good/bad - by volcano63 - Apr-23-2017, 09:45 PM
RE: Approach to coding, good/bad - by sparkz_alot - Apr-23-2017, 09:53 PM
RE: Approach to coding, good/bad - by ichabod801 - Apr-23-2017, 10:46 PM
RE: Approach to coding, good/bad - by ndc85430 - Apr-28-2017, 06:03 AM
RE: Approach to coding, good/bad - by volcano63 - Apr-28-2017, 02:54 PM
RE: Approach to coding, good/bad - by ichabod801 - Apr-29-2017, 01:06 AM
RE: Approach to coding, good/bad - by Larz60+ - Apr-29-2017, 01:26 AM
RE: Approach to coding, good/bad - by Ofnuts - Apr-29-2017, 06:35 AM
RE: Approach to coding, good/bad - by Larz60+ - Apr-29-2017, 11:54 AM
RE: Approach to coding, good/bad - by Ofnuts - Apr-29-2017, 03:07 PM
RE: Approach to coding, good/bad - by nilamo - Apr-29-2017, 01:47 PM
RE: Approach to coding, good/bad - by ichabod801 - Apr-29-2017, 03:32 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to approach pyusb application arch m3atwad151 0 788 Nov-10-2022, 06:11 AM
Last Post: m3atwad151

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020