Synchronizer for importing XML files into a database when folder content changesAbstract Factory ExperimentLoading card data from XML fileFactory dependency injectorXML/HTML Read/WriteGenerating Settings Objects from Database via Factory ClassMerging multiple app.config filesObject-relational mapper for VBA / MS-AccessXML Input Parser To Load Test Data into Dev DatabaseRepository + Unit Of Work Pattern in WebAPIDynamically Generating XML Deserialization Classes / Code: Part I, Reading

What kind of floor tile is this?

C++ copy constructor called at return

What does Apple's new App Store requirement mean

Is this toilet slogan correct usage of the English language?

Do we have to expect a queue for the shuttle from Watford Junction to Harry Potter Studio?

I found an audio circuit and I built it just fine, but I find it a bit too quiet. How do I amplify the output so that it is a bit louder?

A Trivial Diagnosis

Are Captain Marvel's powers affected by Thanos breaking the Tesseract and claiming the stone?

How much theory knowledge is actually used while playing?

Why do Radio Buttons not fill the entire outer circle?

Shouldn’t conservatives embrace universal basic income?

Why is the "ls" command showing permissions of files in a FAT32 partition?

Did the UK lift the requirement for registering SIM cards?

Multiplicative persistence

What fields between the rationals and the reals allow a good notion of 2D distance?

The Digit Triangles

How do you make your own symbol when Detexify fails?

How can ping know if my host is down

Why Shazam when there is already Superman?

What is the English pronunciation of "pain au chocolat"?

Short story about a deaf man, who cuts people tongues

Change the color of a single dot in `ddot` symbol

What is the difference between lands and mana?

Showing a sum is positive



Synchronizer for importing XML files into a database when folder content changes


Abstract Factory ExperimentLoading card data from XML fileFactory dependency injectorXML/HTML Read/WriteGenerating Settings Objects from Database via Factory ClassMerging multiple app.config filesObject-relational mapper for VBA / MS-AccessXML Input Parser To Load Test Data into Dev DatabaseRepository + Unit Of Work Pattern in WebAPIDynamically Generating XML Deserialization Classes / Code: Part I, Reading













1












$begingroup$


I have created a Synchronizer, the purpose of which is to read data from an XML source file and store the result in a DB.



I have different source types, for example Student.XML, School.XML, etc. These files are copied in my source directory, C:Source.



My Synchronizer watches the Source folder, and every time there is a new file, it should read it, map it to my domain class and write the domain class into the DB.



If C:Source folder contains Student.XML, it should read the content of the XML file and copy it in Student Table in the DB. If C:Source contains School.XML, it should read the file and copy the content to School Table.



To solve this, I have defined an ISyncer interface:



public interface ISyncer

// Read input and synchronize destination, return error message if any
string Sync();



Now all my Syncer types (e.g. StudentSyncer, SchoolSyncer, etc) should implement this interface:



public class StudentSyncer : ISyncer

// simple XML reader, reads XML file into a list of List<XMLStudent>
private XMLStudentReader _reader;

public StudentSyncer(string file)

_reader = new XMLStudentReader(file);


public string Sync()

// read the input
List<XMLStudent> source = _reader.ReadAll();

// using automapper map to domain object
List<Student> dbStudent = Mapper.Map<List<XMLStudent>, List<Student>>(source);
dbStudent.ForEach(s => s.IsCurrent = true); // set IsCurrent

// write records to Student table, using Unit of Work patterns
using (var context = new DbContext())

UnitOfWork uow = new UnitOfWork(context);

// set the existing records to not current
var curSet = uow.Student.FindByTrackingChanges(s => s.IsCurrent == true).ToList();
curSet.ForEach(s => s.IsCurrent = false);
uow.Student.AddRange(dbStudent);
uow.SaveChanges();


return ""; // no error




I have a Windows service, which calls the DoSync() method every 30 seconds:



public void DoSync()

foreach (string file in Directory.EnumerateFiles(@"C:Source", "*.xml"))

// use syncer factory to initialize the correct instance of syncer based on input file name
ISyncer syncer = _syncerFactory.CreateInstance(file);

// do the synchronization task
syncer.Sync();

// Move file to processed folder
MoveFile(@"C:Destination");




The Factory is a simple factory. It reads the source file name, e.g. Student.XML, School.XML and based on the file name. It initializes the correct Syncer, e.g. StudentSyncer, SchoolSyncer.



I am happy with the code, but it is bothering me because I feel it is not following the Single Responsibility Principle. My Syncer class is not doing 1 task, but it is doing 3 tasks: read input, map to domain class, write to DB.










