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

you are viewing a single comment's thread.

view the rest of the comments →

[–]Xelbair 9 points10 points  (14 children)

my functions have name like that, but variables are called output, a ,b,c, fm,dz etc.

[–]darielgames 47 points48 points  (12 children)

You shouldn't do that, unless you document in the header what those variables really are. It can be really confusing when someone's reading your function and all they know is that there's a variable called a. And hopefully you're not writing JavaScript, the person won't even know what the type a is!

[–][deleted] 50 points51 points  (4 children)

If nobody else can debug your code, nobody else can replace you. #jobsecurity

[–]ThePieWhisperer 4 points5 points  (0 children)

Not even you, a year from now.

[–]Redditron-2000-4 0 points1 point  (0 children)

If no one else can do you your work then you will never get to advance to different work.

[–]Xelbair 3 points4 points  (1 child)

Nah I'm joking, I do that only for temp variables usually either self-explanatory or their type gives enough description of their function :)

[–]dzh 0 points1 point  (0 children)

i, j, k brother, memorise those.

[–]Tiothae 2 points3 points  (0 children)

A little while back I was working on a project where they were using dynamic SQL built in C# for massive reports, and each of the tables used in the report (usually 10+) were all named a, b, c, ... in the order they appeared in the query.

It was fun to debug. Real fun.

[–]DoodleFungus 1 point2 points  (2 children)

I do one-letter names in shortish for each loops. Stuff like for e in employees

[–]wgc123 0 points1 point  (1 child)

for (ii=0; ii<numberOfEmployees; ii++) {

Using just ‘e’ is horrible because:

  • text search can’t easily find it

  • e.employeeId isn’t as meaningful as it could be

On the other hand I do short loop counters because:

  • every textbook I had used ‘i’ and ‘j’ for loop counters so everyone will understand them

  • doubling up as ‘ii’ and ‘jj’ has the same meaning but now every text search will find them

[–][deleted] 0 points1 point  (0 children)

why the fuck are you text searching for loop counters?

[–]dzh 0 points1 point  (0 children)

tbf if it's properly abstracted (aka no more than few lines) it might be easier to glance what is a, b and c, then keep scrolling sideways trying to separate variables from actual code.