need thoughts on my interview question - .net, c#

Posted by uno on Stack Overflow See other posts from Stack Overflow or by uno
Published on 2010-03-25T02:12:31Z Indexed on 2010/03/25 2:23 UTC
Read the original article Hit count: 422

Filed under:
|
|

One of the questions I was asked was that I have a database table with following columns

pid - unique identifier
orderid - varchar(20)
documentid - int 
documentpath - varchar(250)
currentLocation - varchar(250)
newlocation - varchar(250)
status - varchar(15)

I have to write a c# app to move the files from currentlocation to newlocation and update status column as either 'SUCCESS' or 'FAILURE'.

This was my answer

  1. Create a List of all the records using linq

  2. Create a command object which would be perform moving files

  3. using foreach, invoke a delegate to move the files -

  4. use endinvoke to capture any exception and update the db accordingly

I was told that command pattern and delegate did not fit the bill here - i was aksed to think and implement a more favorable GoF pattern.

Not sure what they were looking for - In this day and age, do candidates keep a lot of info on head as one always has google to find any answer and come up with solution.

© Stack Overflow or respective owner

Related posts about .NET

Related posts about c#