Pyli/Programming Conventions

From Jonathan Gardner's Tech Wiki
Jump to: navigation, search

Write Lucid Code

Try to write in a lucid, easy-to-read style. There are no expert pyli programmers, and there should be no opaque code. Use as much of the default built-ins and libraries as you can.

Pyli should make writing hard-to-read code hard. The natural way should be the easy-to-read way. I really like Python for this.

Don't Code Defensively

Rather than check for possible error conditions, allow the conditions to be signalled and handle it appropriately.

Duck Typing

Don't go look for an object's type (it doesn't exist). If it does what you need, that should be good enough. And don't test for functionality, just do it and see if it raises a condition. Usually, these conditions are meaningful to the caller, since they supplied the item and the item wasn't functional.

Serial Programming

Instead of programming in a parallel or an asynchronous way, program serially. Make parallel and asynchronous operations happen with microthreading.