[dba-VB] Just looking for a consensus

Salakhetdinov Shamil mcp2004 at mail.ru
Fri Apr 13 06:17:21 CDT 2012


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
> 
> 



More information about the dba-VB mailing list