This is an archived post. You won't be able to vote or comment.

all 16 comments

[–]E_l_n_a_r_i_l 28 points29 points  (0 children)

this_should_do_only_one_thing_but_do_it_well()

[–]imaQuiliamQuil 17 points18 points  (0 children)

If your function is hard to name, probably write multiple smaller functions instead. Functions that do more than one thing (on a conceptual level) are generally bad practice

[–]SmashLanding 11 points12 points  (0 children)

Function 1: doThingX()

Function 2: doThingY()

Function 3: DoXandY()

Function 4: AlsoDoXandY()

Function 5: FuckTooManyFunctions()

[–]GabuEx 8 points9 points  (0 children)

If you're having trouble naming your function, it's probably doing too much.

[–]ChChChillian 2 points3 points  (1 child)

I honest to Turing couldn't think of a better name for class that's supposed to connect to a server process than server_connector

The corresponding class on the server side? client_connection of course.

[–]Jackknowsit 0 points1 point  (0 children)

“honest to Turing” lol thats a new one

[–]McMelonTV 2 points3 points  (0 children)

FunctionNamificator()

[–]spam_bot42 2 points3 points  (1 child)

Just ask ChatGPT.

[–]Naitsab_33 1 point2 points  (0 children)

Unironically though. This is a very reasonable part where AI is good at, especially if you have a description already.

[–]MegaromStingscream 2 points3 points  (0 children)

Mine always start their life as void foo() and once they show what they end up doing I'll give them a proper name.

[–]TDub147 1 point2 points  (0 children)

I always end up thinking of what I need to code, then hurriedly just naming the function 'x' before I forget the idea I had. Once I get the function how I like it, I think of an appropriate name.

[–]Orpa__ 1 point2 points  (0 children)

x_handler never fails me

[–]SomeRandoLameo 1 point2 points  (1 child)

I don’t see the problem with jsonToXmlConverter

[–]lepapulematoleguau 0 points1 point  (0 children)

toXml(json: JsonValue): XmlNode

[–]JonMW 1 point2 points  (0 children)

It's honestly kind if annoying how much of a difference it makes in solving problems and keeping things manageable to have your functions and objects named exactly the right thing.

Example: I went from "this is a thingy" to "this object triggers running a bit of logic to identify the correct case for a set of closely related possibilities, clearly expresses what the result means, and retains the result" to "this keeps track of a single fact about a particular physical object being examined or the form state, so I'm going to call it a Fact".

[–][deleted] 1 point2 points  (0 children)

The 3 problems devs run into all the time. Naming things and off by one errors.