views:

453

answers:

4

Charles Simonyi introduced the idea of "organizing really big software teams by creating one super duper uber programmer writing the top-level functions, while handing off the implementation of the lower-level functions to a team of grunt junior-programmers as needed. They called this position program manager."

I want to know what are the Top-level functions, and how can I identify it? My language is Javascript. So far that's the only language I know hence please give me examples using JavaScript please.

BTW, the quote above is taken from Joel Spolsky. Check out his blog and read How to be a program manager.

Thanks

+5  A: 

The closer it is to human language, the higher-level the function is.

The closer it is to machine language, the lower-level the function is.

I'm simplyfying but here are some examples:

High level functions:

Car.Start()
Car.MoveTo(Home)

Low level functions:

Car.Insert(Key);
if (Car.IsKeyInserted() == False)
   return False;

Car.StartEngine();
Car.ApplyAccelerator(0.1f);
Car.ChangeGear();
Car.RotateWheel(-25);
MrValdez
A: 

Simple question could be answered in just a few words but the underlying subject covers entire books. However is is not related to Javascript per say, just that Javascript could be used to create the functions.

Mr Valdez is right though.. it all depends on the level of abstraction your function defines.

There are other approach to software desing and architecture look em up

This one has a section that answer your question quite nicely

This page discuss the subject with a broader perspective

Newtopian
A: 

When we talk about "high level" and "low level" in programming it's usually referring to the level of abstraction. A high level function is one which abstracts away the details, here's an example of a high level abstraction:

$('div#foo p').show('fast');

That snippet is from the jQuery JavaScript framework, it demonstrates a very complicated task but enables you to initiate it very easily. A lower level abstraction would be something like this:

$('div#foo p').animate({height: 'show', width: 'show', opacity: 1}, 200);

It's still jQuery but more details are being involved, it's lower level. Of course, you can get even lower:

animate(document.getElementById('foo').getElementsByTagName('p'), {
    height: 300, width: 600, opacity: 1, alphaFilter: 1
}, 200);

(using a custom built animate method)

Etc. etc.

The optimum level of abstraction is always under heavy debate. Going too high can cause an abstraction leak but going to low can be inefficient and a waste of time, especially if higher abstractions exist.

J-P
A: 

This refers to how far down the call stack the function is located. When a program starts, the operating system calls the main() or top level, which consists of calls to the next lower level functions. Each in turn calls other functions to do more basic tasks, which end up calling functions in operating system eg to open a file. The low level functions are the functions in your program which don't call any other functions that you have written (but use the operating system or framework to compute their results etc).

Martin