Re: Confused about OOP programming!
phil paxton <[email protected]>
| Newsgroups | gmane.comp.windows.devel.dotnet.winforms |
|---|---|
| Message-ID | <[email protected]> |
On 3/29/07, Steve Abaffy <[email protected]> wrote: > It might be that I just don't understand something here, but it seems to me > there is a problem. Back in the days it was a big rule to use global > variables as little as possible. However this is what I see. On a windows > form I have a open file button so in code I have <snip> > Now the problem I see here is that I am open and closing the same file > twice. > I can of course get around this problem by using a global InputExcelObj but > that seems to violate the do not use global variable rule. <snip> This is why so many ASP apps (regardless of the coded language) behave poorly. Lots of well-meaning people saw an open+close occurring with a database connection -- many times. They thought they'd found a secret method to increase performance via bypassing the repetitive steps, stashing database objects into Session() variables. Performance would lag to the point where people thought they didn't have enough memory or horsepower and would compensate, or worse, buy new hardware. They'd finally ask for help or think ASP was the wrong paradigm to use. The easiest thing to do when you looked at someone server for the first time would be to grep "Set Session" and see how many hits would be returned. It wasn't far-fetched to see one open & one close: open it when the code started, close it when done. It was|is probably the worst thing, but passive coding or a "pachinko" technique wasn't far behind...at least in terms of coding & debugging. Wait. Let me correct that. Nested #includes. I found a site which had 20'000 lines of code to be analyzed because #include references were nested at least six deep in various places, some including files previously picked up via another #include. It took the guy six+ months to get it to work (sort of). It took 4 weeks to undo it and halt the constant purchase of high-end servers every time there was a performance issue. The bottom line is: do what you've done (ask). Something most people didn't do when they found a winning lottery ticket and didn't want to share it with anyone else. (or they didn't want someone else at their site to find out what was happening) p