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
Search - "hardcode"
-
Hahahaha, great start of Monday, discovering angry passive/aggresive comments from previous devs.. xD
// what is this? ever heard of CSS?
// css is for pussies, real men hardcode
// jQuery mixed with Ext. Awesome7 -
"You should always hardcode stuff, so that when the customer wants to change something, he'll pay us and we'll make it dynamic!"3
-
I'll use this topic to segue into a related (lonely) story befitting my mood these past weeks.
This is entire story going to sound egotistical, especially this next part, but it's really not. (At least I don't think so?)
As I'm almost entirely self-taught, having another dev giving me good advice would have been nice. I've only known / worked with a few people who were better devs than I, and rarely ever received good advice from them.
One of those better devs was my first computer science teacher. Looking back, he was pretty average, but he held us to high standards and gave good advice. The two that really stuck with me were: 1) "save every time you've done something you don't want to redo," and 2) "printf is your best debugging friend; add it everywhere there's something you want to watch." Probably the best and most helpful advice I've ever received 😊
I've seen other people here posting advice like "never hardcode" or "modularity keeps your code clean" -- I had to discover these pretty simple concepts entirely on my own. School (and later college) were filled with terrible teachers and worse students, and so were almost entirely useless for learning anything new.
The only decent dev I knew had brilliant ideas (genetic algorithms, sandboxing, ...) before they were widely used, but could rarely implement them well because he was generally an idiot. (Idiot sevant, I think? Definitely the idiot part.) I couldn't stand him. Completely bypassing a ridiculously long story, I helped him on a project to build his own OS from scratch; we made very impressive progress, even to this day. Custom bootloader, hardware interfacing, memory management, (semi) sandboxed processes, gui, example programs ...; we were in highschool. I'm still surprised and impressed with what we accomplished.
But besides him, almost every other dev I met was mediocre. Even outside of school, I went so many years without having another competent dev to work with. I went through various jobs helping other dev(s) on their projects (or rewriting them), learning new languages/frameworks almost every time: php, pascal, perl, zend, js, vb, rails, node, .... I learned new concepts occasionally (which was wonderful) but overall it was just tedious and never paid well because I was too young to be taken seriously (and female, further exacerbating it). On the bright side, it didn't dwindle my love for coding, and I usually spent my evenings playing with projects of my own.
The second dev (and one one of the best I've ever met) went by Novo. His approach to a game engine reminded me of General Relativity: Everything was modular, had a rich inheritance tree, and could receive user input at any point along said tree. A user could attach their view/control to any object. (Computer control methods could be attached in this way as well.) UI would obviously change depending on how the user could interact and the number of objects; admins could view/monitor any of these. Almost every object / class of object could talk to almost everything else. It was beautiful. I learned so much from his designs. (Honestly, I don't remember the code at all, and that saddens me.) There were other things, too, but that one amazed me the most.
I havent met anyone like him ever again.
Anyway, I don't know if I can really answer this week's question. I definitely received some good advice while initially learning, but past that it's all been through discovering things on my own.
It's been lonely. ☹2 -
THE FUCK WHY did the company which made the website I'm maintaining now ADD CUSTOM FACEBOOK LIKES AND TWITTER FOLLOWER WIDGETS - IN A SUBDIRECTORY OF THE THEME?
Guess what, you motherfuckers: One year after you made that damn page the Facebook API changed and your stinking widget is broken REQUIRING ME TO REWRITE MOST OF IT!
Also WHO THE FUCK LEFT HIS BRAIN ON HIS BEDSIDE TABLE the day he decided to HARDCODE ASSETS WITH AN http:// (no tls) URL? YES, browsers will block that shift if the website itself is delivered over tls, because it's a GAPING SECURITY HOLE!
People who sells websites that have user management and thus request authentication without AT LEAST OFFERING FUCKING STANDARD TLS SHOUD BE TARRED AND FEATHERED AND THEN PUT IN A PILLORY IN FRONT OF @ALEXDELARGE'S HOUSE!
Maybe I should be a bit more thankful - I mean I get payed to fix their incompetence. But what kind of doctor is thankful for the broken bones of his patient?9 -
this code is messy .. it has to be refactored..
abstact those classes to commom interfaces .. create a base class for all those common classes .. make this a parameter, make that a setting.. generalize this, pass a behaviour to that.. separate responsobilities..
hmm .. need to handle that special case .. let's just add a temp method for now to get it compiling .. //todo this later .. maybe add a couple virtual bools to handle the base class behaviour
238 compilation errors! .. let's do a static var for now on this.. and just add this for backward compatibility .. maybe hardcode that dll name, I know it'll NEVER change..
aah finally, all compiles..
oh..
this code is messy .. it has to be refactored.. -
PSA to /[devs who things it's a good idea|management who thinks it's a good idea to force your devs]+/g:
There currently exists 1543 (and counting) top level domains. My email addresses follow the pattern: /^[a-z]+@panduro\.guru$/ and I die a little inside whenever I get told my email addresses aren't valid because you thought it was a good idea (to force your devs) to hardcode "valid" top level domains. There is a reason why the filter for input type email does not include top level domains.
And you can't even begin to comprehend how mildly annoyed I get when I message their support and tell them what the problem is (because I'm nice enough to do that) they instead of telling me "thanks for informing us we'll look into it" they tell me "well just get a gmail or something". I should not have to order social status reducing items with my school mail (especially not since I'll loose that email ¾ pairs of years)7 -
Just spent 30 minutes confused as hell because an API call I wrote just randomly stopped working.
Forgot that I hardcoded an ID for testing purposes and then ended up creating a new object with a new ID.
Needless to say... they didn't match. Explains why my query retrieved zero results. -
O'joy has come, it is time to make the best if/switch statement...
Worst part I can't see a pattern in this, so I have to hardcode all this shit.
Even worser part, it has to be updated yearly... woop w00p9 -
Colleague: We need to deliver it today so let's hardcode some values in the code to make it work
Me: Ok you do it. I don't even want to see it!3 -
You know what, let me jump in on the "I hate PHP" bandwagon.
A couple months ago I upgraded my mail servers unattended. Roundcube got fucked for a couple of months, and I figured.. fuck it, I can still use Dovecot for authenticating with desktop mail clients like K-9.
Recently I unfucked it, turns out that it was an issue with the sock file in php-fpm. That's also when I noticed that PHP apparently hardcodes in its current version in the bloody socket file. Because why the fuck wouldn't you? It makes upgrades so much fucking easier!!! Said no fucking sysadmin ever!!!
And today I upgraded one of my mail servers to Ubuntu Server 18.04, finally, after a lot of hesitation. Bad decision, because now PHP got fucked YET AGAIN.
Again an issue with socket files? I have no fucking idea. systemctl shows no failed services (because you know PHP, why would you fail your service with an error message instead of throwing a meaningless 502 Bad Gateway, right?!!) and looking at the config files, well the socket file got its new php-fpm 7.2 file (still got the fucking version number hardcoded in) and thus I changed that socket file location in /etc/php/7.0...
devRant may just have been my rubber duck.
WHY THE FUCK DO YOU STINKING FUCKING PILE OF SHIT CALLED FUCKING PHP KEEP THE FUCKING 7.0 DIRECTORY OUT THERE WHEN YOU'VE UPGRADED, WITHOUT EVEN HAVING THE FUCKING BALLS TO RENAME THE MOTHERFUCKING DIRECTORY TO 7.2, IF YOU'RE GOING TO HARDCODE IN YOUR VERSION NUMBERS ANYWAY?!!!!!
Bloody fucking pile of fucking junk!!!!18 -
"Just hardcoded the thing so in tomorrow meeting works"
And it repeated before every fucking meeting. -
Was working on a game and I hated having to hardcode stuff I wanted to add so I started splitting it into external json files but by the end (and to an extent still learning it) learnt how to do mod support and simple user generated content, really cool stuff to learn about.
-
I love Android development, but I HATE make individual strings for each word in my apps. It's so tedious! There's gotta be a better way than telling myself, "Oh crap you better be a good boy and use Google's 'best practices' and not hardcode all your strings. Who knows you might make this app translatable in Portuguese someday and it'll be easy then!". I HATE it!!2
-
I hate discussions about how to name resources in a REST api. It’s not like there will ever exist a client that magically knows your conventions. At some point, you need to hardcode an URL in a client/browser. That’s fine, just keep it simple.
This has been a great source of bike-shedding in my job recently.
And don’t even get me started on HATEAOS...2 -
I was just going over some projects I need to transfer to others team members and was reminded of all the utility apps I created. Particularly on that covers Windows paths to Linux....
Or basically path.Replace("\\","/") in a GUI.
I actually use it a lot whenever I hardcode a file path in Java for testing or make some partial path Linux compliant.
I think it saves me a lot of time but I'm the only person I think that creates these apps... basically for anything I find myself repeating often... Even these simple things.
Am I weird? Or just good at identifying things that can be outsourced? And outsourcing them?16 -
just a reminder
if you think your 500 line python script with garbage hardcode values everywhere that brittly functions even for you is going to bring you thousands in subscriptions
fuck you7 -
What the FUCK Synology! Why the fuck would you change the sshd source and manually hardcode specific shells that the users are allowed to use! https://serverfault.com/a/470919
I'm trying to test a new sshd configuration here, and this motherfucker is not letting me log in because it keeps receiving SIGCHLD and failing to handle it (because of course chsh is missing!) and it won't let me in.
THEN HOW THE FUCK AM I LOGGED IN IN THE FIRST PLACE???6 -
The moment of decision whether to hardcode something or keep it dynamic ...cause knowing your clients ...they're definately gonna come back with more requirements
-
Just a quick follow up. I told you guys after rebooting my server by accident, I'll color in the terminals for my ssh connections.
Normal terminal in white. With the code to do it. Just a shell script with the name ssh earlier in the path than the actual ssh. That was the only solution that didn't fuck my auto-completion. compdef was somehow useless. But it is simple.
For some reason I had to hardcode the return color to white. Alacritty was not happy with just a no-color code. But whatever. Super useful. I won't accidentally restart non-host computers now.
Planning on extending this to have different colors according to the host. Like my homelab could be green. Live servers would be red. Dev servers blue. But that's for the future.
Just wanted to share my little improvement that will make my computing saver.8 -
I found out the importance of time complexity. It might not seem like a big difference between O(1) and O(2). But there's a big difference hardcoding 500 lines and 1000 lines of data.
I made a navigation app for school using dijkstra's algo. However it had no data available so I had to hardcode it. Long story short, there was a ton of hardcoding. Always try to improve the time complexity of the code you write.2 -
Did an assignment where we had to emulate deadlock using C and openMPI, I wanted to make a generalised resource manager process and create deadlock by locking some resources using the other processes, but my teammate said that would be too hard and instead the resource manager was hardcode with for loops for the number of transactions we were gonna make cause it was just a proof of concept.
Then my marker literally leads with, let me tell you the story of a good programmer, and a better programmer. The good programmer writes a function called destroy_earth(), but the better programmer writes a function called destroy_planet(earth) and passes in earth. I sighed so fuckin hard, I should have spoken up. -
I hardcode '/' instead of doing os.sep. My bad lol. Just assume it'll never be run on anything other then the server or one of the devs Linux stations.1
-
Height of Trench coding
WTF its 6.30 time to go home, but this fuc...ing bug isn't getting resolved, what the hell man. where did i do the mistake?
ok its time to go better i hardcode return 54;(expected answer) -
one of the few times i follow the existing structure and pattern i get told to fuck off and hardcode it instead because we want something temporary
-
i don't want to write the query and tests for query, for the data i need, for this thing we're deleting and the fact that the query and tests on the query would get deleted later
i'd rather just hard code the results i have
yes im lazy1 -
I did a challenge for an application which consisted of developing a landing page. I figured i wanna hardcode everything and not use any CMS or editor. Fknally i could use SCSS, ITCSS and BEM and it was the most fun i had in a long time. Going for PUG and TS next!1
-
Hey, just had a doubt. https://null-byte.wonderhowto.com/ take any website like this one (ideally any type of site with lots of links to other pages or posts). So my doubt is , is there a way to not hardcode all the links in the master page?. Or how exactly do professionals manage such sites?. I tried googling a lot but couldn't find the exact answer i was looking for. It'll be great if u can help me with this. Ik it's a noob question, but still😅8
-
I'm currently writing a discord bot using the discord.py library and I cannot decide how to structure my code.
I was thinking of writing it in modules, with a core script that would load any valid module class that would include an array of all the event hooks it wanted, whether it wanted to send messages and so on.
It's a nice way to practice python after my last working bot that I wrote in (Sit down for this) PHP using an outdated and abandoned wrapper (Yeah, event-based programming in PHP, I know)
Are there any better ways to do this? I really don't want to hardcode all the functions in, only to have it fall apart later after adding another feature...1 -
Agency adventures: Client always asking for bespoke hardcoded changes in the system. They want to save budget, so you suggest to make a admin screen for that frequent change so they can manage themselves and not pay you to do. You make that. Client keep creativity on top levels, asking for changes not supported by the new feature and that still have to be hardcoded.
Now, after the time estimates, they kindly ask: "can't you use that admin page to speed up your work?".