| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| Hi! What's the recommended practice if a factory cannot return a proper object reference? Throwing an exception or return a null pointer/reference? Or it this a matter of taste simply? -- Best regards, Pi (Ralf Pichocki). |
|
#2
| |||
| |||
| Hi Ralf, > What's the recommended practice if a factory cannot return a proper object > reference? > Throwing an exception or return a null pointer/reference? Or it this a > matter of taste simply? It's a matter of taste, but I recommend throwing an exception since it's cleaner, particularly if you're using an OO language. Thanks, Doug -- Dr. Douglas C. Schmidt Professor and Associate Chair Electrical Engineering and Computer Science TEL: (615) 343-8197 Vanderbilt University WEB: www.dre.vanderbilt.edu/~schmidt Nashville, TN 37203 NET: d.schmidt@vanderbilt.edu |
|
#3
| |||
| |||
| Douglas C. Schmidt wrote: > Hi Ralf, > >> What's the recommended practice if a factory cannot return a proper object >> reference? >> Throwing an exception or return a null pointer/reference? Or it this a >> matter of taste simply? > > It's a matter of taste, but I recommend throwing an exception since > it's cleaner, particularly if you're using an OO language. It also can return more information to the client, like a reason string. -- Jon Biggar Floorboard Software jon@floorboard.com jon@biggar.org |
|
#4
| |||
| |||
| Hi, Doug, hi, Jonathan! Thanks for the both of you - that's what I expected. Wilco. Best regards, Pi (Ralf Pichocki). |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.