Archived

This topic is now archived and is closed to further replies.

wah_on_2

Program design question.

Recommended Posts

wah_on_2    122
I meet a problem about program design. I have 3 programs. program 1 and program 2 are dll. program 3 is an application that will call program 1 and program 2. Error code will return from program 1 and program 2 if those encounted an error. However, program 1 and program 2 are designed separately so the error code may same but different meaning. e.g. Program 1 retrun -10 equal to parameter error. Program 2 return -10 equal to buffer not enough. Program 3 will centralized the display error process in an area depending on the error code. However, the program 3 just know -10 returned, it don''t know what the meaning is, and which dll produce the error. How can i do this smootly and clearly and perfectly? In fact, i have a solution. I can provide an GetLastError() function for each program. When i call the function, it will return the error description so the application do not need to know what the error meaning is. It just call GetLastError() and then display it. So the error code handling will give back to the program, not the application. On the other hand, the error statment will write in a text file for convenient(i can add or modify the statment easier and i may change to different language easier later). So i will have many error text files. One program will have one error text files. It seem dirty. So i want to add all error code in a text file and separated into many areas for different programs. Programmers can modify their error statements directly in the related area. Is this soultion work? Is it a good soultion? What suggest other solution for me for reference? Where can find those materials(program design)? Thx a lot of ^^

Share this post


Link to post
Share on other sites