====== Software carpentry: best practices and tools ====== ===== Course material ===== Slides of the course: {{ :slides_day1_parti.pdf | Morning, Part I}}, {{ :slides_day1_partii.pdf | Morning, Part II}}, {{ :oo_design.pdf | Afternoon, Object Oriented Design}} Exercises: {{ :exercises_day1_parti.pdf | Part I}}, {{ :exercises_day1_partii.pdf | Part II_}} Solution to the exercises: * Part I: * [[day1_ex3_solution | Solution to Exercise 3]] (Bug hunt) * {{ :sudoku.tgz | Solution to Exercise 4}} (Sudoku), also available in the SVN repository under ''day1/exercises_solutions/sudoku'' * Part II * {{ :graph_solution.zip | Solution to afternoon exercise (city graph)}} {{ :cheat_sheets.pdf | Cheat sheets}} that summarize the agile development work cycles, and the main features and syntax of Python tools ===== Good programming practices ===== ==== Software carpentry in general ==== Two comprehensive software carpentry courses: [[http://software-carpentry.org/|University of Alberta]] [[http://itb.biologie.hu-berlin.de/~zito/teaching/SC/|Tiziano's course]] at the Bernstein center in Berlin ==== Coding standards ==== [[http://www.python.org/dev/peps/pep-0008/|PEP8]], the official Python style guide ==== Refactoring ==== [[http://www.refactoring.com/|Refactoring home page]], maintained by the author of the main refactoring book, [[http://books.google.com/books?id=1MsETFPD3I0C&lpg=PA4&dq=fowler%20refactoring&pg=PA67#v=onepage&q=&f=false|//Refactoring: Improving the Design of Existing Code//]], Martin Fowler ===== Debugging ===== [[http://docs.python.org/library/pdb.html|pdb]], the standard python debugger [[http://winpdb.org/download/|winpdb]], a graphical interface for ''pdb''. It's platform-independent despite its name. [[http://www.gnu.org/software/ddd/|DDD]] (DataDisplayDebugger), graphical general-purpose debugger. Python IDEs often have a built-in debugger. ===== Profiling ===== [[http://docs.python.org/library/profile.html|cProfile]], the batteries included Python profiler [[http://docs.python.org/library/timeit.html|timeit]], built-in Python module to measure the execution time of small code parts [[http://www.vrplumber.com/programming/runsnakerun/|RunSnakeRun]], a wxPython-based visualization of profiling results -- very intuitive! ===== Test suites ===== [[http://docs.python.org/library/unittest.html|unittest]], the standard Python test framework [[http://codespeak.net/py/dist/test/test.html|py.test]], an alternative framework that simplifies writing tests and allows for extension and customization of test experience [[http://somethingaboutorange.com/mrl/projects/nose/0.11.1/|nose]], another popular alternative ===== Version control ===== ==== Subversion (SVN) ==== [[http://svnbook.red-bean.com/|SVN book]]; particularly important is the [[http://svnbook.red-bean.com/en/1.1/ch03s05.html|basic work cycle]] A useful and complete one-page [[http://www.addedbytes.com/cheat-sheets/subversion-cheat-sheet/|cheat sheet for SVN]] [[http://subclipse.tigris.org/|subclipse]], SVN plug-in for Eclipse [[http://tortoisesvn.net/|TortoiseSVN]], SVN integration for the Windows Explorer ==== Distributed version control ==== [[http://mercurial.selenic.com/wiki/|Mercurial]] [[http://git-scm.com/|git]] [[http://bazaar-vcs.org/|bazaar]] ====== Object Oriented Programming and Software Design ====== Here is is state pattern example that I talked about: {{ :statepattern.py | State Pattern Example}} Here are a few interesting links about advanced Python OO stuff: * [[http://www.cafepy.com/article/python_types_and_objects/|Python Types and Objects]] * [[http://www.cafepy.com/article/python_attributes_and_methods/|Python Attributes and Methods]] * [[http://www.python.org/download/releases/2.3/mro/|Method Resolution Order]] * [[http://www.ibm.com/developerworks/linux/library/l-cpdecor.html|Decorators]] * [[http://users.rcn.com/python/download/Descriptor.htm|Descriptors]] * [[http://www.artima.com/weblogs/viewpost.jsp?thread=236275|Things to know about super]] To learn more about software design and design patterns you can read some old-school books: * [[http://www.amazon.com/First-Design-Patterns-Elisabeth-Freeman/dp/0596007124/ref=sr_1_1?ie=UTF8&s=books&qid=1251290301&sr=8-1|Head First Design Patterns]] * [[http://www.amazon.com/Design-Patterns-Elements-Reusable-Object-Oriented/dp/0201633612/ref=pd_sim_b_1|Design Patterns: Elements of Reusable Object-Oriented Software]] * [[http://www.amazon.com/Code-Complete-Practical-Handbook-Construction/dp/0735619670/ref=sr_1_1?ie=UTF8&s=books&qid=1251290350&sr=1-1|Code Complete]] And for fun you can also read blogs, like: * [[http://www.joelonsoftware.com|Joel on Software]] * [[http://www.codinghorror.com/blog|Coding Horror]]