Architecture

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Buidling an API extracts data from a 3rd party application.
The 3rd party application supports around 150 different queries.
Which is better, creating a single class that contains methods
for each query that accepts parameters or creating a class for each query
that provides public set properties?
 
Some of it depends on info we don't have...

1) Can the queries in the 3rd party app ever change?

2) Are each of the queries very different form each other or can they be
grouped together to form groups of related queries?

Various ways you could handle this:

1) One class with 150 static(shared) methods that each have individual
specific parameters. This helps make sure that each query gets the correct
data it needs to run but can make future changes difficult and also makes
for very long list of functions.

2) Group common queries together and create individual classes that need
to be instanced with the proper data then call methods of those classes to
return the data for each related query. This helps compartmentalize things a
bit.
 
Thanks for the reply.

1. The queries never change.
2. The queries are all different each queries can have different
parameters. For example, one querie may have 3 required params, 2 option
params.

For each querie, I will probably create overloaded methods and there will
probably be three returns types, one will be an XmlDocument, the other and
XPathNodeIterator. another will be a string

All queries into the 3rd party tool return xml, so it just depends on what
we will be using the xml for that will determine the return type.

Thanks, James
 
Back
Top