News for hackers. Stuff that matters.

curiouskevin

Help please: Learning developer's confusion on texting

imagine there is function which does something like this.function someFunc(arguments, callback) { // some kind of I/O operation. someAsyncFunction([args. . . ], function(err, res) { // do some processing on the data. callback(null, attemptingNick); }); }How do you write tests for this? If I try and write things inside callback in a separate functions then functions get really tiny.

( Read More... | no comments | on HN )
I am aware of Big-O notations. For me its just about execution time of an algorithm. I thought it might be possible to calculate it by may be multiplying a bunch of constants.

For instance an algorithm has complexity of O(n).

And input size of 10^6. may be with the number of operations a typical personal computer can perform, we calculate in terms of seconds/milli seconds for a given input.

Well, kind of a very vague numbers I guess... Not trying to get exact numbers. Just curious.