[dba-VB] Just looking for a consensus

jwcolby jwcolby at colbyconsulting.com
Fri Apr 13 08:14:03 CDT 2012


Thanks Shamil,

I have a class which I call clsFlag which allows me to write to the flag and the flag writes through 
to SQL Server.  In fact the Flag handles several data types but it allows me to initialize it such 
that I can write a boolean and the flag class translates that into now() - this instant date / time 
which is what gets written to SQL Server.  When it reads a data it translates any date value other 
than the framework's "mindate to a true and minDate to a false.  Thus these actual values (flags) in 
SQL Server is always a date but to my program they are a bool (for decision making).

I have a pair of classes (Supervisor and Process which have just a ton of fields written to 
asynchronously by processes occurring as I validate addresses.  clsSupervisor and clsProcess load 
these records (the flag fields) into instances of these flag classes which are then stored in a 
collection in clsFlagSupervisor.  Thus as clsSupervisor or clsProcess do anything they can just 
update their flag and the flag writes it through to SQL Server.  I designed the error flags to be a 
pair of fields - an ErrDate and a ErrMsg varchar(4000).

I was writing to the ErrMsg flag and then the ErrDate flag.  I have refactored the properties which 
handle the message to call through to the associated ErrDate property to set the ErrDate if I write 
to the ErrMsg property.  That is done in clsSupervisor and clsProcess though, where I define these 
properties.

John W. Colby
Colby Consulting

Reality is what refuses to go away
when you do not believe in it

On 4/13/2012 7:17 AM, Salakhetdinov Shamil wrote:
> Hi John --
>
>> Your thoughts?
> Not mine actually, but I'm trying to follow the same principles/approach in my everyday software development work:
>
> “The cleanest solution with the fewest moving parts as possible".
>
> (Source: http://techcrunch.com/2012/04/12/how-to-scale-a-1-billion-startup-a-guide-from-instagram-co-founder-mike-krieger/?grcc=33333Z98ZtrendingZ0 )
>
> Applied for you case I'd write today (tomorrow I could write it differently - depending on tomorrow's context):
>
> public DateTime Err { get; private set; }
> public string ErrMsg { get; private set; }
> public void SetErrorInfo(string errMsg, DateTime? errorTimeStamp = null)
> {
>      this.Err = errorTimeStamp??DateTime.Now;
>      this.ErrMsg = errMsg;
> }
>
> or
>
> public ErrInfo() { }
> public DateTime Err { get; private set; }
> public string ErrMsg { get; private set; }
> public ErrInfo SetErrorInfo(string errMsg, DateTime? errorTimeStamp = null)
> {
>      this.Err = errorTimeStamp??DateTime.Now;
>      this.ErrMsg = errMsg;
>      return this;
> }
>
> The latter code can be used to create error information object and to set its properties in one code line:
>
> ErrInfo err = (new ErrInfo()).SetErrorInfo("My Error information");
>
> or
>
> ErrInfo err = (new ErrInfo()).SetErrorInfo("My Error information", new DateTime(2012,1,3));
>
>
> And I do not expect to get into consensus for this solution here ;)
>
> Thank you.
>
> -- Shamil
>
>
> Thu, 12 Apr 2012 10:23:45 -0400 от jwcolby<jwcolby at colbyconsulting.com>:
>> I have pairs of flags and methods to set/get those flags, an Err and ErrMsg.  Err is the date/time
>> and ErrMsg is the message.
>>
>> It seems appropriate to call Err from ErrMsg, i.e. if I set an error message, have that property
>> call the Err property to set the date / time as well.
>>
>> As it is I call two properties, one to set the date / time and the other to save the error message.
>>
>> Your thoughts?
>>
>> --
>> John W. Colby
>> Colby Consulting
>>
>> Reality is what refuses to go away
>> when you do not believe in it
>>
>> _______________________________________________
>> dba-VB mailing list
>> dba-VB at databaseadvisors.com
>> http://databaseadvisors.com/mailman/listinfo/dba-vb
>> http://www.databaseadvisors.com
>>
>>
>
> _______________________________________________
> dba-VB mailing list
> dba-VB at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/dba-vb
> http://www.databaseadvisors.com
>



More information about the dba-VB mailing list