Moxy or how do we write community code

2 views
Skip to first unread message

folknology

unread,
Nov 24, 2010, 8:21:10 AM11/24/10
to XCommons Foundation
Ok I will post on this some more a bit later but I would like to start
this thread with a question, how can we build code that can be
modularised so it reusable for the community. Clearly if we create a
commons of code it would be nice for it to operate together in a
harmonious way, we would also like it to be good quality and perhaps
conform to certain design principles. Often tests are used to
determine a bar before code can be contributed, that's slightly
Neanderthal but it would be nice to at least have some guides on how
the code should be structured and measured.

I wrote a small piece of code to demonstrate traffic light operation
whilst trying to explain to my kids that computers are not just about
Facebook pages ;-)

I used a simple Biled (2 leds inversely wired in parallel) as the
traffic light driven by 2 PNP inverters (one by the other). So please
don't judge me on this code it was quick and dirty!

https://gist.github.com/713631

So above is a simple module of code written in XC and here are a few
questions about it:

1) How do we test this code, could unit tests be of value, if so how
would they work
2) Is the code structured enough.
3) How would this code fit into a library of modules
4) What improvements would make it better from a community
perspective.

The interesting thing is not the the code quality itself because it
leaves a lot to be desired, rather its how one goes about making it
better. Also the example shows how difficult a Unit test approach
would be in quantifying such code.

More importantly to me was how I knocked this code up and I will talk
about that later as that in itself is very revealing.

Thoughts?

Reply all
Reply to author
Forward
0 new messages