share|improve this question











$endgroup$











  • $begingroup$
    Synchronizer should watch the Source folder - where is the code that does that? Have you removed anything?
    $endgroup$
    – t3chb0t
    Jun 22 '18 at 9:42










  • $begingroup$
    @t3chb0t, thanks. It's a Windows event handler which calls DoSync () every 30 seconds. I did not include that part of the code in the review as I thought it's straight forward ... can add it, if it is necessary.
    $endgroup$
    – Hooman Bahreini
    Jun 22 '18 at 9:50















1












$begingroup$


I have created a Synchronizer, the purpose of which is to read data from an XML source file and store the result in a DB.



I have different source types, for example Student.XML, School.XML, etc. These files are copied in my source directory, C:Source.



My Synchronizer watches the Source folder, and every time there is a new file, it should read it, map it to my domain class and write the domain class into the DB.



If C:Source folder contains Student.XML, it should read the content of the XML file and copy it in Student Table in the DB. If C:Source contains School.XML, it should read the file and copy the content to School Table.



To solve this, I have defined an ISyncer interface:



public interface ISyncer

// Read input and synchronize destination, return error message if any
string Sync();



Now all my Syncer types (e.g. StudentSyncer, SchoolSyncer, etc) should implement this interface:



public class StudentSyncer : ISyncer

// simple XML reader, reads XML file into a list of List<XMLStudent>
private XMLStudentReader _reader;

public StudentSyncer(string file)

_reader = new XMLStudentReader(file);


public string Sync()

// read the input
List<XMLStudent> source = _reader.ReadAll();

// using automapper map to domain object
List<Student> dbStudent = Mapper.Map<List<XMLStudent>, List<Student>>(source);
dbStudent.ForEach(s => s.IsCurrent = true); // set IsCurrent

// write records to Student table, using Unit of Work patterns
using (var context = new DbContext())

UnitOfWork uow = new UnitOfWork(context);

// set the existing records to not current
var curSet = uow.Student.FindByTrackingChanges(s => s.IsCurrent == true).ToList();
curSet.ForEach(s => s.IsCurrent = false);
uow.Student.AddRange(dbStudent);
uow.SaveChanges();


return ""; // no error




I have a Windows service, which calls the DoSync() method every 30 seconds:



public void DoSync()

foreach (string file in Directory.EnumerateFiles(@"C:Source", "*.xml"))

// use syncer factory to initialize the correct instance of syncer based on input file name
ISyncer syncer = _syncerFactory.CreateInstance(file);

// do the synchronization task
syncer.Sync();

// Move file to processed folder
MoveFile(@"C:Destination");




The Factory is a simple factory. It reads the source file name, e.g. Student.XML, School.XML and based on the file name. It initializes the correct Syncer, e.g. StudentSyncer, SchoolSyncer.



I am happy with the code, but it is bothering me because I feel it is not following the Single Responsibility Principle. My Syncer class is not doing 1 task, but it is doing 3 tasks: read input, map to domain class, write to DB.










share|improve this question











$endgroup$











  • $begingroup$
    Synchronizer should watch the Source folder - where is the code that does that? Have you removed anything?
    $endgroup$
    – t3chb0t
    Jun 22 '18 at 9:42










  • $begingroup$
    @t3chb0t, thanks. It's a Windows event handler which calls DoSync () every 30 seconds. I did not include that part of the code in the review as I thought it's straight forward ... can add it, if it is necessary.
    $endgroup$
    – Hooman Bahreini
    Jun 22 '18 at 9:50













1












1








1





$begingroup$


I have created a Synchronizer, the purpose of which is to read data from an XML source file and store the result in a DB.



I have different source types, for example Student.XML, School.XML, etc. These files are copied in my source directory, C:Source.



My Synchronizer watches the Source folder, and every time there is a new file, it should read it, map it to my domain class and write the domain class into the DB.



If C:Source folder contains Student.XML, it should read the content of the XML file and copy it in Student Table in the DB. If C:Source contains School.XML, it should read the file and copy the content to School Table.



To solve this, I have defined an ISyncer interface:



public interface ISyncer

// Read input and synchronize destination, return error message if any
string Sync();



Now all my Syncer types (e.g. StudentSyncer, SchoolSyncer, etc) should implement this interface:



public class StudentSyncer : ISyncer

// simple XML reader, reads XML file into a list of List<XMLStudent>
private XMLStudentReader _reader;

