[Ns-developers] ns-3, code readability issues

Gustavo Carneiro gjcarneiro at gmail.com
Wed Oct 18 11:10:15 PDT 2006


  I was looking at an ns-3 example, trying to learn about callbacks and
templates, and I saw this code:

    Simulator::Schedule (Time::RelS (10.0),
                         &MyModel::DealWithEvent,
                         this, Simulator::Now ().S ());

   Now I know that "Simulator::Now ().S ()" means "current simulation time
in seconds", but it took me a while to understand that cryptic code.  I have
two issues with this:
   1. a method called 'S' in any class is just plain cruel; please rename to
'Seconds' or something similarly more descriptive.  Other methods in the
same class are almost as cryptic, like Us, Ns, and methods ending with these
names.

   2. I dislike putting a space betweeen method name and the (braces).  But
I guess this is a matter of personal taste, so feel free to ignore me in
this :P

-- 
Gustavo J. A. M. Carneiro
"The universe is always one step beyond logic."


More information about the Ns-developers mailing list