PDA

View Full Version : Programming Help


yakumo
12-01-2003, 04:09 PM
as the title suggests, slightly off topic however, its part of my digital media assignment in regards to producing a game.

Anyway I'm pretty much stumped on the question, so if anyone can help, mucho appreciated:

Below are 2 common approaches to writing a computer application:

(a)

Main()
{
int a, b, c etc...

initApplication();

do_something();
read(something);

do somethingElse(something);
write(something);
exit(0);

}


(

WinMain()
{

initApplication();

while(running)
{

getMessage (message);
switch (message.type}
{

case 1: doSomething();
case 2: doSomethingElse();
}

}

}

Question: Both paradigms are still widely used but for different types of application. Consider:

a)A compiler(just the compliler, not the whole IDE)
A photo editing program
c)A classic payroll calculating program

whcih paradigm is likely to work best for each of the above applications and WHY??


thank

Please pm if possible


:cry:

MCronin
12-01-2003, 04:42 PM
Example (a) is a console application that runs striaght ahead beginning to end
Example (b) is a desktop application with a loop that makes the program wait for messages, (user input is sent in these messages).

Obviously you'd want to create the compiler as a console application because a GUI is completely unneccessary and there will be circumstances where you will want to run the compiler outside of a desktop environment. A compiler should not need input from the user other than commandline arguments so writing it as a console application that simply reads files and writes output is the obvious choice.

A Photo Editor will require a GUI so you'd want to write it as a desktop application. A Photo Editor needs to run in a loop waiting for user input, responding to input and then returning to a wait state, until the user exits the application. Wrting it as a desktop app, example (b), is the obvious choice.

A Payroll Calculating System could go either way. You could have a payroll calculator as a commandline applicaion where you invoke it using employee's time sheet(s) as an arguement and it proceeds to calculate payroll. More than likely you would want it done as a desktop application, though, so that the user can manage all the payroll from one application and access all the data real time, rather than having to do time sheets in one program and calculating payroll in another.

yakumo
12-01-2003, 06:45 PM
thank you very much kind sir, l may ask some more questions which l hope you don't mind:applause:

CGTalk Moderation
01-16-2006, 07:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.