Let me better define my Status object. It would be used to handle displaying
messages to the user in a universal format in a GUI instead of having error
that should be reported to the user going like:

if( error = type1 ) then
	MyFrame.myTextField.text = "error of type one. you can't do that."
elsif( error = type2 )then
	MyFrame.myOthrTextField.text ="error of type two. you can't do that."
elsif
	etc...
end

I am suggeting to use a Singleton Status object handle this so you could jut
say:

if( error ) then
	UIStatus.setErrorCode( 1 );
	UIStatus.setMessage( "error here" );
elsif( warning ) then
	UIStatus.setErrorCode( 2 );
	UIStatus.seMessage( "this is a warning...don't do that!" );
end

The prototype for this is in Ruby, the actual program is in a scripting
language that doesn't have exceptions, Flash ActionScript.

I have been reading and rereadin the Design Patterns book and the
Refactoring book published by Addison Wesley and I am trying to properly
patterns where they "make sense". Does my definition of the staus object fit
the need for a Singleton?

I am thinking yes, but looking for more input. Thanks for responding.

Zach

-----Original Message-----
From: Dick Davies [mailto:rasputnik / hellooperator.net]
Sent: Wednesday, May 26, 2004 3:53 PM
To: ruby-talk ML
Subject: Re: Design Question


> "Zach Dennis" <zdennis / mktec.com> writes:

>>Is my StatusSingleton overkill? I am trying to consolidate error
information
>>into one class. What do you think?


This reminds me of errno in C. You'll find your program becomes

line_of_program
if error() {
handle it
}
another_line
if error() {
handle it
}
third_line
..
..
..

As David said, you may find Exceptions help to keep your code cleaner.
See the PickAxe chapter on them.

Cheers

Dick ( who spent this week writing modperl auth handlers to hook DAV
  to NetWare and *really* wishes Perl had built-in exceptions).


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.684 / Virus Database: 446 - Release Date: 5/13/2004

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.684 / Virus Database: 446 - Release Date: 5/13/2004