public StudentSyncer(string file)

_reader = new XMLStudentReader(file);


public string Sync()

// read the input
List<XMLStudent> source = _reader.ReadAll();

// using automapper map to domain object
List<Student> dbStudent = Mapper.Map<List<XMLStudent>, List<Student>>(source);
dbStudent.ForEach(s => s.IsCurrent = true); // set IsCurrent

// write records to Student table, using Unit of Work patterns
using (var context = new DbContext())

UnitOfWork uow = new UnitOfWork(context);

// set the existing records to not current
var curSet = uow.Student.FindByTrackingChanges(s => s.IsCurrent == true).ToList();
curSet.ForEach(s => s.IsCurrent = false);
uow.Student.AddRange(dbStudent);
uow.SaveChanges();


return ""; // no error




I have a Windows service, which calls the DoSync() method every 30 seconds:



public void DoSync()

foreach (string file in Directory.EnumerateFiles(@"C:Source", "*.xml"))

// use syncer factory to initialize the correct instance of syncer based on input file name
ISyncer syncer = _syncerFactory.CreateInstance(file);

// do the synchronization task
syncer.Sync();

// Move file to processed folder
MoveFile(@"C:Destination");




The Factory is a simple factory. It reads the source file name, e.g. Student.XML, School.XML and based on the file name. It initializes the correct Syncer, e.g. StudentSyncer, SchoolSyncer.



I am happy with the code, but it is bothering me because I feel it is not following the Single Responsibility Principle. My Syncer class is not doing 1 task, but it is doing 3 tasks: read input, map to domain class, write to DB.










share|improve this question











$endgroup$




I have created a Synchronizer, the purpose of which is to read data from an XML source file and store the result in a DB.



I have different source types, for example Student.XML, School.XML, etc. These files are copied in my source directory, C:Source.



My Synchronizer watches the Source folder, and every time there is a new file, it should read it, map it to my domain class and write the domain class into the DB.



If C:Source folder contains Student.XML, it should read the content of the XML file and copy it in Student Table in the DB. If C:Source contains School.XML, it should read the file and copy the content to School Table.



To solve this, I have defined an ISyncer interface:



public interface ISyncer

// Read input and synchronize destination, return error message if any
string Sync();



Now all my Syncer types (e.g. StudentSyncer, SchoolSyncer, etc) should implement this interface:



public class StudentSyncer : ISyncer

// simple XML reader, reads XML file into a list of List<XMLStudent>
private XMLStudentReader _reader;

public StudentSyncer(string file)

_reader = new XMLStudentReader(file);


public string Sync()

// read the input
List<XMLStudent> source = _reader.ReadAll();

// using automapper map to domain object
List<Student> dbStudent = Mapper.Map<List<XMLStudent>, List<Student>>(source);
dbStudent.ForEach(s => s.IsCurrent = true); // set IsCurrent

// write records to Student table, using Unit of Work patterns
using (var context = new DbContext())

UnitOfWork uow = new UnitOfWork(context);

// set the existing records to not current
var curSet = uow.Student.FindByTrackingChanges(s => s.IsCurrent == true).ToList();
curSet.ForEach(s => s.IsCurrent = false);
uow.Student.AddRange(dbStudent);
uow.SaveChanges();


return ""; // no error




I have a Windows service, which calls the DoSync() method every 30 seconds:



public void DoSync()

foreach (string file in Directory.EnumerateFiles(@"C:Source", "*.xml"))

// use syncer factory to initialize the correct instance of syncer based on input file name
ISyncer syncer = _syncerFactory.CreateInstance(file);

// do the synchronization task
syncer.Sync();

// Move file to processed folder
MoveFile(@"C:Destination");




The Factory is a simple factory. It reads the source file name, e.g. Student.XML, School.XML and based on the file name. It initializes the correct Syncer, e.g. StudentSyncer, SchoolSyncer.



I am happy with the code, but it is bothering me because I feel it is not following the Single Responsibility Principle. My Syncer class is not doing 1 task, but it is doing 3 tasks: read input, map to domain class, write to DB.







c# object-oriented database xml factory-method






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 1 min ago







Hooman Bahreini

















asked Jun 22 '18 at 3:50









Hooman BahreiniHooman Bahreini

11312




