which is better "destination, source" or "source, destination"? [closed] - api

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
My question is language transcendent, I've often found prototypes of "copy" functions define parameters in the order: argument1:"destination" then argument2:"source".
It is the case of memcpy for example in C. But it is NOT the case of file copy on bash ! You say, e.g.: "$ cp file file2" where file2 is the new file.
Which makes much more sense to me, we always say "copy that text here please" and not "copy here that text" which is Yoda-esque.
So the true question is: a good API should use what form (order) ? and maybe another subsidiary question: what form is everybody expecting, if there is any ?

I expect source to come first, and destination later.
If you can disambiguate in the language, it would be better. For example, in a OO language:
source.copyTo(destination);
In a language with named parameters:
copy(source: s, destination: d);
The important thing is to make clear what's going on for people reading the code. Code is more often read than it's written.

I've always preferred source-destination (I'm pushing from here to here), but it probably also depends on the call. If it's only 'copy' you're referring to, I think this works. I'm sure there's there are other pull oriented calls that dest-source would apply better to.

Related

Should I keep design patterns terminologies? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
When I'm implementing design patterns, should I keep terms like "strategy", "visitor", "facade" or could I fit these names to the context of my application ? What is the best practice ?
You should fit these names to the context of the application. It will make it easier for the people reading your code. You can add the patterns in your documentation.
I think you should always keep some reference to the pattern in your naming where it makes it meaningful and descriptive.
Patterns are a means of communication. If I come across code that is an XyzVisitor, I know that the visitor pattern has been used. With nothing else, the name has conveyed a whole stack of information on how the code works (or should work).
That said, sometimes it would just be a bit odd. Eg. DatabaseSingleton. Whereas AccountRefreshCommand fits quite nicely.
Depends on which pattern you're using, Some pattern names may be mixed with class names, e.g. I use
class LogFactory
class StudentsAdapter
for factory and adapter patterns, but
Engine.Instance
for singleton.
Depends on whether you are happy renaming the class in the event of using a different pattern, for me it would smack too much of hungarian notation difficulties.

Is there an obvious database design for a bulletin board / forum? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Is there some kind of obvious database should I use for a Bulletin Board if I wanted to code one? I think I know how to code the rest of it, I know the imperative code to handle the logic, but I don't really know much about databases yet. This I can learn of course, I'm just wondering if there is something obvious I should know in the beginning, or an obvious place to start learning, besides sql 101. Also, please don't suggest reading the code of an open source project. I know that option is there. It's hard to decipher code in a language you don't understand really well.
You can check out this place they've got tons of database sample you can use to jumpstart a project http://www.databaseanswers.org/data_models/

What's a good boolean naming convention suggesting "this will be done"? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I seem to be coming across a lot of variable (boolean) for some Options that control whether something will be done, like:
GiveWarningEnabled
FeedbackEnabled (will provide feedback)
These will be used a lot and I"m trying to think of a good pre/suf fix that will indicted it's Boolean. My best thought so far was Enabled.
Perhaps: Will?
WillGiveWarning (or WillWarn)
WillGiveFeedback?
often times "is" will be used, such as isPlaying or isWifiEnabled.
Will, should, can, and does are also good ones to use because they express conditions. A verb such as "give", like the one you listed, seems to better fit a function declaration since it is performing an action.
I usally prefer flag.
Example:
warningFlag,
feedbackFlag.

What term do you use for manual database changes? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
The company I am working for calls manual database changes (ie., writing a SQL update/insert/delete) a "data hammer". While the term makes sense, I have yet to find any other organization or group that calls it by this name. A search here on SO yields no results.
How do you refer to manual database changes? Is there a standard term?
I usually hear it referred to as 'writing a query' or 'updating a query'.
I don't think that there is a professional term for this. We just call it "manual database change".
Personally, if I delete all the rows I call it "blatting" the database. If I manually force data into it then (just in my head) I call it "shoe-horning" the data into the database.
I think I need a cool term for updating it though. I used to say I was munging it, but that's been stolen by the deployment applications meaning token replacement, so I need a new term, otherwise I'm in danger of being understood outside my organisation.
How about calling it "hacking" the database? :)
Back-end changes. This is of course different from backside changes, which are what happen when you spend 8-10hrs a day in an Aeron.
"Ad-hoc query" is sometimes used. As opposed to a stored procedure.

'Best' Diff Algorithm [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I need to implement a Diff algorithm in VB.NET to find the changes between two different versions of a piece of text. I've had a scout around the web and have found a couple of different algorithms.
Does anybody here know of a 'best' algorithm that I could implement?
Well I've used the c# version on codeproject and its really good for what I wanted...
http://www.codeproject.com/KB/recipes/diffengine.aspx
You can probably get this translated into VB.net via an online converter if you can't do it yourself...
I like An O(ND) Difference Algorithm and Its Variations by Eugene Myers. I believe it's the algorithm that was used in GNU diff. For a good background see Wikipedia.
This is quite theoretical and you might wish to find source code, but I'm not aware of any in VB.
I don't know for sure if it's the best diff algorithms but you might want to check out those links that talks about SOCT4 and SOCT6
http://dev.libresource.org/home/doc/so6-user-manual/concepts
and also:
http://www.loria.fr/~molli/pmwiki/uploads/Main/so6group03.pdf
http://www.loria.fr/~molli/pmwiki/uploads/Main/diffalgo.pdf