[Tinyos-help] TinyOS Design Questions - (Question-1)
Faisal Aslam
aslam at informatik.uni-freiburg.de
Tue Dec 11 05:05:23 PST 2007
Hi,
I wish to discuss few NesC/TinyOS design related issue. I am not aware
if any email list is dedicated to it hence I am sending first one of
them here. I will send more such issue later.
Problem:- In NesC if I have to use a single command of an interface then
I have to implement ALL of its event. Even though, I am not interested
in any one of those events. Those empty functions with nothing in them
make a programmers code cumbersome for no reason. May be you do not find
it a problem but being a programmer I really find it annoying.
Solution:- In object oriented languages, like Java, usually there are
one default implementation of an interface. A programmer extends that
default implementation and only overwrites functions he is interested in.
This save programmer time and make his code simple. However, I know NesC
is not object-oriented and even does not have inheritance concept.
However, I wonder why not NesC compiler while converting code to C can
itself provide bodies for those events that a programmer has not
implemented. It will keep programmer code simple and without those
annoying empty function.
Btw I do not know how the implementation of the events are? If each one
of them is called every time. We should consider using Observer design
pattern. Hence those users who are interested in give event should
"register" and receive it. These are just some preliminary thoughts and
more thoughts could find better solutions but only if you also think
that it is really a problem :)
Faisal
More information about the Tinyos-help
mailing list