Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
Get a devDuck
Rubber duck debugging has never been so cute! Get your favorite coding language devDuckBuy Now
Search - "naming things"
So... I just remembered a story that's perfect for devrant.
My brother got into engineering in university, and during the second semester they had their introductory class to programming. They had weekly homeworks that the lecturer would check and give grades accordingly.
The factors that could influence the grading were: execution (meaning that the code would excecute as intended), efficiency and readabilty. The weeks passed and everyone was doing well, getting fairly good grades. Everyone was happy.
Until one day a random guy we'll call bob got the worst grade possible. Bob wasn't a bad student. He had over-the-average grades in all the weekly homeworks and even impressed the professor in some. Naturally, he was baffled when he saw his grade on the google spreadsheet. He was pretty sure his code ran well. He always tested it on different machines and OSs. So, at the end of the class, he went straight to the helper of the class, in a pretty imperative manner, to demand to know how the fuck he got that grade. It's impossible he got excecution, efficiency and readabilty, wrong. All three wrong? Impossible. Even the stupidiest kid in the class had some points on readabilty.
"Oh, so you are Bob. Huh?" said the helper in a laid-back attitude. "Come with me. Prof. X is waiting for you in his office."
This got Bob even more confused. As they approached the office, the courage he had in a first moment banished and gave way for nervousness and fear.
The helper nocks the door. "Prof., Bobs here"
As soon as Bob sits in the chair in front of Prof. X's, he knew something bad was coming.
"In all these years of teaching..." said Prof. X hesitantly. "In all these years of teaching I have not come even close to see something similar to what you've done. You should be ashamed of yourself." Needless to say, Bob was panicked.
"In all these years I have not seen such blatant mockery!" added the professor. "HOW THE FUCK DID YOU EVEN DARE TO SEND A HOMEWORK WITH SUCH VARIABLE NAMING" That's when Bob realised the huge mistake he made. "NEVER IN ALL THESE YEARS I HAVE SEEN SOMEONE NAME HIS VARIABLES *opens the file on his desktop *: PENIS, SHIT, FUCKSHIT, GAYFUCKING<insert Prof. X's name>MAN, GOATSE, VAGINAVAR, CUMFUNCTION, [...]" The list of obcenities went on and on. In each word, the professor hit the table harder than the last time.
Turns out Bob felt so in comfort with the ease of the course he decided to spice things up by using "funny naming conventions" while coding, and then tidying everything up before uploading the homework. This week he forgot, and fucked it big time.
So remember folks, always check your code before committing/giving it in/production. And always adhere to naming conventions.9
"There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors." - Phil Karlton3
There are two hard problems in computer science: naming things, cache invalidation and off-by-1 errors5
Don't be lazy when naming things. You yourself will be lost in all the a, b, c, ds, let alone your code reviewers.4
Today I was talking to my manager about html and css.
As i was explaining certain things about the structure of the files and the naming conventions for the css classes I mentioned the body of the document.....but got...er...distracted...yes distracted...and said booty instead of body.
She started laughing and I made a tomato look pale because of how red I got. I zipped my hoodie all the way up and talked from the hood hole around my face.
Best solution ever.5
This is something that happened 2 years ago.
1st year at uni, comp sci.
Already got project to make some app for the univ that runs in android, along with the server
I thought, omg, this is awesome! First year and already got something to offer for the university 😅
(it's a new university, at the time I was the 2nd batch)
Team of 12, we know our stuffs, from the programming POV, at least, but we know nothing about dealing with client.
We got a decent pay, we got our computers upgraded for free, and we even got phones of different screen sizes to test out our apps on.
No user requirement, just 2-3 meetings. We were very naive back then.
2 weeks into development, Project manager issues requirement changes
we have a meeting again, discussing the important detail regarding the business model. Apparently even the univ side hadn't figure it out.
1 month in the development, the project manager left to middle east to pursue doctoral degree
we were left with "just do what you want, as long as it works"
Our projects are due to be done in 3 months. We had issues with the payment, we don't get paid until after everything's done. Yet the worse thing is, we complied.
Month 3, turns out we need to present our app to some other guy in the management who apparently owns all the money. He's pleased, but yet, issued some more changes. We didn't even know that we needed to make dashboard at that time.
The project was extended by one month. We did all the things required, but only got the payment for 3 months.
Couldn't really ask for the payment of the fourth month since apparently now the univ is having some 'financial issues'.
And above all: Our program weren't even tested, let alone being used, since they haven't even 'upgraded' the university such that people would need to use our program as previously planned.
Well, there's nothing to be done right now, but at least I've learned some REALLY valuable lesson:
1. User Requirement is a MUST! Have them sign it afterwards, and never do any work until then. This way, change of requirements could be rejected, or at least postponed
2. Code convention is a MUST! We have our code, in the end, written in English and Indonesian, which causes confusion. Furthermore, some settle to underscore when naming things, while other chooses camel case.
3. Don't give everyone write access to repository. Have them pull their own, and make PR later on. At least this way, they are forced to fix their changes when it doesn't meet the code convention.
4. Yell at EVERYONE who use cryptic git commit message. Some of my team uses JUST EMOTICONS for the commit message. At this point, even "fixes stuffs" sound better.
Well, that's for my rant. Thanks for reading through it. I wish some of you could actually benefit from it, especially if you're about to take on your first project.3
There are two hard things in computer science: cache invalidation, naming things, and off-by-one errors.
-- Jeff Atwood5
Today I discovered what slowed my productivity the most: variable naming.
In a project I was naming many variables 'dirname' in different parts of the my code, but it represented 3 things: only the name of the directory, relative path + directory, and absolute path + directory.
I wasted to much time just figuring out which was which everytime until I finally decided to organize variables names better and see the wonders of the world. Result:
- dirname: only the name
- reldirname: relative path + dir
- absdirname: absolute path + dir
Such simple solution, yet took me years to actually see the benefits, my god
(First devRant post btw :3)7
I guess most of the things I do are a bad dev habit?
From not commenting stuff to commenting in German to copying stuff without looking at it, procrastinating a lot, not starting at all, bad naming of variables, bad... Everything? Idk, I have a lot to learn8
Many of you who have a Windows computer may be familiar with robocopy, xcopy, or move.
These functions? Programs? Whatever they may be, were interesting to me because they were the first things that got me really into batch scripting in the first place.
What was really interesting to me was how I could run multiples of these scripts at a time.
It was warm Spring day in the year of 2007, and my Science teacher at the time needed a way to get files from the school computer to the hard-drive faster. The amount of time that the computer was suggesting was 2 hours. Far too long for her. I told her I’d build her something that could work faster than that. And so started the program would take up more of my time than the AI I had created back in 2009.
This program would scan the entirety of the computer's file system, and create an xcopy batch file for each of these directories. After parsing these files, it would then run all the batch files at once. Multithreading as it were? Looking back on it, the throughput probably wasn't any better than the default copying program windows already had, but the amount of time that it took was less. Instead of 2 hours to finish the task it took 45 minutes. My thought for justifying this program was that; instead of giving one man to do paperwork split the paperwork among many men. So, while a large file is being copied, many smaller files could be copied during that time.
After that day I really couldn't keep my hands off this program. As my knowledge of programming increased, so did my likelihood of editing a piece of the code in this program.
The surmountable amount of updates that this program has gone through is amazing. At version 6.25 it now sits as a standalone batch file. It used to consist of 6 files and however many xcopy batch files that it created for the file migration, now it's just 1 file and dirt simple to run, (well front-end, anyways, the back-end is a masterpiece of weirdness, honestly) it automates adding all the necessary directories and files. Oh, and the name is Latin for Imitate, figured it's a reasonable name for a copying program.
I was 14, so my creativity lacked in the naming department >_<1
There are two hard things in computer science: cache invalidation, naming things, and off-by-one errors.
This is really the stuff I have to deal on daily basis.
Ever want to smack someone in the face with a sea bass? Like left out of the water for 3 days with all kinds of juicy and smelly goodness?
When we get an X number system errors, an email is sent to our team. Couple of hours ago I had to move the alerts from one system to another, re-naming some because I suck at naming things. I guess when I copied, I duplicated one. About an hour ago we get a system alert (as it should, there was a server hiccup) and there were two emails with the same data (just named differently)
DevA: “Why are there two emails?”
Me: “Oh, that’s me. I think I copied the alert instead of move. I’ll fix it tomorrow.”
DevA: “Hmm, but the data is the same. It’s a duplicate.”
Me: “Yea, I know. Networking responded and said it’s fixed. We won’t get another email.”
- 15 minutes later
DevA leans over and says to the boss (who was in a meeting and just sat down)…
DevA: “I looked at the alert, it’s duplicated, but the name is different. I don’t understand why.”
Me: “Like I said, the alert is duplicated. When I migrated, I copied instead of moved. No big deal.”
DevA: “Oh …oh ..yea.…OK.”
- 5 minutes later
DevA: “I looked at the query, we might have to add a filter to prevent duplicate emails. Probably some logic problems in the search.”
Me: “I just deleted the duplicate alert.”
DevA: “Oh…OK…that fixes it too.”
Good lord…as I was typing this, he just told another dev the ‘duplicate’ emails were because of a logic bug in the search. I’m getting my fishing pole.1
Today i found variable called "booleanValue". So it IS true, that there are two hard things in computer science: cache invalidation and naming things...3
Doing my internship now, and seems like I need to get used to naming files and other things properly again. No more 'that thing','stuff','important shit','that other thing' etc file names1
I guess In software development, there are 11 most difficult tasks:
- Naming variables/functions, because the names should be meaningful but not verbose
- Write an appropriate git commit message, because f*ck u....
- Refactoring, because it involves the first two things and more...1
Fuck sake, so my bank has been migrating/rolling out new IT system and app/site have been broken for about a week (others noted evidence of devs debugging in production)
Assuming I don't lose my money as some mischievous assholes will inevitably exploit the fuck up, and rob the bank, I will be moving my funds to a different bank...
In mean time I'm trying to prepare for uni, and they're making a ton of semi-random changes in addition to rolling out a site with course details and info along those line, and good fucking god is it bad.
Is is slow as fuck? Check. Does it use never-seen-before naming for standard things? Check! Is the UI pulled from late 90's? YOOU BETCHA! Are the pages bloated with unnecessary content? Fuck yeah! Do I get SQL exceptions when I finally locate my course? Of course I do. Does clicking "back" take me back to the landing page instead of previous page, when I'm several steps deep? .....
I could keep going, but don't feel like ranting and feel more like punching someone in the throat.repeatedly.
"There are only two hard things in Computer Science: cache invalidation, naming things, and off-by-one errors."1
Reviewing some code the other day, seeing a lot classes like:
I get the idea..Microsoft is doing it...disguising complexity with clever adjectives.
I think in my next project I'm going to start naming things like
Repository (cause, every framework needs one)
Then in a year and a half-dozen other devs adding their bits, someone asks "SpaghettiMonster...WTF?...why is this data access called..<dev looks at code> Oh good Lord ...oh well...at least the class name is accurate"2
Working on small scale games to working on a full blown VR 4 person MO game, the scale from one to another is pretty big, I seem to manage somehow though :D takong it all one step at a time, making sure I don't use any repeated code in places that could need it, cleaning up classes so it's easier to access for debugging, building nice inspector things so people that create art/particles and such don't have a hard time understanding my weird naming conventions.
I could go on and on really xD i've learnt so much and i'm still learning, and I really have nothing to rant about thesw days so i've gone back to lurk mode lol
It's always so funny when a person starts using multiprocessing in Python, because if there's "multi", obviously THIS is the thing that should free the person from a headache of having GUI frozen. You know, because it does "multiple" ehm... stuff..... at once....... yeah. And it's popular, it must work for me too! Oh how often I see this. :D
Stupidly enough that's not entirely a user's fault, but Python's as naming things with "multi" doesn't end up well basically with anything. I bet if there was such thing as multipointer in C half of the beginners would be totally fucked and the other one would just break their machines beyond repair with a joy.
Yet... reading the damn documentation should be a requirement before using threading or multiprocessing to prevent the confusion, because there's this funny difference between multiple threads and multiple processes which will haunt you unless you see what's what and use it correctly.2
I'm always afraid to put apostrophe characters when naming things online, even if it is just a photo album.1
No no no. That's it. Less than 2 years experience supposed to be leading a team of 12 soon to be 17 most of which have more experience than me! Been given sever admin responsibilities, training and managing 2 large frame works in addition to everything else I was doing before.
With the current set of projects we were given half the amount of time to do over twice the amount of work. Management seems to expect constant over time. And I keep being nagged by management to finish x,y,z. Every thing is high piority and I keep being asked to switch between tasks every hour or so nothing gets completed when this happens every time I make them aware this happens. The worse thing is that the CEO has a way of naming and shaming people who fall behind work infront of the entire company.
I have only been surviving thanks to a few saints in the team who just get on with the work without argument but now found out a bunch of these are moving to better companies!!!
I like helping people but with everything that is going on I can't find time to and I know at times I end up coming across inpatient with them that they don't deserve. But if you are part of a team please try and solve your issue yourself before asking others every half an hour there are too many of you and I need to get things done too.
And why is it so damn hot sitting at the desk sweating.
Ok I am prob on my meriod and being over the top grumpy. I want to find a new job but so tired in the evenings that I just want to collapse on my bed and do nothing. At end of writing this and feel a little better.3
- Naming things in English as a non-native English speaker.
- Maintaining a good sleep schedule as a remote worker.
Super inconsistent function naming in PHP.
And how some things are object-oriented and some are functions.3
There are only 2 hard problems in software:
1. Naming things
2. Cache invalidation
3. Off by 1 errors3
Would you guys get annoyed if someone(me) made a habit of going through your code and cleaned things up, such as clearer naming, untangling ifs with early returns and so on.
I mean doing stuff that doesn't change the behavior, but makes it easier for the next person.11
Just starting with scala. And while I dig the more functional programming approach I am having the hardest of times dealing with naming higher-ordered functions, in my case a function returning another function.
Started out as `foo`, went through quite a lot of changes, and now it has become the beast: `createReplacePriceByPassengerConfigurationMapperFunction`. It won't stay that way but: GOSH! Naming. It's hard! Or I might as well suck at functional programmig. It's not like that these two things are necessarily mutually exclusive.
Asp seems to actually have feelings.
Today I tried to get an asp page to run for company stuff. Ok fair enough I load apache and all the modules required for it to run on Ubuntu. Everything went fine and nothing complained what a great start!
Let's create a directory called /var/www/html/astrash ( I wanted to be fun ok? ) and created a sample index.asp file and configured the paths etc accordingly.
So I went to my beloved browser and typed in localhost/astrash/index.asp
Guess what happened? Right. I could only download the file.
Tried to change several things and Googled a bit but the things I tried didn't work.
So I figured let's create the directory /var/www/html/asp and an index.asp to go along. Same content. Same owner same access bits.
Went to localhost/index.asp and I saw the sample page!
I laughed my ass off at this actually thinking asp knew that I was a dick in naming the folder like that 😂
PS: yes I know it's probably a misconfiguration but it's funny nonetheless1
When you get an assignment by mail,
- you do those changes exactly as being asked, albeit one insignificant extra visual thing,
- you send back exactly what's changed (which is exactly what was being asked, but naming things as they are, clearer than I can ever explain changes),
- you go to the person that has assigned the very thing, explain it, he seems to get it,
Then.. a few hours later.. you get a reply via mail:
"Come explain what you're saying here, because I don't get it."
Let's talk about one of the two hard things in programming - what's your preferred test naming convention and why? I'll have to create plenty of those now, while the project I'm working on is still small, and I don't know which way to go. It's Spring (Java), but I don't think it matters that much 🤷4
I have to deal with the hardest part of programming: naming things! i fucking hate it, being so incredible uncreative finding a name for a side project..
So heres my idea: I want to build a little cli tool (and probably in the future an app or a web interface) with a rest api on my server for simple storing text snippets. I will be a simple key value store, but my goal is experimenting with new languages and software ;)
I can't imagine a cool name for that thing, do you have an idea? :)2