Click here to Skip to main content
15,905,508 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: How much code is too much? Pin
honey the codewitch9-Jan-20 21:10
mvahoney the codewitch9-Jan-20 21:10 
AnswerRe: How much code is too much? Pin
KarstenK9-Jan-20 20:38
mveKarstenK9-Jan-20 20:38 
GeneralRe: How much code is too much? Pin
honey the codewitch9-Jan-20 21:09
mvahoney the codewitch9-Jan-20 21:09 
AnswerRe: How much code is too much? Pin
Jon McKee9-Jan-20 20:44
professionalJon McKee9-Jan-20 20:44 
GeneralRe: How much code is too much? Pin
honey the codewitch9-Jan-20 21:08
mvahoney the codewitch9-Jan-20 21:08 
GeneralRe: How much code is too much? Pin
Jon McKee9-Jan-20 22:03
professionalJon McKee9-Jan-20 22:03 
GeneralRe: How much code is too much? Pin
honey the codewitch9-Jan-20 22:31
mvahoney the codewitch9-Jan-20 22:31 
GeneralRe: How much code is too much? Pin
Jon McKee9-Jan-20 23:18
professionalJon McKee9-Jan-20 23:18 
Something like that, yea. I'm creating a delegate for a type that constructs it and all of it's dependencies. I'm trying to write the data input/"parser" layer very generically so it can support a lot of cases, but the original idea related to parsing would be something like:
C#
class User {
    [OverrideMethodBind(Method = "Add")]
    [OverrideParameterBind(Type = typeof(Address))]
    List<Address> addresses;
    [DataBind]
    string firstName;
    [DataBind(ID = "LN")]
    string lastName;
}
class Address {
    [DataBind(ID = "street")]
    string streetAddress;
    string city;
    [DataBind]
    StateAbbrev state;
    int zipCode;
}
enum StateAbbrev {
    AL,
    WA,
    MI,
    //etc....
}
In this example you want to create the object based on (state, streetAddress)+ (i.e. one or more times), firstName, and lastName from the data.

You can add metadata to the items of interest, supply "parsers" for various members (based on whatever condition you want - type, member, or ID), and it uses the data to then create (possibly many) Users based on that data. Removes the need for boilerplate related to loading a domain object with parsing results or whatever your data source is (another object, database, etc). So instead of writing something like:
C#
MatchCollection results = regex.Matches(/* some input*/);
User u = new User(results["firstName"], results["LN"]);
//this also only deals with a single address
Address a = new Address(results["street"], results["state"]);
u.addresses.Add(a);
You'd write:
C#
ObjectGenerator g = new ObjectGenerator<User>().AddParser(regex);
//or
ObjectGenerator g = new ObjectGenerator(typeof(User)).AddParser(regex);

User user = g.GenerateObject(/* some input*/);
//or
User[] users = g.GenerateObjects(/* some input*/);
Not a finalized interface but that's the jist of it.
GeneralRe: How much code is too much? Pin
honey the codewitch9-Jan-20 23:22
mvahoney the codewitch9-Jan-20 23:22 
GeneralRe: How much code is too much? Pin
Jon McKee9-Jan-20 23:35
professionalJon McKee9-Jan-20 23:35 
GeneralRe: How much code is too much? Pin
honey the codewitch10-Jan-20 2:57
mvahoney the codewitch10-Jan-20 2:57 
GeneralRe: How much code is too much? Pin
Jon McKee10-Jan-20 1:00
professionalJon McKee10-Jan-20 1:00 
GeneralRe: How much code is too much? Pin
honey the codewitch10-Jan-20 2:55
mvahoney the codewitch10-Jan-20 2:55 
AnswerRe: How much code is too much? Pin
Daniel Pfeffer9-Jan-20 21:33
professionalDaniel Pfeffer9-Jan-20 21:33 
GeneralRe: How much code is too much? Pin
honey the codewitch9-Jan-20 21:39
mvahoney the codewitch9-Jan-20 21:39 
GeneralRe: How much code is too much? Pin
jsc429-Jan-20 23:29
professionaljsc429-Jan-20 23:29 
GeneralRe: How much code is too much? Pin
musefan9-Jan-20 23:59
musefan9-Jan-20 23:59 
GeneralRe: How much code is too much? Pin
jsc4210-Jan-20 6:46
professionaljsc4210-Jan-20 6:46 
GeneralRe: How much code is too much? Pin
musefan12-Jan-20 21:35
musefan12-Jan-20 21:35 
QuestionWindows 10 activation woes (after hardware upgrade) Pin
Maximilien9-Jan-20 11:59
Maximilien9-Jan-20 11:59 
AnswerRe: Windows 10 activation woes (after hardware upgrade) Pin
PIEBALDconsult9-Jan-20 12:23
mvePIEBALDconsult9-Jan-20 12:23 
AnswerRe: Windows 10 activation woes (after hardware upgrade) Pin
Ravi Bhavnani9-Jan-20 12:53
professionalRavi Bhavnani9-Jan-20 12:53 
AnswerRe: Windows 10 activation woes (after hardware upgrade) Pin
Ron Anders9-Jan-20 15:43
Ron Anders9-Jan-20 15:43 
AnswerRe: Windows 10 activation woes (after hardware upgrade) Pin
OriginalGriff9-Jan-20 19:50
mveOriginalGriff9-Jan-20 19:50 
AnswerRe: Windows 10 activation woes (after hardware upgrade) Pin
Jacquers9-Jan-20 20:05
Jacquers9-Jan-20 20:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.