Naming class members
-
Slightly off topic... What's the point of the 'mixed case apart from the first letter' naming standard. I know it's prevalent, especially in Java, and (I think) .NET. Mixed case I understand - it makes the different words easy to read. So why not make the first letter mixed case as well?
-
I am curious as to what the proper name would be for the following function: The method... Takes parameters prepared on client side which are then shuttled to server side as URL GET variables, then converted into PHP function parameters and passed to a function call. The object is written in PHP. Here are some names i've come up with...but none seem to fit the purpose very well. 1)
bindEvents
/captureEvents
Although my PHP object is not really capturing any events...except for a native HTTP GET request...I think. 2)routeActions
My PHP object is basically parsing the URL get request into an array and then determining what elements in the array are parameters intended for the function call (which is actually more like the event handler) For this reason I have decided oneventListener
because it actually unpacks parameters for more than one function. However I wonder, wouldbindEvents
be a better name for the function considering what it's doing? This function is basically parsing a URL breaking it into seperate variables and submiting certain parameters to a function handler. Perhaps something likedeparcelParams
orunpackParams
but thats not really saying it all either... Any suggestions? Cheers :) It's frustrating being a genius and living the life of a moron!!!How about this PhpFunctionator() ------- sig starts "I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
-
Slightly off topic... What's the point of the 'mixed case apart from the first letter' naming standard. I know it's prevalent, especially in Java, and (I think) .NET. Mixed case I understand - it makes the different words easy to read. So why not make the first letter mixed case as well?
I usually only do that while programming in Perl or PHP. Whenever I do MFC/Javascript or anything specific to windows I usually follow the WIN32 API and hungarian notation for variables. I dunno...especially when I write PHP code I have a tendancy to write functions in a
verbNoun()
type fashion...I just prefer that coding style...yet I probably wouldn't do anything like that in C++ especially Windows code. It's frustrating being a genius and living the life of a moron!!! -
How about this PhpFunctionator() ------- sig starts "I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
The Php would have to be small case...seems to be the standard way of using php in any logo, function call, etc. :) It's frustrating being a genius and living the life of a moron!!!
-
I am curious as to what the proper name would be for the following function: The method... Takes parameters prepared on client side which are then shuttled to server side as URL GET variables, then converted into PHP function parameters and passed to a function call. The object is written in PHP. Here are some names i've come up with...but none seem to fit the purpose very well. 1)
bindEvents
/captureEvents
Although my PHP object is not really capturing any events...except for a native HTTP GET request...I think. 2)routeActions
My PHP object is basically parsing the URL get request into an array and then determining what elements in the array are parameters intended for the function call (which is actually more like the event handler) For this reason I have decided oneventListener
because it actually unpacks parameters for more than one function. However I wonder, wouldbindEvents
be a better name for the function considering what it's doing? This function is basically parsing a URL breaking it into seperate variables and submiting certain parameters to a function handler. Perhaps something likedeparcelParams
orunpackParams
but thats not really saying it all either... Any suggestions? Cheers :) It's frustrating being a genius and living the life of a moron!!!I've a favourite for hard-to-name functions
ThisDoesWhoKnowsWhatSoDontThinkAboutChangingIt();
or
ICantThinkOfAnythingBetterThanThis();
:doh: Chris Meech I am Canadian. [heard in a local bar] Gently arching his fishing rod back he moves the tip forward in a gentle arch releasing the line.... kersplunk [Doug Goulden] Nice sig! [Tim Deveaux on Matt Newman's sig with a quote from me]
-
I am curious as to what the proper name would be for the following function: The method... Takes parameters prepared on client side which are then shuttled to server side as URL GET variables, then converted into PHP function parameters and passed to a function call. The object is written in PHP. Here are some names i've come up with...but none seem to fit the purpose very well. 1)
bindEvents
/captureEvents
Although my PHP object is not really capturing any events...except for a native HTTP GET request...I think. 2)routeActions
My PHP object is basically parsing the URL get request into an array and then determining what elements in the array are parameters intended for the function call (which is actually more like the event handler) For this reason I have decided oneventListener
because it actually unpacks parameters for more than one function. However I wonder, wouldbindEvents
be a better name for the function considering what it's doing? This function is basically parsing a URL breaking it into seperate variables and submiting certain parameters to a function handler. Perhaps something likedeparcelParams
orunpackParams
but thats not really saying it all either... Any suggestions? Cheers :) It's frustrating being a genius and living the life of a moron!!!CornedBeefHash() since it has a little bit of everything in it.... LeftOverMeatloaf() also works... honestly... I am kidding! I haven't used those since my college days when I wanted to annoy my professor. EinsteinsHeadache() was a 4 dimensional storage routine (my professor said she had to visualize data storage to grade it, I learned new words that day I turned it in too). _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
-
How about one of thesse:
doSomeStuff shuffleSomeData doSomethingUseful
:-D An expert is somebody who learns more and more about less and less, until he knows absolutely everything about nothing. -
How about one of thesse:
doSomeStuff shuffleSomeData doSomethingUseful
:-D An expert is somebody who learns more and more about less and less, until he knows absolutely everything about nothing.And if you want people to think you're doing really high-tech stuff, you can gussie them up like this: TransmogrifyCommunicationPaths() StabilizeOfflineBufferArrays() InitiateTransparentProtocol() TransmitArterialSpecification() etc. Seriously, though, you were originally talking about parameters, then all your ideas for names were about events and actions. From your original description I was thinking it would be SendParameters(), or GetParameters(), or GetGetParameters() :), or the like. Additionally, a kind of rule of thumb about hard-to-name functions or methods is that usually the reason is that they are not cohesive (see Coupling and Cohesion[^]). Matt Gerrans
-
I am curious as to what the proper name would be for the following function: The method... Takes parameters prepared on client side which are then shuttled to server side as URL GET variables, then converted into PHP function parameters and passed to a function call. The object is written in PHP. Here are some names i've come up with...but none seem to fit the purpose very well. 1)
bindEvents
/captureEvents
Although my PHP object is not really capturing any events...except for a native HTTP GET request...I think. 2)routeActions
My PHP object is basically parsing the URL get request into an array and then determining what elements in the array are parameters intended for the function call (which is actually more like the event handler) For this reason I have decided oneventListener
because it actually unpacks parameters for more than one function. However I wonder, wouldbindEvents
be a better name for the function considering what it's doing? This function is basically parsing a URL breaking it into seperate variables and submiting certain parameters to a function handler. Perhaps something likedeparcelParams
orunpackParams
but thats not really saying it all either... Any suggestions? Cheers :) It's frustrating being a genius and living the life of a moron!!!When talking about unmaintainable code, this[^] guide is a must. Don't follow what all those amateurs here told you, they are not as good as a real pro at unmaintainable code. E.g., while Navin suggested: doSomeStuff shuffleSomeData doSomethingUseful a real pro would use: dSmStff misturaAlgunsDados (yeah! Globalization rules) DoSoMeTh1nGusefu1 Also, don't forget to consider: _ (That's it! A single score can be used as a function name! Multiple scores too!) Yes, even I am blogging now!
-
I am curious as to what the proper name would be for the following function: The method... Takes parameters prepared on client side which are then shuttled to server side as URL GET variables, then converted into PHP function parameters and passed to a function call. The object is written in PHP. Here are some names i've come up with...but none seem to fit the purpose very well. 1)
bindEvents
/captureEvents
Although my PHP object is not really capturing any events...except for a native HTTP GET request...I think. 2)routeActions
My PHP object is basically parsing the URL get request into an array and then determining what elements in the array are parameters intended for the function call (which is actually more like the event handler) For this reason I have decided oneventListener
because it actually unpacks parameters for more than one function. However I wonder, wouldbindEvents
be a better name for the function considering what it's doing? This function is basically parsing a URL breaking it into seperate variables and submiting certain parameters to a function handler. Perhaps something likedeparcelParams
orunpackParams
but thats not really saying it all either... Any suggestions? Cheers :) It's frustrating being a genius and living the life of a moron!!!Its possible that the method is doing too much. One of the "smells" (as Fowler puts it) is if you have trouble with a name, perhaps its because the method is too diffuse. See if you can whack it up into bits which then follow the old VerbObject() motif. Just a thought...
α.γεεκ
Fortune passes everywhere.
Duke Leto Atreides -
-
Or you could have: doitBest() But I think that's trademarked by a hardware store. :-D An expert is somebody who learns more and more about less and less, until he knows absolutely everything about nothing.
or even doit2(), for when the first proves inadequate, but for reasons of backward compatibility, you can't get rid of it. Like the man said, self documenting code :) ¡El diablo está en mis pantalones! ¡Mire, mire! Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)! SELECT * FROM User WHERE Clue > 0 0 rows returned
-
How about this PhpFunctionator() ------- sig starts "I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
or perhaps phpMultiplexingFrobnicator() pstFricticatingBabelizer() lsfDopplewhangingSpidofuscator() ¡El diablo está en mis pantalones! ¡Mire, mire! Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)! SELECT * FROM User WHERE Clue > 0 0 rows returned
-
Its possible that the method is doing too much. One of the "smells" (as Fowler puts it) is if you have trouble with a name, perhaps its because the method is too diffuse. See if you can whack it up into bits which then follow the old VerbObject() motif. Just a thought...
α.γεεκ
Fortune passes everywhere.
Duke Leto AtreidessmellyDiffuser() ¡El diablo está en mis pantalones! ¡Mire, mire! Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)! SELECT * FROM User WHERE Clue > 0 0 rows returned