Coding practices

Posted on March 18, 02008
Filed Under Development, Flash, Journal, Projects

Before we get off on the wrong foot, I don't want to tell you how to write your own code. I just thought it might be useful to explain what I have in mind when I write mine. All artforms have rules and when you understand them you'll know when to break them. My last rule invokes that concession - I trust you'll understand.

It must be modular
In object oriented programming an application is really just a collection of code modules. Each module has its own distinct functionality and tasks to perform. Modules talk to each other using the built in event architecture mentioned in an earlier post. If built correctly this modularity allows code to be reused from project to project.

It must be legible
All code is written to emphasise readability and simplicity. Code is commented liberally. All function names and properties are long enough as to be self explanatory. The only concession to this practice would be where performance is critical. In this case comments will be used to explain what is happening and why.

It must be internally consistent
All code is written to be consistent and easy to follow.

It must be beautiful: a brief admission about semi-colons
Okay, this one is just personal preference but I have seen this discussion split a room in two. For the record:

"I hate those little semi-colons at the end of lines in Actionscript."

There I said it. I know your supposed to use them but the compiler doesn't seem to care (except perhaps inside 'for' loops) and I think they're ugly. If their occasional omission offends you then by all means put them back in - you weird semi-colon-loving freak of nature.

Share/Bookmark

Related Journal Entries

  1. Choosing an Open Source Licence: II
  2. Some thoughts on application architecture
  3. Big History
  4. The project architecture
  5. The Computus Engine on Google Code
  6. Hacking the Date class for GeoLocation
  7. Choosing an Open Source Licence
  8. A review of Temporal Web Standards
  9. Projects update March 2009
  10. Inside the AS3 Date class: Introduction
  11. Choosing an AS3 component framework
  12. The structure of code examples
  13. Building an accurate Timekeeper in AS3: II
  14. Building an accurate Timekeeper in AS3
  15. Project updates April 2009

Comments

Leave a Comment

If you would like to make a comment, please fill out the form below.

Name (required)

Email (required)

Website

Comments