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
-
If a function does more than one thing, isn't that a sign that it's doing too much?
-
MattMatt3978yShouldn't it be split into separate functions?
Then if you want to call a function that does all the other functions give it a group name
Eg.
Function getFieldNum()
+
Function calculateInterest()
=
Function getFieldInterest{
Var returnVal = calculateInterest (getFieldNum(this));
Return returnVal;
} -
ZeMooX348y@Jantho1990 Indeed, that would be the S (Single responsibility) from the SOLID principle.
-
@mintu19
'K.i.s.s.'
Keep it simple stupid.
@everyoneCommentingThatFunctionsShouldOnlyDoOneThing
Well duh! That's the point. -
@jAsE Just like "in the old days" use weird abbreviations for argument and function names nobody can ever figure out what they are supposed to do but is pronounceable as a weird word. And that words sound corny or perverted but actually are abbreviations for accounting or marketing terms. So when you discuss that code in the kitchen next to the coffee maker everybody thinks you have some kind of brain damage. And just do it in one huuuge function like (pseudocode ahead):
coclsh(char clufuc, array piosh )
{
btchcntr = 0
while (btchcntr < Dipsht.topsltcnt()
{
slngrmv = Slngprn.cnv(clufuc)
piosh.suc(slngrmv)
btchcntr = Prnlvr.antvar(1)
}
// 200 more lines of code that does it all
}
Related Rants
-
gosubinit18This genius made his very own super-flexible-and-versatile-never-seen-before-mvc-framework, with no documentat...
-
wzieba10Code is reflection of your soul. Consider whether your soul is shit.
-
Jglass855So the CEO tells me our new release needs to be compliant with new guidelines. I say sure, I draft up a few sm...
Trying to come up with function names when it does more than one thing.
undefined
kiss