Your opinion please

D

Dave Sexton

Hi Lucian,
What you wrote merely provides a way for the code to determine whether
the user *NEEDED* to be prompted, past tense, at some earlier point in
time. It doesn't say whether the user needs to be prompted at the time
the Open() call is made.

In most real-world scenarios, it does. It's not unreasonable to design your
application so that it may connect to multiple databases and choose which
databases require credentials up front, prompting the user for them at
runtime or choosing from a preconfigured set. If the application is
designed in a way that allows an administrator to change whether credentials
are required while the application is executing, a simple try..catch would
suffice.

And again, library code is different since you may want to provide calling
code with a way to determine whether credentials are required, once when the
application starts, and delay connection until a call to Open() is required.
This way, you're not prompting the user for credentials each time a
connection is required.

This gives the architect the ability to choose the best approach for the
application.
No, I'd prefer the alternative that I did post.

A while loop is overkill, IMO.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top