====== Software carpentry: best practices and tools ======
===== Course material =====

Slides of the course:
  *{{:day1-part-1-1-slides.pdf| Part 1.1 Slides}}
  *{{:day1-part-1-2-slides.rev1.pdf| Part 1.2 Slides}}

Exercises: 
  *{{:day1-part-1-exercise.rev2.pdf|Exercises}}
  *{{:debug-exercise.tgz|}}
  *{{:sudoku-exercise.tgz|}}

Checkout url:
  svn checkout --username=$USERNAME https://escher.fuw.edu.pl/svn/python-winterschool/public winterschool

Solution to the exercises:
  *{{:debug_solutions.tgz|}}

{{: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

The classic book about software carpentry: [[http://pragprog.com/titles/tpp/the-pragmatic-programmer | The pragmatic programmer]]

==== Coding standards ====

[[http://www.python.org/dev/peps/pep-0008/|PEP8]], the official Python style guide

[[http://www.logilab.org/857 | pylint ]], tool to check coding standards

==== 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

[[http://rope.sourceforge.net/| rope]], recommended refactoring tool

[[http://bicyclerepair.sourceforge.net/| bicycle repair man]], old and defunct, but worth a mention.

===== 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

[[http://docs.python.org/library/doctest.html | doctest]], write tests inside of docstrings

===== 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 ======

[[http://escher.fuw.edu.pl/pythonschool/raw/day1/afternoon/oo_design.pdf|slides]] | [[http://escher.fuw.edu.pl/pythonschool/raw/day1/afternoon/exercises_day1_partII.pdf|exercise sheet]] | [[http://escher.fuw.edu.pl/pythonschool/raw/day1/afternoon/graph.zip|example solution]]

A nice example for KIS: [[http://norvig.com/spell-correct.html|Peter Norvig's spelling corrector]] in 21 lines of Python.

The state pattern example that I talked about: [[http://escher.fuw.edu.pl/pythonschool/raw/day1/afternoon/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/gp/product/0201485672/ref=s9_simi_gw_p14_t1?pf_rd_m=ATVPDKIKX0DER&pf_rd_s=center-1&pf_rd_r=0Y9GXE4SW806CW13XZM0&pf_rd_t=101&pf_rd_p=51471022&pf_rd_i=507846|Refactoring: Improving the Design of Existing Code]]
  * [[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]]