Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
matste6456yCode listing would explain your problem better.
You are basically right. Having a constant is DRY - makes it easier to rename and, more importantly, find all usages. However, in my experience a file with a list of all possible constants is always a mess. A module in your db should easily map to a module in your other language.
Ideally, what I would try to achieve is some kind of semi-language, where the objects representing your stored procedures, are somehow real objects/methods in the main language.
Example techniques:
Specification:
new TheStoredprocedure(arg1, arg2)
represents a term that evaluates to a call of the procedure.
Meta programming:
interface MyDatabase {
@StoredProcedure(name=„my_procedure”)
void myProcedure(arg1, arg2); -
@matste Thanks for your recap. Idea of course was not to create a single godlike constants class for everything but constants for stored procedures independently in their own file. I'm just a little uneased with the fact that I actually have to remove it and replace everything with inline strings.
Related Rants
-
localguest18I code, watch Big Bang Theory, sip coffee, and code again. I never leave the doorsteps except for my classes. ...
-
cave20I arrived at 8am sharp today, SHARP, I usually arrive 2-3min earlier, so I can start with my actual work at 8a...
-
laTinkerer13I'm a junior developer working on a project that's completely out of my scope. I've missed deadline after dead...
I need advice fellow developers, am I stubborn?
So I lost an argument in my team regarding constant vs variable directly in a method for stored procedure names.
I separated names of procedures into their own StoredProcedureConstants file because it makes it very easy to see all procedures used in a project and refactor their names if necessary. Argument against was that you loose time creating a constant. Am I silly if I am alergic to seeing quotation marks stuff without its designated purpose throughout the code?
Their way is adding var procedureName = "cc.storeProcedureName" directly in a method. I just can't find my peace with it. To me this is a magic string.
Am I being unreasonable?
rant
advice needed
stubborn
am i the only one?