Pragmatic Programming

From Interactive System for Ice sheet Simulation
Jump to: navigation, search

The following is a list of example-led tutorials which will be used to provide an engineering framework, upon which scientific programming can be profitably overlaid.

Thread1: Fortran and python programming
  1. Fortran1: Fortran for beginners. This is friendly introduction to Fortran and will guide you from writing your first program through to using more advanced data-types, such as arrays. Along the way, you will encounter Fortran's intrinsic data types, logic such as conditionals and loops, program structure and subroutines all the while providing pointers to good style and bug avoidance techniques.
  2. If you are already familiar with another language, such as C or Matlab, you may find it easier to study examples of how to preform common tasks in Fortran. Fortran:Examples provides numerous good examples covering topics through advanced features of Fortran 95.
  3. Fortran2: Intermediate Fortran. This tutorial follows on from Fortran1 and introduces features from Fortran90 which help us to write better, more maintainable programs. The topics covered include; dynamic memory allocation using allocatable arrays; flexible and easily extensible data-types through the use of user-derived types; enhanced modularity, encapsulation and error checking provided by modules. Linking your program to third party libraries is also covered, using NetCDF as an example.
  4. Should you wish to go further Numerics, Profiling and Debugging provide examples of common numerical programming gotchas; tips to help you find and improve any slow running regions of your program; and hints and tips for avoiding, finding and correcting any bugs that find their way into your code.
  5. An introduction to Python and the numpy package guides you through some first steps with python and highlights some of the very useful data manipulation and visualisation tools on offer. The examples will focus on data held in 2-dimensional arrays.
  6. Combining high level with low level programming languages: f2py example
  7. Polyglot offers some concrete examples of mixed Fortran and C programming, including the new Fortran2003 interoperability features. Mixed language programming provide huge time-savings if you have access to, say, a third party library of routines written in C which you would like to make use of inside your existing Fortran project.
  8. A sample program of how you can run your model including much of the stuff discussed here How_to_make_a_model
Thread2: Tools for Managing your Code and your Project
  1. The Subversion version control system is fantastic tool for collaborating, debugging, disaster recovery and, well, general sanity preservation!. This tutorial gives you hands on practice for all the essential features.
  2. Project building using Make guides you step-by-step through the otherwise opaque magic of Makefiles and highlights how they can be brought into service not only for code compilation, but also for automatic documentation creation and program testing. The combination of Subversion and Make opens the door to a nightly build for your project--a proven way to catch and correct bugs.
  3. Editors: Basic Emacs Usage
Extra material