11312











  • $begingroup$
    Synchronizer should watch the Source folder - where is the code that does that? Have you removed anything?
    $endgroup$
    – t3chb0t
    Jun 22 '18 at 9:42










  • $begingroup$
    @t3chb0t, thanks. It's a Windows event handler which calls DoSync () every 30 seconds. I did not include that part of the code in the review as I thought it's straight forward ... can add it, if it is necessary.
    $endgroup$
    – Hooman Bahreini
    Jun 22 '18 at 9:50
















  • $begingroup$
    Synchronizer should watch the Source folder - where is the code that does that? Have you removed anything?
    $endgroup$
    – t3chb0t
    Jun 22 '18 at 9:42










  • $begingroup$
    @t3chb0t, thanks. It's a Windows event handler which calls DoSync () every 30 seconds. I did not include that part of the code in the review as I thought it's straight forward ... can add it, if it is necessary.
    $endgroup$
    – Hooman Bahreini
    Jun 22 '18 at 9:50















$begingroup$
Synchronizer should watch the Source folder - where is the code that does that? Have you removed anything?
$endgroup$
– t3chb0t
Jun 22 '18 at 9:42




$begingroup$
Synchronizer should watch the Source folder - where is the code that does that? Have you removed anything?
$endgroup$
– t3chb0t
Jun 22 '18 at 9:42












$begingroup$
@t3chb0t, thanks. It's a Windows event handler which calls DoSync () every 30 seconds. I did not include that part of the code in the review as I thought it's straight forward ... can add it, if it is necessary.
$endgroup$
– Hooman Bahreini
Jun 22 '18 at 9:50




$begingroup$
@t3chb0t, thanks. It's a Windows event handler which calls DoSync () every 30 seconds. I did not include that part of the code in the review as I thought it's straight forward ... can add it, if it is necessary.
$endgroup$
– Hooman Bahreini
Jun 22 '18 at 9:50










1 Answer
1






active

oldest

votes


















0












$begingroup$

How about extracting tasks common to all source types into an (abstract) base class that, in turn, implements your ISyncer interface?



I would also change the error reporting by using exceptions, rather than have the method return a string in case of error.



Edit, code example (C#-ish pseudo code)



abstract class SyncerBase : ISyncer

sealed List<T> Map(List source, List target)

// Mapping magic here


sealed SaveToDB(List dataToSave, params ...)

// Your database access here




Put utility methods and common stuff for all your synchronizers in that base class, and inherit it.



class StundentSyncer : SyncerBase

// Constructor as in your code
void Sync(string file)

var XMLstudents = _reader.ReadAll();
var students = Map(XMLstudents); // calling base class here!
// Manipulate student list here as needed
SaveToDB (students, database params here) // base class here, too







share|improve this answer











$endgroup$












  • $begingroup$
    thanks. Exception is very good advice. I am not sure what you mean about abstracting the common functinality of all types?
    $endgroup$
    – Hooman Bahreini
    Jun 22 '18 at 10:11










  • $begingroup$
    @Hooman you mention that you have StudentSyncer, SchoolSyncer, etc - it's very likely that they repeat the same code but it's hard to say because we don't see the other implemenations.
    $endgroup$
    – t3chb0t
    Jun 22 '18 at 10:17










  • $begingroup$
    What is type T? And how to initialize Syncer / SyncerBase using a factory pattern? The reason I did not include Reader, Writer and Mapper inside ISyncer, was that I wanted to easily initialize the Syncers in a Factory.
    $endgroup$
    – Hooman Bahreini
    Jun 23 '18 at 0:44











Your Answer





StackExchange.ifUsing("editor", function ()
return StackExchange.using("mathjaxEditing", function ()
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
);
);
, "mathjax-editing");

StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "196"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f197024%2fsynchronizer-for-importing-xml-files-into-a-database-when-folder-content-changes%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0












$begingroup$

How about extracting tasks common to all source types into an (abstract) base class that, in turn, implements your ISyncer interface?



I would also change the error reporting by using exceptions, rather than have the method return a string in case of error.



