If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#231
|
|||
|
|||
"It works well enough" (was $640.00 to fill the tanks...)
Oh, so you are one who blames poor workmanship on the tools.
I'm not talking about workmanship at all. I'm talking about systemic results. Imagine spending $300,000 to redo a house. Chances are pretty good you'd gut it and start over and get exactly what you want. But if you had to live in the house at the same time, and didn't know how much you had to spend, chances are you'd do it piecemeal, and each piece would have to fit the existing work. This limits your choices at each step of the way (you can't get this refrigerator because it won't fit between the two counters, and now you get the counter that works with the refrigerator you settled on... Now, if you have a choice, and the pain of living in the house is not too great, and the compromises you have to live with aren't too big, you might just do it piecemeal anyway, rather than move out for eight months. You'd get a result that's not as good, but it's "good enough". And often, that's good enough. Jose -- The monkey turns the crank and thinks he's making the music. for Email, make the obvious change in the address. |
#232
|
|||
|
|||
$640.00 to fill the tanks...
On Sun, 27 Aug 2006 06:06:51 -0400, Roger
wrote: Spaghetti code? With the introductory courses were allowed the grand total of *one* goto statement or its equivalent per program. In higher level we needed to have a good explanation if we used even one. I still have some 'C' library routines that I have written and carry around with me from project to project that have 'goto's in them... They are hidden withing macros, so they at least *look* like structured coding techniques, but inside it all, there are 'goto's there... The provide a single exit point from a function with the capability to perform certain operations at this exit point... It really cleans up the code in certain situations... Here's an example of how they're used: int MyFunction( char *fileName ) { int fl = NULL; char bufferSize = 1024; char *buffer = NULL; BEGIN("MyFunction"); /* Ensure input parameters are good */ if (fileName == NULL) RETURN(ERR_InvalidArg); /* Dynamically allocate data structures */ buffer = malloc(bufferSize); if (buffer == NULL) RETURN(ERR_MemoryAllocationFailure); /* Open the input file */ fl = fopen(fileName, "r"); if (fl == NULL) RETURN(ERR_CouldNotOpenFile); /* Process the input file */ while (fgets(fl, buffer, bufferSize) != NULL) { /* Do some processing on the string read */ } RETURN(0); ON_EXIT { if (buffer != NULL) free(buffer); if (fl != NULL) fclose(fl); return (retCode); } } The 'BEGIN' macro looks like this: #define BEGIN(x) int retCode; char *fnName = x; The 'RETURN' macro looks like this: #define RETURN(x) { retCode = x; goto ExitFunction; } The 'ON_EXIT' macro looks like this: #define ON_EXIT goto ExitFunction; Yeah, it could be done with a lot of nested conditionals, but in my opinion, this ends up cleaner, especially where you have a lot of things that need to be checked... Adding a new thing that needs to be checked usually just requires the addition of the instantiation / allocation / setup portion of it in addition to putting a possible cleanup portion for it in the ON_EXIT section... This was created in the days before C++ and as such, it even works on all the old compilers that we sometimes encounter on projects... |
#233
|
|||
|
|||
"It works well enough" (was $640.00 to fill the tanks...)
Jose wrote:
Oh, so you are one who blames poor workmanship on the tools. I'm not talking about workmanship at all. I'm talking about systemic results. Imagine spending $300,000 to redo a house. Chances are pretty good you'd gut it and start over and get exactly what you want. But if you had to live in the house at the same time, and didn't know how much you had to spend, chances are you'd do it piecemeal, and each piece would have to fit the existing work. This limits your choices at each step of the way (you can't get this refrigerator because it won't fit between the two counters, and now you get the counter that works with the refrigerator you settled on... Now, if you have a choice, and the pain of living in the house is not too great, and the compromises you have to live with aren't too big, you might just do it piecemeal anyway, rather than move out for eight months. You'd get a result that's not as good, but it's "good enough". And often, that's good enough. Incrementally building a system isn't the same as spaghetti code which is what you were railing against and blaming on a language. The language didn't create the spaghetti code, the programmer did. Very clear code can be written in assembly language and very convoluted code can be written in Pascal, Ada or Cobol. It isn't a language issue, it is a programmer issue. Matt |
#234
|
|||
|
|||
"It works well enough" (was $640.00 to fill the tanks...)
Incrementally building a system isn't the same as spaghetti code which is what you were railing against and blaming on a language.
Well, I said that FORTRAN (and HTML) have set {field} back ten years. It was hyperbole, of course, but the fact that FORTRAN and HTML were "good enough" reduced the incentive to develop better tools. Tools do act as a limitation, and they do help define the landscape. My rail was against the landscape, not against individual projects. Jose -- The monkey turns the crank and thinks he's making the music. for Email, make the obvious change in the address. |
#235
|
|||
|
|||
"It works well enough" (was $640.00 to fill the tanks...)
On Sun, 27 Aug 2006 19:02:45 GMT, Jose
wrote: Well, I said that FORTRAN (and HTML) have set {field} back ten years. It was hyperbole, of course, but the fact that FORTRAN and HTML were "good enough" reduced the incentive to develop better tools. Tools do act as a limitation, and they do help define the landscape. HTML was OK as it was originally designed -- as a markup mechanism for text... What we've done with it since is ridiculous... Personally, I would have preferred to have seen X-Windows or even DisplayPostScript adopted, but oh well, such is life... A better technical solution is not always the one that gets selected... |
#236
|
|||
|
|||
$640.00 to fill the tanks...
On Sun, 27 Aug 2006 16:39:13 GMT, Grumman-581
wrote: snip while (fgets(fl, buffer, bufferSize) != NULL) { Ooops... Change that to: while (fgets(buffer, bufferSize, fl) != NULL) { |
#237
|
|||
|
|||
"It works well enough" (was $640.00 to fill the tanks...)
Grumman-581 wrote:
On Sun, 27 Aug 2006 19:02:45 GMT, Jose wrote: Well, I said that FORTRAN (and HTML) have set {field} back ten years. It was hyperbole, of course, but the fact that FORTRAN and HTML were "good enough" reduced the incentive to develop better tools. Tools do act as a limitation, and they do help define the landscape. HTML was OK as it was originally designed -- as a markup mechanism for text... What we've done with it since is ridiculous... Personally, I would have preferred to have seen X-Windows or even DisplayPostScript adopted, but oh well, such is life... A better technical solution is not always the one that gets selected... That still doesn't constitute setting back the field ten years. These didn't provide less capability than was already present so they didn't set anything back. They may have slowed progress, but that isn't the same as a setback. I'm not sure Jose knows what it means to set something back. Matt |
#238
|
|||
|
|||
"It works well enough" (was $640.00 to fill the tanks...)
HTML was OK as it was originally designed
So was FORTRAN. But the world moved on, and we stayed with HTML, to our enternal consternation. Personally, I would have preferred to have seen X-Windows or even DisplayPostScript Remember it's not (and should not be) a formatting language, since it can't buy me a new monitor. But the tags thing is just so... there aren't polite words for it. A better technical solution is not always the one that gets selected. Often because the thing that it's better for isn't thought to be worth devoting time to... and then that turns out to be an error.. too late. Jose -- The monkey turns the crank and thinks he's making the music. for Email, make the obvious change in the address. |
#239
|
|||
|
|||
"It works well enough" (was $640.00 to fill the tanks...)
I'm not sure Jose knows what it means to set something back.
1: It's hyperbole. 2: Had we started out slower, but gotten a better {whatever} to begin with, we'd be further ahead today, and it would be easier to make progress. Ten years? Well, maybe. Jose -- The monkey turns the crank and thinks he's making the music. for Email, make the obvious change in the address. |
#240
|
|||
|
|||
$640.00 to fill the tanks...
Ooops... Change that to:
while (fgets(buffer, bufferSize, fl) != NULL) { Too late. You just ate your tail, half the operating system, and all the virtual memory in the next three computers over. Jose -- The monkey turns the crank and thinks he's making the music. for Email, make the obvious change in the address. |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Flt. 800 Anniversay: Exploding Fuel Tanks STILL In Airline Planes!!! | Free Speaker | General Aviation | 3 | July 24th 06 06:06 PM |
Exposed Electrical Wires in Boeing 737 Fuel Tanks! | Larry Dighera | Piloting | 0 | July 17th 06 06:13 PM |
Fuel Tanks C172 | [email protected] | Owning | 1 | May 2nd 06 05:45 AM |
F-104 in Viet Nam Question | Don Harstad | Military Aviation | 2 | August 28th 04 08:40 AM |
Long-range Spitfires and daylight Bomber Command raids (was: #1 Jet of World War II) | The Revolution Will Not Be Televised | Military Aviation | 20 | August 27th 03 09:14 AM |