Should we prefer discrete method calls or selector parameters?

Asked by Rick Stovall

In dbAccess, there is a int dbAccess::sqlExecute (int type, string scrpt) method. The two arguments are the query type (insert, select, update, etc.) and the query itself. My question is should be forcing a scan of a select table on every query, or would both the code and the interface be improved by using distinct methods for each?

In other words, I believe it would may be better to provide distinct dbAccess methods for insert, update, exec and select; This is no more complex to use than using an enumerated query type selector and has the additional advantage of removing the select statement, improving performance on what are going to be very frequently called methods.

George, I am particularly looking for your opinions on this, although all members of ntrb-core are welcome to pipe in. This certainly will not be the last question of it's type we see!

Question information

Language:
English Edit question
Status:
Solved
For:
New Real Time Battle Edit question
Assignee:
No assignee Edit question
Solved by:
Rick Stovall
Solved:
Last query:
Last reply:
Revision history for this message
Rick Stovall (fpstovall) said :
#1

One other point which applies to this question; in the reference 50 bot, 50 hz simulation, inserts conservatively will be called over 3000 times a second.. could be much more. At this level, efficiency matters a good bit even on modern hardware.

Revision history for this message
George Jordan (gsjordanc) said :
#2

Not knowing at this time what queries are wanted/needed/required along with the need to try different type of queries as tests to exercise the functionality of accessing the database, this method appeared to best work the need.

I don't really care which style we use but this style best suited the need at this time (testing of db accessing).

If the group prefers the other style (the one you mention), I can change it over very easily at this time.

Revision history for this message
Rick Stovall (fpstovall) said :
#3

Does anyone else have a strong feeling on this? From a code design point of
view, I tend to prefer discrete methods, but I remain open to other points
of view for now.

On Fri, Feb 25, 2011 at 14:45, George Jordan <
<email address hidden>> wrote:

> Question #146869 on New Real Time Battle changed:
> https://answers.launchpad.net/nrtb/+question/146869
>
> Status: Open => Answered
>
> George Jordan proposed the following answer:
> Not knowing at this time what queries are wanted/needed/required along
> with the need to try different type of queries as tests to exercise the
> functionality of accessing the database, this method appeared to best
> work the need.
>
> I don't really care which style we use but this style best suited the
> need at this time (testing of db accessing).
>
> If the group prefers the other style (the one you mention), I can change
> it over very easily at this time.
>
> --
> You received this question notification because you are a member of NRTB
> Core, which is an answer contact for New Real Time Battle.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~nrtb-core
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~nrtb-core
> More help : https://help.launchpad.net/ListHelp
>

--
Confined though we are,
   Infinity dwells within.

Revision history for this message
George Jordan (gsjordanc) said :
#4

Since I've not seen any activity on this questions, I will side with Rick and say we go with discrete method calls instead
of selector parameters.

I will be converting my selector parameters methods over for data_broker as I go forward unless someone else presents a
different view.

Revision history for this message
Rick Stovall (fpstovall) said :
#5

Okay, those who have responded agree.. the standard going forward will be single purpose methods which do one task each. Methods which take a type or action code should be avoided unless it can be shown there is a clear advantage to that design for a specific case. Coders presenting such cases for review should be prepared to support their design with solid reasons, including metrics data where appropriate.

Revision history for this message
Rick Stovall (fpstovall) said :
#6

Rick Stovall suggests this article as an answer to your question:
FAQ #1072: “Alpha Development FAQ”.

Revision history for this message
Rick Stovall (fpstovall) said :
#7

LinkedIn
------------

I'd like to add you to my professional network on LinkedIn.

- Rick

Rick Stovall
Software Configuration Manager at SCOR
Charlotte, North Carolina Area

Confirm that you know Rick Stovall:
https://www.linkedin.com/e/-bk8l30-hrt69x0x-3g/isd/20198806695/BNWZmOOK/?hs=false&tok=2BvPozuXxAc681

--
You are receiving Invitation to Connect emails. Click to unsubscribe:
http://www.linkedin.com/e/-bk8l30-hrt69x0x-3g/qNYj-IYt2QRj2e0Y1eJ28aYVqlghmHyWsP3Cpt1y_Jbi240P1oTbF7/goo/question146869%40answers%2Elaunchpad%2Enet/20061/I6502040799_1/?hs=false&tok=1_hNEpmuJAc681

(c) 2012 LinkedIn Corporation. 2029 Stierlin Ct, Mountain View, CA 94043, USA.