Edit, code example (C#-ish pseudo code)



abstract class SyncerBase : ISyncer

sealed List<T> Map(List source, List target)

// Mapping magic here


sealed SaveToDB(List dataToSave, params ...)

// Your database access here




Put utility methods and common stuff for all your synchronizers in that base class, and inherit it.



class StundentSyncer : SyncerBase

// Constructor as in your code
void Sync(string file)

var XMLstudents = _reader.ReadAll();
var students = Map(XMLstudents); // calling base class here!
// Manipulate student list here as needed
SaveToDB (students, database params here) // base class here, too







share|improve this answer











$endgroup$












  • $begingroup$
    thanks. Exception is very good advice. I am not sure what you mean about abstracting the common functinality of all types?
    $endgroup$
    – Hooman Bahreini
    Jun 22 '18 at 10:11










  • $begingroup$
    @Hooman you mention that you have StudentSyncer, SchoolSyncer, etc - it's very likely that they repeat the same code but it's hard to say because we don't see the other implemenations.
    $endgroup$
    – t3chb0t
    Jun 22 '18 at 10:17










  • $begingroup$
    What is type T? And how to initialize Syncer / SyncerBase using a factory pattern? The reason I did not include Reader, Writer and Mapper inside ISyncer, was that I wanted to easily initialize the Syncers in a Factory.
    $endgroup$
    – Hooman Bahreini
    Jun 23 '18 at 0:44
















0












$begingroup$

How about extracting tasks common to all source types into an (abstract) base class that, in turn, implements your ISyncer interface?



I would also change the error reporting by using exceptions, rather than have the method return a string in case of error.



Edit, code example (C#-ish pseudo code)



abstract class SyncerBase : ISyncer

sealed List<T> Map(List source, List target)

// Mapping magic here


sealed SaveToDB(List dataToSave, params ...)

// Your database access here




Put utility methods and common stuff for all your synchronizers in that base class, and inherit it.



class StundentSyncer : SyncerBase

// Constructor as in your code
void Sync(string file)

var XMLstudents = _reader.ReadAll();
var students = Map(XMLstudents); // calling base class here!
// Manipulate student list here as needed
SaveToDB (students, database params here) // base class here, too







share|improve this answer











$endgroup$












  • $begingroup$
    thanks. Exception is very good advice. I am not sure what you mean about abstracting the common functinality of all types?
    $endgroup$
    – Hooman Bahreini
    Jun 22 '18 at 10:11










  • $begingroup$
    @Hooman you mention that you have StudentSyncer, SchoolSyncer, etc - it's very likely that they repeat the same code but it's hard to say because we don't see the other implemenations.
    $endgroup$
    – t3chb0t
    Jun 22 '18 at 10:17










  • $begingroup$
    What is type T? And how to initialize Syncer / SyncerBase using a factory pattern? The reason I did not include Reader, Writer and Mapper inside ISyncer, was that I wanted to easily initialize the Syncers in a Factory.
    $endgroup$
    – Hooman Bahreini
    Jun 23 '18 at 0:44














0












0








0





$begingroup$

How about extracting tasks common to all source types into an (abstract) base class that, in turn, implements your ISyncer interface?



I would also change the error reporting by using exceptions, rather than have the method return a string in case of error.



Edit, code example (C#-ish pseudo code)



abstract class SyncerBase : ISyncer

sealed List<T> Map(List source, List target)

// Mapping magic here


sealed SaveToDB(List dataToSave, params ...)

// Your database access here




Put utility methods and common stuff for all your synchronizers in that base class, and inherit it.



class StundentSyncer : SyncerBase

// Constructor as in your code
void Sync(string file)

var XMLstudents = _reader.ReadAll();
var students = Map(XMLstudents); // calling base class here!
// Manipulate student list here as needed
SaveToDB (students, database params here) // base class here, too







share|improve this answer











$endgroup$



How about extracting tasks common to all source types into an (abstract) base class that, in turn, implements your ISyncer interface?



I would also change the error reporting by using exceptions, rather than have the method return a string in case of error.



Edit, code example (C#-ish pseudo code)



abstract class SyncerBase : ISyncer

sealed List<T> Map(List source, List target)

// Mapping magic here


sealed SaveToDB(List dataToSave, params ...)

// Your database access here




Put utility methods and common stuff for all your synchronizers in that base class, and inherit it.



class StundentSyncer : SyncerBase

// Constructor as in your code
void Sync(string file)

var XMLstudents = _reader.ReadAll();
var students = Map(XMLstudents); // calling base class here!
// Manipulate student list here as needed
SaveToDB (students, database params here) // base class here, too








share|improve this answer














share|improve this answer



share|improve this answer








edited Jun 22 '18 at 10:56

























answered Jun 22 '18 at 9:37









TomGTomG

48628




48628











  • $begingroup$
    thanks. Exception is very good advice. I am not sure what you mean about abstracting the common functinality of all types?
    $endgroup$
    – Hooman Bahreini
    Jun 22 '18 at 10:11










  • $begingroup$
    @Hooman you mention that you have StudentSyncer, SchoolSyncer, etc - it's very likely that they repeat the same code but it's hard to say because we don't see the other implemenations.
    $endgroup$
    – t3chb0t
    Jun 22 '18 at 10:17










  • $begingroup$
    What is type T? And how to initialize Syncer / SyncerBase using a factory pattern? The reason I did not include Reader, Writer and Mapper inside ISyncer, was that I wanted to easily initialize the Syncers in a Factory.
    $endgroup$
    – Hooman Bahreini
    Jun 23 '18 at 0:44

















  • $begingroup$
    thanks. Exception is very good advice. I am not sure what you mean about abstracting the common functinality of all types?
    $endgroup$
    – Hooman Bahreini
    Jun 22 '18 at 10:11










  • $begingroup$
    @Hooman you mention that you have StudentSyncer, SchoolSyncer, etc - it's very likely that they repeat the same code but it's hard to say because we don't see the other implemenations.
    $endgroup$
    – t3chb0t
    Jun 22 '18 at 10:17










  • $begingroup$
    What is type T? And how to initialize Syncer / SyncerBase using a factory pattern? The reason I did not include Reader, Writer and Mapper inside ISyncer, was that I wanted to easily initialize the Syncers in a Factory.
    $endgroup$
    – Hooman Bahreini
    Jun 23 '18 at 0:44
















$begingroup$
thanks. Exception is very good advice. I am not sure what you mean about abstracting the common functinality of all types?
$endgroup$
– Hooman Bahreini
Jun 22 '18 at 10:11




$begingroup$
thanks. Exception is very good advice. I am not sure what you mean about abstracting the common functinality of all types?
$endgroup$
– Hooman Bahreini
Jun 22 '18 at 10:11












$begingroup$
@Hooman you mention that you have StudentSyncer, SchoolSyncer, etc - it's very likely that they repeat the same code but it's hard to say because we don't see the other implemenations.
$endgroup$
– t3chb0t
Jun 22 '18 at 10:17




$begingroup$
@Hooman you mention that you have StudentSyncer, SchoolSyncer, etc - it's very likely that they repeat the same code but it's hard to say because we don't see the other implemenations.
$endgroup$
– t3chb0t
Jun 22 '18 at 10:17












$begingroup$
What is type T? And how to initialize Syncer / SyncerBase using a factory pattern? The reason I did not include Reader, Writer and Mapper inside ISyncer, was that I wanted to easily initialize the Syncers in a Factory.
$endgroup$
– Hooman Bahreini
Jun 23 '18 at 0:44





$begingroup$
What is type T? And how to initialize Syncer / SyncerBase using a factory pattern? The reason I did not include Reader, Writer and Mapper inside ISyncer, was that I wanted to easily initialize the Syncers in a Factory.
$endgroup$
– Hooman Bahreini
Jun 23 '18 at 0:44


















draft saved

draft discarded
















































Thanks for contributing an answer to Code Review Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f197024%2fsynchronizer-for-importing-xml-files-into-a-database-when-folder-content-changes%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

名間水力發電廠 目录 沿革 設施 鄰近設施 註釋 外部連結 导航菜单23°50′10″N 120°42′41″E / 23.83611°N 120.71139°E / 23.83611; 120.7113923°50′10″N 120°42′41″E / 23.83611°N 120.71139°E / 23.83611; 120.71139計畫概要原始内容臺灣第一座BOT 模式開發的水力發電廠-名間水力電廠名間水力發電廠 水利署首件BOT案原始内容《小檔案》名間電廠 首座BOT水力發電廠原始内容名間電廠BOT - 經濟部水利署中區水資源局

Prove that NP is closed under karp reduction?Space(n) not closed under Karp reductions - what about NTime(n)?Class P is closed under rotation?Prove or disprove that $NL$ is closed under polynomial many-one reductions$mathbfNC_2$ is closed under log-space reductionOn Karp reductionwhen can I know if a class (complexity) is closed under reduction (cook/karp)Check if class $PSPACE$ is closed under polyonomially space reductionIs NPSPACE also closed under polynomial-time reduction and under log-space reduction?Prove PSPACE is closed under complement?Prove PSPACE is closed under union?

Is my guitar’s action too high? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)Strings too stiff on a recently purchased acoustic guitar | Cort AD880CEIs the action of my guitar really high?Μy little finger is too weak to play guitarWith guitar, how long should I give my fingers to strengthen / callous?When playing a fret the guitar sounds mutedPlaying (Barre) chords up the guitar neckI think my guitar strings are wound too tight and I can't play barre chordsF barre chord on an SG guitarHow to find to the right strings of a barre chord by feel?High action on higher fret on my steel acoustic guitar