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 - "duplicate code"
-
Today was my last day of work, tomorrow i have officially left that place. It's a weird feeling because i'm not certain about the future.
The job was certainly not bad, and after all i read on devrant i'm beginning to believe it was one of the better ones. A nice boss, always something to eat/drink nearby, a relaxed atmosphere, a tolerance for my occasionally odd behaviour and the chance to suggest frameworks. Why i would leave that place, you ask? Because of the thing not on the list, the code, that is the thing i work with all the time.
Most of the time i only had to make things work, testing/refactoring/etc. was cut because we had other things to do. You could argue that we had more time if we did refactor, and i suggested that, but the decision to do so was delayed because we didn't have enough time.
The first project i had to work on had around 100 files with nearly the same code, everything copy-pasted and changed slightly. Half of the files used format a and the other half used the newer format b. B used a function that concatenated strings to produce html. I made some suggestions on how to change this, but they got denied because they would take up too much time. Aat that point i started to understand the position my boss was in and how i had to word things in order to get my point across. This project never got changed and holds hundreds of sql- and xss-injection-vulnerabilities and misses access control up to today. But at least the new project is better, it's tomcat and hibernate on the backend and react in the frontend, communicating via rest. It took a few years to get there, but we made it.
To get back to code quality, it's not there. Some projects had 1000 LOC files that were only touched to add features, we wrote horrible hacks to work with the reactabular-module and duplicate code everywhere. I already ranted about my boss' use of ctrl-c&v and i think it is the biggest threat to code quality. That and the juniors who worked on a real project for the first time. And the fact that i was the only one who really knew git. At some point i had enough of working on those projects and quit.
I don't have much experience, but i'm certain my next job has a better workflow and i hope i don't have to fix that much bugs anymore.
In the end my experience was mostly positive though. I had nice coworkers, was often free to do things my way, got really into linux, all in all a good workplace if there wasn't work.
Now they dont have their js-expert anymore, with that i'm excited to see how the new project evolves. It's still a weird thing to know you won't go back to a place you've been for several years. But i still have my backdoor, but maybe not. :P16 -
One step through the door my wife whips around, a look so disgusted she barely seems human. "What's that smell?" she cries. "It's you! You smell like...like bad code!"
Indeed, I am covered with the scent of the forbidden love child of a man who read half a chapter on if-then statements and then pushed out into the world, earthworm-like, a mangled misshapened gelatinous mass that my employer gave the title of line-of-business application purely out of pity.
For more days than I'd like to count I have been porting a ColdFusion 5 application to .NET. Initially written in 2000 and last touched in 2006, it has a data architecture comparable to Dresden after the second world war. It features a table solely comprised of seven columns of IDs so that joins can be made between other tables lacking a common key. Columns that should be contained within a single table spread out among multiple tables. Single columns containing data that should be multiple columns (with handy flags to separate the subsets). A view with 14 joins that playfully displays unintended results. And so much more spread out over almost 200 stored procedures, views, triggers, and tables on the SQL server, and dozens of additional ADO-like SQL statements within the ColdFusion itself. Fortunately, the application overcomes these issues by having absolutely no data validation while allowing nulls pretty much everywhere.
When I am done this will be a very nice ASP.NET MVC app with at least 150 less stored procs, views, and tables. Auto-generated duplicate entries will be a thing of the past. Pop-up windows that inexplicably refresh the underlying screen to display a different part of the program than the one the user wants will be eliminated. And a UI based on the colors of a Rubik's Cube with usability that Mr. Rubik would find challenging will disappear with only the trauma of using it left behind.
Sadly, this is not my worse legacy code experience. Just the most recent. Just the most recent stench added to a lifetime of bathing in code rot.3 -
For years I've had this friend, since high school, and now we are 21. Our paths had always been different, i decided to go to a technical high school that provides more specialized education (around IT in this case) and he went to a normal high school that provides a more wide range of knowledge and barely anything related to what we both wanted to study. Different tastes for different people huh? Well sure but during that time he was being snobbish towards me because normal high schools are considered more prestigious, or rather, technical high schools are infamous for attracting lazy students or students that don't wanna move up to a university.
We fought a few times over this, sometimes even stopped talking for long periods of time but we always got back together. A few years later, after our university entry exams I joined what roughly translates to technical university, its just more focused on practical IT stuff with a lot of lab courses every semester. He joined a more academically inclined one that is half economics and half IT (applied informatics). And now he has another thing to be snobbish about since the relation between the 2 unis is similar to that between the high schools but I don't care anymore, I don't feel like im missing out on anything with my choices.
3 days ago he called me on discord to check his python script and why it wasn't working. Good Odin that piece of code was worse that anything I've seen. Littered with global variables, inconsistent function and variable names, duplicate code, unused variables. I was honestly shocked and disappointed cos he always mentions different projects he is working on, an aspiring web developer.
I took those 300 hundred lines of atrocity and turned them into 80. But more importantly it was something that worked and did the damn job well. A thing of beauty.
I don't know if he was more surprised that i got it working or that it was so different from his initial "solution".
All of a sudden he is not so dismissive of me...
Fuck you for underestimating me and every choice I made to get here.
P.S. I kept his original code, always gives me a shit eating grin.12 -
I'm editing the sidebar on one of our websites, and shuffling some entries. It involves moving some entries in/out of a dropdown and contextual sidebars, in/out of submenus, etc. It sounds a little tedious but overall pretty trivial, right?
This is day three.
I learned React+Redux from scratch (and rebuilt the latter for fun) in twice that long.
In my defense, I've been working on other tasks (see: Alerts), but mostly because I'd rather gouge my freaking eyes out than continue on this one.
Everything that could be wrong about this is. Everything that could be over-engineered is. Everything that could be written worse... can't, actually; it's awful.
Major grievances:
1) The sidebars (yes, there are several) are spread across a ridiculous number of folders. I stopped counting at 20.
2) Instead of icon fonts, this uses multiple images for entry states.
3) The image filenames don't match the menu entry names. at all. ("sb_gifts.png" -> orders); active filenames are e.g. "sb_giftsactive.png"
4) The actions don't match the menu entry names.
5) Menu state is handled within the root application controller, and doesn't use bools, but strings. (and these state flags never seem to get reset anywhere...)
6) These strings are used to construct the image filenames within the sidebar views/partials.
7) Sometimes access restrictions (employee, manager, etc.) are around the individual menu entries, sometimes they're around a partial include, meaning it's extremely difficult to determine which menu entries/sections/subsections are permission-locked without digging through everything.
8) Within different conditionals there are duplicate blocks markup, with duplicate includes, that end up render different partials/markup due to different state.
9) There are parent tags outside of includes, such as `<ul>#{render 'horrific-eye-stabbing'}</ul>`
10) The markup differs per location: sometimes it's a huge blob of non-semantic filthiness, sometimes it's a simple div+span. Example filth: section->p->a->(img,span) ... per menu entry.
11) In some places, the markup is broken, e.g. `<li><u>...</li></u>`
12) In other places, markup is used for layout adjustments, such as an single nested within several divs adorned with lots of styles/classes.
13) Per-device layouts are handled, not within separate views, but by conditionally enabling/disabling swaths of markup, e.g. (if is_cordova_session?).
14) `is_cordova_session` in particular is stored within a cookie that does not expire, and within your user session. disabling it is annoying and very non-obvious. It can get set whether or not you're using cordova.
15) There are virtually no stylesheets; almost everything is inline (but of course not actually everything), which makes for fun layout debugging.
16) Some of the markup (with inline styling, no less) is generated within a goddamn controller.
17) The markup does use css classes, but it's predominately not for actual styling: they're used to pick out elements within unit tests. An example class name: "hide-for-medium-down"; and no, I can't figure out what it means, even when looking at the tests that use it. There are no styles attached to that particular class.
18) The tests have not been updated for three years, and that last update was an rspec version bump.
19) Mixed tabs and spaces, with mixed indentation level (given spaces, it's sometimes 2, 4, 4, 5, or 6, and sometimes one of those levels consistently, plus an extra space thereafter.)
20) Intentional assignment within conditionals (`if var=possibly_nil_return_value()`)
21) hardcoded (and occasionally incorrect) values/urls.
... and last but not least:
22) Adding a new "menu sections unit" (I still haven't determined what the crap that means) requires changing two constants and writing a goddamn database migration.
I'm not even including minor annoyances like non-enclosed ternaries, poor naming conventions, commented out code, highly inefficient code, a 512-character regex (at least it's even, right?), etc.
just.
what the _fuck_
Who knew a sidebar could be so utterly convoluted?6 -
Ticket: Add <feature> to <thing>. It works in <other things> so just copy it over. Easy.
Thing: tangled, over-complicated mess.
Feature: tangled and broken, and winds much too deep to refactor. Gets an almost-right answer by doing lots of things that shouldn't work but somehow manage to.
I write a quick patch that avoids the decent into madness and duplicates the broken behavior in a simple way for consistency and ease of fixing later. I inform my boss of my findings and push the code.
He gets angry and mildly chews me out for it. During the code review, he calls my patch naive, and says the original feature is obviously not broken or convoluted. During the course of proving me wrong, he has trouble following it, and eventually finds out that it really is broken -- and refuses to admit i was right about any of it. I'm still in trouble for taking too long, doing it naively, and not doing it correctly.
He schedules a meeting with product to see if we should do it correctly. He tells product to say no. Product says no. He then tells me to duplicate the broken behavior. ... which I already did.
At this point I'm in trouble for:
1) Taking too long copying a simple feature over.
2) Showing said feature is not simple, but convoluted and broken.
3) Reimplementing the broken feature in a simpler way.
4) Not making my new implementation correct despite it not working anywhere else, and despite how that would be inconsistent.
Did everything right, still in the wrong.
Also, they decided I'm not allowed to fix the original, that it should stay broken, and that I should make sure it's broken here, too.
You just have to admire the sound reasoning and mutual respect on display. Best in class.19 -
I'm leaving my job.
That had already been decided when I learned that the only other front end guy at the company put in his two weeks notice. I immediately decided that I was morally obligated to put in my 4 months notice to give the company enough time to find a replacement (because, contrary to the beliefs of some programmers, front end plays a critical role in web dev).
With only 2 weeks left, I was put on his project to do some "simple design work".
Jesus christ in heaven alive and dead...
I've never in my career seen CSS with such an intense level of specificity -- nobody on that team should have ever let that code get so out of control.
I've spent the past week cursing, walking out of the room, whispering "I can't believe you've done this", ranting to non-developer friends.
Here's an example: the application has a panel used all over the place with a header and a body. Every Single View has it's own duplicated panel, each with its own unique class names and CSS. And that's just one element.
Every view has hundreds of lines of duplicated CSS. Every button, link, list, all with unique styles.
To any junior developer reading this, please hear me: Write one block of CSS for any element that will be reused. DO NOT duplicate your code when it can be used over and over.
/rant4 -
I have to refactor code from an intern. He's VERY lucky that he already left the company.
If I'd say he programms like the first human that would be very insulting to that first human.
It looks like code at first sight, but when you try to understand what he was doing to achieve his goal you get a brainfuck. Duplicate code, unused code, dumb variable names like blRszN.
He wrote unittests like "expects Exception to be thrown or Server returns Statuscode 500".
Yes, Exception, the generic one.
THESE FUCKING TESTS ARE GREEN BECAUSE YOU DID NOT ACTUALLY TEST SOMETHING.
GREEN IN THIS CONTEXT MEANS: YOUR PRODUCTION CODE IS A BIG PILE OF SHIT.
I already removed 2 bugs in a test which caused another exception than the "expected" one and the test does still not reach the actual method under test.
Dumb fucktard.
The sad thing: The fuckers who did the code reviews and let this shit pass are still here writing code.4 -
Ok, so when I inherit a Wordpress site I've really stopped expecting anything sane. Examples: evidence that the Wordpress "developer" (that term is used in the loosest sense possible) has thought about his/her code or even evidence that they're not complete idiots who wish to make my life hell going forwards.
Have a look at the screen shot below - this is from the theme footer, so loaded on every page. The screenshot only shows a small part of the file. IT LITERALLY HAS 3696 lines.
Firstly, lets excuse the frankly eye watering if statement to check for the post ID. That made me face palm myself immediately.
The insanity comes for the thousands of lines of JQuery code, duplicated to hell and back that changes the color of various dividers - that are scattered throughout the site.
To make things thousands of times worse, they are ALL HANDED CODED.
Even if JavaScript was the only way I could format these particular elements I certainly wouldn't duplicate the same code for every element. After copy and pasting that JQuery a couple of times and normal developer would think one word, pretty quickly - repetition.
When a good developer notes repetition ways to abstract crap away is the first thought that comes to mind.
Hell, when I was first learning to code god knows how long ago I always used functions to avoid repetition.
In this case, with a few seconds though this "developer" could have created a single JQuery handler and use data attributes within the HTML. Hell, as bad as that is, it's better than the monstrosity I'm looking at now.
I'm aware Wordpress is associated with bad developers due to it's low barrier to entry, but this site is something else.
The scary thing is that I know the agency that produced this. They are very large, use Wordpress exclusively and have some stupidly huge clients that would be know nationally.
Wordpress truly does attract some of the most awful "developers" and deserves it's reputation.
If you're a good developer and use Wordpress I feel sorry for you, as you're in small numbers from my experience.
Rant over, have vented a bit and feel better. Thanks Devrant.6 -
*opens Eclipse to do some dev work*
*Pressed Ctrl + Alt + down arrow to duplicate code*
*sees screen upside down*
Thank you Intel. I needed that...5 -
I was teaching my fiancée how not to write duplicate code. After a while of me ranting about why you shouldn't do that she made a dostuff() method and dumped all the duplicate code into it.
I kinda like the result of that.
On that note, i finally made an account after lurking here for weeks. So, Hello!1 -
I'd say one of the best advice a dev gave me, was that, I should not write duplicate code, but rewrite these parts to a single function.
And another one: If you use specific values in the code, instead of putting it in multiple places, assign it to a variable at one place and use the variable later on.
These advices sound quite trivial, but I think every beginner should learn these as eary as possible.
Boiiii have I seen shitty code from people who don't give a hobo's ass about maintainable code.
Be a good coder.
Write for quality, not quantity.
Care about your successor.
Thank you.
If not, I will fucking find you, fill your guts with napalm and light you up alive on a rusty pole while laughing hysterically.1 -
The only serious, as in customer affecting, bug I never git fixed was an indexing bug that caused an exception requiring manual intervention by one of us.
Despite going at it for many years I never found the root cause before I left the company.
The reason it was so difficult was that it only occurred every second month or less and with different customers.
It was also not triggering directly when the error occurred but a while later once the error had caused accumulated errors until one value got negative.
Also, it was a combination SQL, backend code and frontend js and the time from initial error until an invalid value could be hours, days or even weeks.
And we never ever managed to replicate it our self and found no common pattern between occasions.
We think it was some kind of race condition when updating the db that caused duplicate values or a hole in the index series (db transaction or db index was not an option for various reason that would require a redesign of the central tables and most if the central code).
This then grew into multiple error on consecutive updates until one f them resulted in a negative number that then caused a regex in js to fail.2 -
Sometimes I really fucking hate this company
The code is an absolute shitshow filled with static classes, untestable and duplicate code, on top of that my boss doesn’t like open source
Yeah so i’m not allowed to use a mapping library or something because “Uhhh like uhh we don’t have a contract with the company so who knows what’ll happen when the maintainers leave the project”
I understand his reasoning but it’s an absolutely retarded reasoning especially considering most of the .NET platform is open source nowadays
Writing a webapp from scratch now as well and I HAVE to use vanilla javascript and AngularJS 1.5 even though all the developers here told me they would like to upgrade to Typescript and Angular 2+ but it’s never gonna happen I suppose
Oh and he doesn’t like TDD and our only product is SAAS so imagine the amount of bugs being pushed simply because we don’t have time to write tests or even manually test, let alone refactor our horseshit codebase
AND i have to pay for gas myself which takes 200€ out of my bank account a month just for driving to work whilst I’m only getting a mediocre pay
Have a job interview tomorrow and another one on tuesday4 -
Lets create a library.
Lets use that library in a project.
Lets wrap the library call in a wrapper functione to remove duplicate code.
Lets add an overloaded wrapper call that wraps the wrapper call that calls the library to partially undo the duplicate code removal.
Lets add another overloaded wrapper call that wraps the wrapper call that wraps the wrapper call that calls the library to partially undo the duplicate code removal.
How I love it. Not.
Sometimes redundancy makes sense, especially when it are two lines which make it obvious whats going on vs a single line that leads to a fuckton of overloaded wrapper functions.
Sheeesh.
Today in "code monkeys deserve divine punishment".
Another funny thing is creating a Helper class for Junit 5 tests, making it instantiable and adding to it all kinds of shit like testcontainer creation, applications instantiation, mocks, ....
... Then " crying " why the tests are so slow.
Yeah. Logic. Isolation of concerns, each test should be a stand alone complex.
But that would lead to redundancy... Oh no.
Better to create a global state god object.
Some devs... Really amaze me, especially when they argument in ways that makes one really wonder whether they are serious or just brain dead.14 -
I hired 2 fresh out of school junior devs to work with me on my old web app.
They were brilliant, knew a lot of things, and were motivated.
They started complaining about how the code was shit, the db was shit, there were no best practices, the technology was old, bug fixing was boring, no comments in code.
I felt bad, very bad during 3 years, because they were absolutely right. I tried to work with them through better coding practices, rewriting, documenting etc.
Now they both have left.
I'm alone maintaining and evolving the application.
And I start to come across the code THEY developed.
What a bunch of shit. SQL queries bringing down the server. Duplicate code, because they didn't want even read the old one. Useless comments.
Performance killing functions. Exceptions swallowed without mercy. I have to clean up they poop.
I feel somewhat better, though. The application is still growing and holding the ground after many years and generating at least 800K$ per year in revenues.
Maybe better, but sad. I really wanted to share the project with somebody else but I failed, and I'm left alone....12 -
Okay, seriously, are there some secret question-asking ninja skills i am lacking, or does some people just insist on confusing people and wasting time?
I was working on this small bug. Super tiny. Basically a counter that was way off since it counted some duplicate values. Simple, right?
I decided to ask a clarifying question to the lead dev, since i am still new to the company. Really simple. Do we remove duplicate values, do we ignore them in the count when they occur, or is it actually working as expected?
He decides to answer with a long message on what the issue is. That is not what I asked, so I ask again in a slightly different way, thinking he didn't understand the question.. and he answers the same, in a slightly different way.
We go back and forth like this for 30-40 minutes, until I got tired of it and directly asked "I am asking what solution we want, not what the issue is"..
He finally picks option A. Fine. I made the adjustment and pushed my code. He checks it out, and apparently it's wrong.
After a long series of questions (again), it turns out the solution he now describes is exactly what I listed as option C...
A bug that should take 10 minutes to fix ended up taking over 2 hours. Awesome waste of time.5 -
I sincerely like the moment, when i train a newbie to code .NET showing him/her how far OOP in .NET goes.
I love to give the following example:
var s = "round and round it goes";
s = s.ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString().ToString();
And yeah. It's totally fine.
Because each component of .NET is inherited of object. And the class object supports you with the function "ToString()".
After that, in most of the cases, i get a slightly irritated look from the newbie.
Than i say, "welcome to Microsoft" ;)
I finally add, that the compiler of .NET finally identifies duplicate results and refactores the given code before execution ^^
Coding Is fun, as long as you get the big picture/concept of the language you're using.2 -
I spent two weeks writing a WordPress plugin to take some form data, process it through another website, and take the result to Salesforce. the client had a "Salesforce specialist" doing everything on the Salesforce side and refused to give me access to see if the data was properly pushed through.
Finally I got it in working condition when suddenly it stopped working, I hadn't changed anything since it worked so I asked if he could have possibly changed something. We argued for over 4 hours about who changed something, the whole time I was looking for the error in my code. At 6pm I finally told him I would need to take a look at it tomorrow.
Overnight he sent me an email:
"Hey, sorry about the confusion yesterday, I set Salesforce to deny duplicate email entries, looks like once I removed that everything is working."6 -
So ok here it is, as asked in the comments.
Setting: customer (huge electronics chain) wants a huge migration from custom software to SAP erp, hybris commere for b2b and ... azure cloud
Timeframe: ~10 months….
My colleague and me had the glorious task to make the evaluation result of the B2B approval process (like you can only buy up till € 1000, then someone has to approve) available in the cart view, not just the end of the checkout. Well I though, easy, we have the results, just put them in the cart … hmm :-\
The whole thing is that the the storefront - called accelerator (although it should rather be called decelerator) is a 10-year old (looking) buggy interface, that promises to the customers, that it solves all their problems and just needs some minor customization. Fact is, it’s an abomination, which makes us spend 2 months in every project to „ripp it apart“ and fix/repair/rebuild major functionality (which changes every 6 months because of „updates“.
After a week of reading the scarce (aka non-existing) docs and decompiling and debugging hybris code, we found out (besides dozends of bugs) that this is not going to be easy. The domain model is fucked up - both CartModel and OrderModel extend AbstractOrderModel. Though we only need functionality that is in the AbstractOrderModel, the hybris guys decided (for an unknown reason) to use OrderModel in every single fucking method (about 30 nested calls ….). So what shall we do, we don’t have an order yet, only a cart. Fuck lets fake an order, push it through use the results and dismiss the order … good idea!? BAD IDEA (don’t ask …). So after a week or two we changed our strategy: create duplicate interface for nearly all (spring) services with changed method signatures that override the hybris beans and allow to use CartModels (which is possible, because within the super methods, they actually „cast" it to AbstractOrderModel *facepalm*).
After about 2 months (2 people full time) we have a working „prototype“. It works with the default-sample-accelerator data. Unfortunately the customer wanted to have it’s own dateset in the system (what a shock). Well you guess it … everything collapsed. The way the customer wanted to "have it working“ was just incompatible with the way hybris wants it (yeah yeah SAP, hybris is sooo customizable …). Well we basically had to rewrite everything again.
Just in case your wondering … the requirements were clear in the beginning (stick to the standard! [configuration/functinonality]). Well, then the customer found out that this is shit … and well …
So some months later, next big thing. I was appointed technical sublead (is that a word)/sub pm for the topics‚delivery service‘ (cart, delivery time calculation, u name it) and customerregistration - a reward for my great work with the b2b approval process???
Customer's office: 20+ people, mostly SAP related, a few c# guys, and drumrole .... the main (external) overall superhero ‚im the greates and ur shit‘ architect.
Aberage age 45+, me - the ‚hybris guy’ (he really just called me that all the time), age 32.
He powerpoints his „ tables" and other weird out of this world stuff on the wall, talks and talks. Everyone is in awe (or fear?). Everything he says is just bullshit and I see it in the eyes of the others. Finally the hybris guy interrups him, as he explains the overall architecture (which is just wrong) and points out how it should be (according to my docs which very more up to date. From now on he didn't just "not like" me anymore. (good first day)
I remember the looks of the other guys - they were releaved that someone pointed that out - saved the weeks of useless work ...
Instead of talking the customer's tongue he just spoke gibberish SAP … arg (common in SAP land as I had to learn the hard way).
Outcome of about (useless) 5 meetings later: we are going to blow out data from informatica to sap to azure to datahub to hybris ... hmpf needless to say its fucking super slow.
But who cares, I‘ll get my own rest endpoint that‘ll do all I need.
First try: error 500, 2. try: 20 seconds later, error message in html, content type json, a few days later the c# guy manages to deliver a kinda working still slow service, only the results are wrong, customer blames the hybris team, hmm we r just using their fucking results ...
The sap guys (customer service) just don't seem to be able to activate/configure the OOTB odata service, so I was told)
Several email rounds, meetings later, about 2 months, still no working hybris integration (all my emails with detailed checklists for every participent and deadlines were unanswered/ignored or answered with unrelated stuff). Customer pissed at us (god knows why, I tried, I really did!). So I decide to fly up there to handle it all by myself16 -
I really like this book on the basis of the philosophy overall, no this doesn’t solve all problems but it’s a good baseline of “guidelines/rules” to program by. Good metrics or goals to architect and design software projects high and low level projects.
Fight Software Rot
Avoid duplicate code
Write Flexible, dynamic, adaptable code
Not cargo cult programming and programming by coincidence.
Make robust code, contracts/asserts/exceptions
Test, Test, and TEST again and Continue testing.. this is a big one.. not so much meaning TDD.. but just testing in general never stop trying to break your software.. FIND the bugs.. you should want to find your bugs. Even after releasing code the field continue testing.24 -
Mentors, take note. This is a best practice over here.
I've spent two days digging through obscure documentation trying to accomplish one of those tasks that is simple in word and complex in deed. Namely, I wanted to concatenate (not delete) near-duplicate values in Pandas before rendering the data into a graph. Two days beating my head against the wall.
One of my mentors (I'm an intern) heard about the issue, wrote in the proper line (a very specifically and archaically formatted command), and pushed it to repo without even asking for thanks. Works like a charm and he saved my rear end. What a guy.
Please, mentors, don't leave your interns hanging on problems where the only solution is shrouded in dubious documentation and magic syntax. Especially when there's a deadline involved. Let them struggle on logic flow and writing good code.
Be like this guy. You'll build the importance of teamwork and your intern will think you're a wizard.2 -
Okay it's FUCKing rant time... FUCK you prestashop!
FUCK your utterly bizarre "coding standard"
Also a big FUCK your config files, since when did config files start to include application logic, multiple includes/requires and modification of super-globals. When did I miss that memo?
This file is full of so much FUCKing horseshit, my FUCKing testicles hurt.
FUCK your "module overrides", yes let's duplicate 20-30MB senseless horror code into another folder, just so we can modify one line, without having future updates breaking our stuff.
And your attempt to migrate to a symphony stucture is FUCKing pathetic, do it properly, or don't do it at all.. FUCKtards..
I know wordpress can be bad, but this...
Prestashop takes FUCKing lousy, headache/cancer- giving, piece of crapware to the next FUCKing level.
I wouldn't even wish this FUCKing upon my worst enemy.2 -
Had to fix a bug in flask App built by 3 ppl !
So I some how roughly figured out the code and was trying to fix.
The bug was
I click on submit, two times the record was entered into database.
(Second time, duplicate error).
So to figure out ,I just commented the code which inserts to DB!
Whola!
Now only one record is inserted!
I still don't know where it's actually inserting !, And IDC , problem fixed
Shall I boast about my skills!?😂3 -
Just spent three hours debugging why a jquery didn't do some actions with a div through its id. MAYBE NEXT TIME I SHOULD CHECK FOR FUCKING DUPLICATE ID'S AND REMEMBER COPYING SOME CODE THE DAY BEFORE WHICH CONTAINED THAT FUCKING ID. GODVERDEGODVERDOMME.
-
I am so much stunned i cannot form a sentence on what to say. Lost 3 days trying to fix a bug on why socket.io was connecting to backend TWICE per user. I cannot fucking comprehend this. Backend works fine because via postman it doesnt connect twice. Everything works fine. 72 fucking hours waste d of my life just to find out i had to change
<React.StrictMode>
<App />
</React.StrictMode>
Into
<App />
When i tell you my jaw fucking dropped it fucking did. And it does not drop often or that easily for me. What the FUCK is react strict mode???? FUCK react. I fucking hate this piece of garbage framework. I even like nextjs better. React💩💩💩💩💩💩💩💩💩💩motberfucker WHY is strict mode fucking my code what use does it have who gives a shit why does it have anything to do with websocket connection FUCK react 💩💩💩💩💩💩💩💩💩 how does this piece of camel turd have anything to do with duplicate connection 💩💩💩💩MFKKCER this garbage doesnt exist in my beautiful angular or nextjs PLS why this cancer has to be so headaching i knew I'll get FUCKED if i dont go over a detailed course learning react from scratch. Now im suffering. Learning this garbage the hard way FUCK off4 -
When the pull request
1. has 100s of files with commit messages that make a very little sense
2. has the source files sprinkled with duplicate looking code having enough differences to screw my visual diffing ability
3. has too many changes combined when they can be independently reviewed and merged
4. includes me as the sole approver when I don't have enough context on the changes
5. includes references to tickets without any description, justification for the change, testing methodologies, test results, performance metrics comparison, etc. Literally none. It is as if the developer wants me to work with them from the Beginning1 -
So why the fuck did you go into code that I've written, change the name from "mode" to "type" throughout the >1500 lines of code that's relevant to the feature, and then move on to change my implementation to something that is arguably not common practice for the language and framework we're using, and in turn create duplicate state? And why the fuck weren't these changes in separate clear commits, but instead scattered over multiple commits? You're supposed to be senior!3
-
Do you think it’s appropriate to use the phrase "dried" in commit messages to refer to removing duplicate code? (DRY = don’t repeat yourself)
I just used it and I’m not sure if it’s ok because some devs might not understand it and the the original letters from DRY went away and became "dried" so it might be even more cryptic.
On the other hand it’s so much more concise having "dried type X" compared to "refactored the code so that it doesn’t contain duplicates of type X"13 -
me: let's avoid duplicate code by using a user control instead of copying the form code on multiple pages.
jerk face: you're over complicating it.3 -
Back in college, we were assigned a group of 3 other students to complete a duplicate of a current popular site. My team received Kijiji, a Canadian ad listing platform similar to Craigslist/eBay. This was to be done with JSP and JavaEE. We had to create a 30 minute presentation to go along with it.
Fairly simply, except we had one week. As I worked 2 jobs at the time, I typically left my college work to the last minute. Initially, we split up the work, myself taking 50% of the code and splitting the rest between the other 3. I was perfectly okay with this, until the night of the last day, they messaged me saying they had done nothing.
Extremely annoyed, I told them to just do the fucking presentation and that I would now finish the other 50% of the code myself. I coded 16 hours straight, went to bed, woke up and coded for another 8 hours. It wasn't exactly what I wanted, but it covered all the points.
The day of, they showed me their presentation. It was complete trash. When we ended up presenting, I improvised the entire thing. The others didn't even speak. Not once. At the end of it, we received 65%. The professor said that if the project had been completed by one person, it would've received a perfect grade, but because there were 4 of us, he expected more. They all looked at me in fear of saying something. I just thanked the professor for his time and left.
The professor knew I did the entire thing myself. My code was by far the most consistent in his class, constantly receiving perfect marks and him asking me to assist other students.
When I graduated, I didn't have 100%, but I did have a 90%. Considering that project was worth 25% of our final marks, he definitely bumped my grade.3 -
Was working on a system we planned on to deliver to a hospital
basically it was meant for controlling and monitoring pactions coming in and attendance time from the staff
Got it off the ground well and got to where the system was supposed to update room status
occupied/free then horror started
the db was not setting the room free after clearing a client off the list... room remained occupied and this kept on happening for 6 months and I was so focused on fixing the db models thinking thats where the problem was....
1 day after leaving the project for several months i just revisited the project randomly and started going through the whole code base trying to make sense of what was happening as there where no errors generated..
I had to verify the whole system logic... and that day i figured out what was happening...
upon adding a client to a room the system was also creating a duplicate room so when the function for setting the room free executes it would set the duplicate room free and not the actual room and the system would pick the room with occupied state causing the user not being able to assign new pactions to the room
Solving this brought so much relief coz it required so much work just to solve what seemed to be a minor issue5 -
Shit week....
Defragmentation of several applications codebase(s), sifting out duplicate code and creating a library out of it. Bash.
Not funny.
Yesterday while cooking I was too fast.
Chopping board with adjustable cutting depth, was at 6mm. Right thumb. Full speed. :(
Boy that wasn't pretty. Bled for half an hour and created quite a mess while trying to find some band aid to get pressure on it. Guess I'll have fun the next week's as no thumb is pretty handicapped .
And today we have in Germany a pretty severe snow storm.
I really hope that the server rooms @ company don't get flooded or shit like that.6 -
Until today, I had assumed deploying stuff to prod would NOT be one of my responsabilities in this company. Apparently that's not the case.
Had to deploy my code and pray it didn't break anything. Why is this a big deal at all?
Well you see, there is no repository. At all. No git, no svn, not even duplicate folders. No tests, no pipeline. Just a bunch of CPanels.
Had to manually copy files and folders from the development site to the production site and partially copy a database. "Just drag and drop" were the instructions I was given.
As if using CakePHP2, PHP5 and having to parse fucking Excel files wasn't bad enough, now I have to deal with one of the worst ways to deploy code.
Fuck it, I'm switching on the looking-for-job flag on linkedin.5 -
Do not offer anyone to help them with their scripts, ever.
I had to do something as there were things like "cd $DIR; rm *". No checks if the folder got changed, no qutoes to prevent breaking on spaces. A problem waiting to happen. And it did. We don't know what the script deleted in the wrong folder to this day.
The scripts have no functions, some files have over 50% duplicate code. I was an idiot and thought running it through shellcheck and doing basic prevention of them shooting their own foot would be enough.
And there is no way to convince the guy to start writing the code properly. Should have kept my mouth shut.4 -
Be nice, they said.
StackOverflow should be more welcoming, they said.
C00lHoker99 is a new contributor. Be nice, and check out our Code of Conduct, they said.
Oh, for fucks sake...
Nobody is going to be nice to drunk hobo that shits in the middle of the library.
Duplicate, no MCVE, bluntly offtopic and "do my job plz asap" questions doesn't deserve any niceness from community.
If you feel like SO isn't welcoming, that's certainly your fault.
And what now? Instead of answering good questions and being **nice to nice fellows** we are swimming in Pacific Crapocean. Nnnnnniiiiiicccceeee2 -
Automatically clean up code, removing redundant and duplicate bits, splitting large functions, and formatting it nicely. Especially useful when trying to understand some garbage code someone else wrote which you need to rewrite.2
-
I'm finishing up the most depressing client engagement ever. Ultimately it all traces back to their worthless Expert Beginner EA who thinks he's a genius but can't write code. I don't mean that he's not great at it. It's some of the worst I've ever seen by a person in his position.
In the time I have left here I could do so much to help them clean this stuff up so that future developers could ramp up more easily and there wouldn't be tons of duplicate code.
But I've just given up. You can't help someone who thinks their code is perfect. I don't even bother suggesting stuff any more (like don't have two methods in a class - a "real" one and one for unit testing) because he gets mad or just says that's his "pattern."
If I have a useful improvement, first he'll want me to put all new code in some new library, which is fine as an end result but you don't start with putting single-use code in a library separate from where you're using it. You work with it for a while to see what's useful, what's not, and make changes. But, you see, he just loves making more libraries and calling them "frameworks."
He tells me what he wants me to name classes, and they have nothing to do with what the classes do. When you haven't done any development yet you don't even know what classes you're going to create. You start with something but you refactor and rename. It takes a special breed of stupid to think that you start with a name.
I've even caught the dude taking classes I've committed and copying and pasting them into their own library - a library with one class.
The last time we had to figure out how to do something new I told everyone up front: Don't waste time trying to figure out how you want to solve the problem. Just ask the EA what he wants you to do. Because whatever you come up with, he's going to reject it and come up with something stupid that revolves around adding stuff to his genius framework. And whatever he says you're going to do. So just skip to that.
So that's the environment. We don't write software to meet requirements. We write it to add to the framework so that the EA can turn around and say how useful the framework is.
Except it's not. The overhead for new developers to learn how to navigate his copy-pasted code, tons of inheritance, dead methods, meaningless names, and useless wrappers around existing libraries is massive. Whatever you need to do you could do in a few hours without his framework. Or you can spend literally a month modifying his framework to do the same thing. And half the time his code collapses so that dozens of applications built on his framework go down at once.
I get frameworks. They can be useful, but only if they serve your needs, not the other way around.
I've spent months disciplining myself not to solve problems and not to use my skills.
Good luck to those of you who actually work there. I am deeply sad for the visa worker I'm handing this off to. He's a nice guy and smart. If he was stupid then he wouldn't mind dragging this anchor behind him like an ox pulling a plow. Knowing the difference just makes it harder. -
So there is this program with legacy code from 15 years ago the client is in love with. Every time we try to accomplish something it proves that the mf who wrote it was so lazy and incompetent that he should have never chosen this profession. Goto, one-two letter for type and variable names. Dude even wrote an ascii decoder as if he would be payed for lines of code. Today we found a code where a rows of data was misindexed by one (we incorrectly assumed that we could extract some data from it but the column we wanted to use was just there for decoration, it was not actually used). the calculations the system uses are replicated for each interface with duplicate lines of code so the same binary data can show different values because of the multipliers.
If I could I woukd go back in time and bang the guy's head to the desk emphasising each word like "You - should - quit - and - never - ever - write - code -again"6 -
!rant
So I have bought a new laptop and this time instead of straight up booting linux I had an idea of giving micro$oft a try, so I have decided to use only their services for 2 weeks.
To be honest, I really did not expect windows to use do much cpu and hdd during updates and background tasks, but after a day it was ok and windows feels snappier than during my last encounrer (maybe cause the new hw?).
I was even so dedicated that I started to use cortana and I have to tell, that she is dumb as fuck, since she fails to understand even the basic tasks and if u want something advanced, she refers to the next update. But boy, tell her to open Visual Studio and she asks if you want VS Code or Visual Studio, which seems great. But my response was 'Code' then she insisted that I said Coke. Im like OK, Im not native english speaker, lets try Visual Studio Code, where she told me that there is no such thing and Spelling VS - Code ended me in bing search for Unesco :/
I really want to like Cortana, she has nice name, nice history, but she is like that A girl from class, who looks gorgeous, has great voice, but then u reallise that she just eats a book before exam and after that she is that dumb basic hoe.
I also gave a shot to Bing and Edge. Bing is something between Google and DuckDuckGo, since it gives you a liiitle less results from search history, yet if you want to find something in different language its even possible to tell you that what are you trying to find does not exist.
But I have to tell, that I like Edge and I mean it. Like... Its fast and has some good features, like pushing all your open tavs away, so you can open them Later. It also does not have that stupid ass feature that lets you control tab from left to right, not by chronological order, so you wont end up in infinity loop of 2 tabs. And even if people make fun of M$ trying to convince you to use Edge by being too aggresive. God go on edge and try to use some Google Service(You still dont use chrome?!).
I also tried to play with .Net core and I have to tell that against java they are a bit further. I liked some small features, but what I just simply loved was rhe fucking documentation. You basically dont need google, sincw they give you examples and explain in a human way.
What I didnt quite get was the 'big' Visual Studio. Tje dark theme to me feels strange(personal and irrelevant). Why the hell I do need to press 2 shortcuts to duplicate line?! Why is it so hard to find a plugin to give me back my coloured brackets and why the fuck it takes like a second to Cut one line of code on a damn i7?!
Visual studio Code was something different. It shows how dark theme should be done, the plugin market is full of stuff and the damn shortcuts are not made for octopi. So I have to recommend it ^^.
I even gave a shot to word and office as a whole and fuck I never knew that there are so many templates. It really made my life easier, since all you need to do is find the right one in the app, instead of browsing templates online, where half of them are for another version of your text editor.
Android Launcher was fast, had a clever widget of notes and the sync was pretty handy to be honest so I liked that one as well.
What made me furious was using the CLI. Godfucking damn what the fuck is ipconfig?! :/
Last thing what made me superbhappy was using stuff without wine and all of the addional shit. Especially using stuff like Afinity Designer and having good looking apps in general. I mean Open source has great tools l sometimes with better functionality. But I found out, that what is pleasure to look at, is pleasure to work with.
To Summarize a bit.
It wasnt that bad as I expected. I see where they are heading with building yet another ecosystem of It just works and that they are aiming at professionals once again.
So I would rate it 6/10, would be 7 if that shit was Posix compatible.
I know that for Balmer is a special place in hell... But with that new CEO, Microsoft at the end may make it to purgatory..5 -
One advice I've given to most junior developers which they've practically benefited from is...
"Avoid duplicate comments between interfaces and their base class at all times".
As a smartly-lazy dev, you shouldn't enjoy writing same thing multiple times... be it code or comment, don't write it twice!2 -
I can now appreciate some design decisions behind react-redux after witnessing some angular OOP clusterfuck.
I am sure there is some clean/correct way to code in angular, but everyone is treating angular as java.
Some angular application (the one I have to work with) is littered with network calls. It's difficult to spot duplicates. People usually resolve promises everywhere. In services, in a top-level component, or in for loops. In react, people use apollo/redux-query or redux-saga to handle network calls. Since these libraries prevent duplicate network calls internally and reassigning apollo network call function or redux action function is always useless, it's easy to spot all network calls in a component tree.
In angular, it's difficult to trace data mutations when data can be updated everywhere. In react, you can easily find UI state updates by tracing state hooks/dispatch/apollo usages.
In angular, it's difficult to trace data pipeline. Since everything is imperative by default, people need to add update functions in data subscriptions. With all the littered mutations. Soon you will lose track of what the fuck is going on.
I hope angular get the agonizing death it deserves and fuck everyone who codes JS OOP clusterfuck UI.8 -
Helping out a team, I was documenting some code/processes when I came across several classes that was logging a lot of, IMO, 'junk' that was unnecessary (and I knew wasn't being used in any Splunk alerts/reports)
I offer a refactoring suggestion, simplifying the data being logged, moving the duplicate code to a central location, maybe saving 10~20 lines of code. Didn't think it was a big deal because they were already actively working on the code and it was all new code (nothing deployed to production yet). Sent the suggestion to the lead developer and he responds:
Dev: "Yes, the changes looks fine, but not in scope of the project. Any out of scope work will need to be suggested at the end of the project, reviewed by the team, the project manager and approved by the vice president."
"Out of scope"? Logging data to Splunk needs a vice president's approval? WTF?
YOU PROBABLY HAVE THE PROJECT OPEN IN VISUAL STUDIO RIGHT NOW!!!
Along with the documentation the lead dev said they didn't have time to do, I send his boss and the dev team my suggested changes (before-after screen shots of the code) and offered to do the 2 minutes worth of work (again, this was new code, nothing in production and zero side affects to anything).
I even offered to create the splunk reporting/alerting against the data being logged (another item they said they would not have time to do)
About a minute later the lead dev responds..
Dev: "Those changes look good. I'll have Jake make those changes and we can test the logging when we deploy to dev on Monday. Thanks!"
Of course you will...fracking ass hat.
I'll bet my Battlestar Galactica DVD box set he was going to make the changes himself, brag to his boss how he refactored the code, saving X lines of code..blah blah blah to help *me* with documenting the logging portion. -
The whole episode of me managing an outsourced team for about 6 months. I thought because I’ve managed other teams doing non dev things, it would be like that.
I’ve never been so wrong and NEVER AGAIN! I had to own everything and they’re code is so repetitive and confusing. It misses basic structure because I didn’t outline some things like knowing when a operation is complete and that if the same button appears in two pages it should do the same thing! Or that is you break up a SPA you shouldn’t just duplicate the whole files and then confusingly use randomly parts to so random jobs across all layers of the app. Ffs. Never want to work with a team that doesn’t have a plan to maintain the code they write. I felt like a failure but for me to make them successful I would have had to pretty much write the code.
Now I have to explain this embarrassing pile of curry spaghetti to my colleagues who need to do some other work on it. Fuck. I want to throw it out and start over so badly.
I should have told my boss a hard no on that one and let him know outsourcing would slow things down not speed them up. He just needs to stop trying to get software developed and deployed at the same time. Fuckers.3 -
I’m working on a react codebase and company decided to add a new module.
Now im writing markup and css to ensure UX is smooth as designers thought of it.
Imagine my horror when I start to code and find out no matter what HTML tag i use, it’s been FUCKING OVERRIDDEN in the global stylesheet. AND STYLES HAVE BEEN OVERRIDDEN WITH !important
They’re also using Ant design as a component library. Guess what, default ant design classes have been overridden too. So i try to use ant design button or card, and bam, MAGICALLY SOME DESIGN FROM SOME SHITHOLE MODULE DECIDES TO FUCK WITH MY STYLES
On top of that, styles of parts of application has been written in SASS, some part of application uses bootstrap components some use third party components like tables and responsive grids to suit to their preferences. Some parts use handwritten css. Some parts use CSS IN JS and styled components. THE FUCK IS THIS GARBAGE!!!! THE FUCKING CODEBASE HAS A MIND OF ITS OWN!!!!!! YOU NAME A WAY TO ADD STYLES TO A COMPONENT, ITS THERE!!!
And the company’s management thought a “fractal” approach to maintain each individual view is “best” for SCALABILITY!!! HOW THE FUCK DID IT NOT CROSS YOUR DUMB MIND THAT FRACTAL APPROACH ALSO GUIDES TO HAVE ALL COMMON STUFF AT ONE PLACE!!!! THIS CODEBASE HAS DUPLICATE STYLES AND DUPLICATE CODE IN ALMOST EVERY MODULE!!!!
Not to mention every developer choosing to freely decide the way they should write their code without any guidelines.
HOW THE FUCK PEOPLE WRITE THEIR CODE WITHOUT THINKING ABOUT OTHER DEVS!!! SO BASICALLY I AM NOT ONLY CLEANING SOMEONE ELSE’S SHIT BUT ALSO TRY NOT TO SHIT IN THE PROCESS!! FML2 -
Debugging an issue last week that involved a duplicate class. Took about 10 mins of debugging (console.log) to realize the function wasn't being called.
Me to the person I was helping: we should comment that this is deprecated, can you add it?
Today while reading over the (unchanged) code, I see a comment block above the class **that I wrote awhile ago** which says exactly that...1 -
So ok, today was a crazy day.
New sprint, new ticket.
Work on the bug tickets first he said ….
Sure can. Oh had I just known that this very first innocent looking ticket is the way to coder‘s hell ….
‚Access of undefined‘ it said. Easy to fix, I thought.
Until I found the very same code twenty-fucking-two times over about 50 files!
Who would guess that exportSingleOperatorBooking, exportSeveralOperatorBookings, exportAllOperatorBookings (… and more) could in practically be the same? Nah, they all use different interfaces.
Oh wait, the alias type of the extended sub-interface of file misc.ts is the same logical content as a differently named interface below another different interface with the same content as in another ts file?
Wait that can‘t be. Riiiiight?? 😳
8h later I have barely scratched the surface of refactoring this shitshow of a project.
But no, I refuse to put the same error handling multiple times in different places.
I could have been done already. I could have saved my soul, my sanity. But I will be brave and strong to save the innocent developer that will cometh after me. For I shall be rewardeth for my sacrifice.
Amen.8 -
I wrote some code in a different pattern than that was seen in the project. Got positive comments, but the senior said that as per the project rules you are not supposed to write like this.
So ended up writing some duplicate code but somehow it incorporates my pattern and existing project rules.
Should I be happy or sad? -
After spending almost all the day trying to find out what was wrong with my code, re-reading all my class, thinking that the universe does not make sense anymore, I find that one loop control variable that I was changing had a duplicate inside the loop. Damn you compiler, why did you not warn me?1
-
Bitch!!!!
I have started to hate stackoverflow
I mean I asked a simple question about how to download a PDF over JavaScript. The question is marked duplicate and down voted.
How stupid can some dumbasses be? Yes a similar question was asked and answered
But..
The duplicate post they’ve marked used to work,USED to , that code doesn’t work anymore.
I mean come on I’ve specifically written I tried that and it doesn’t work anymore. But some fuckers just want to look cool by downvoting other.4 -
Thank You StackOverflow.
After looking for 4 hours on internet and stackoverflow, searching whole documentation and blog pages, i didn't find a solution to an error I was getting in my Android app.
So I began and started writing the question on StackOverflow, phrasing it properly, to the point (so as to not get downvoted), providing all my files and code (so not to get closed or duplicate), formatting them properly, and explaining why my error was unique. On the last XML file I see something trying to call a function which wasn't declared.
So yeah, there you go.
But it's not over yet.
I saw it and got excited, corrected it and ran the code again. But accidentally ran it on the emulator and forgot my device wasn't connected anymore, and the emulator wasn't already loaded either. And my machine is old.
I don't know what to say anymore.1 -
After brute forced access to her hardware I spotted huge memory leak spreading on my key logger I just installed. She couldn’t resist right after my data reached her database so I inserted it once more to duplicate her primary key, she instantly locked my transaction and screamed so loud that all neighborhood was broadcasted with a message that exception is being raised. Right after she grabbed back of my stick just to push my exploit harder to it’s limits and make sure all stack trace is being logged into her security kernel log.
Fortunately my spyware was obfuscated and my metadata was hidden so despite she wanted to copy my code into her newly established kernel and clone it into new deadly weapon all my data went into temporary file I could flush right after my stick was unloaded.
Right after deeply scanning her localhost I removed my stick from her desktop and left the building, she was left alone again, loudly complaining about her security hole being exploited.
My work was done and I was preparing to break into another corporate security system.
- penetration tester diaries2 -
The manager that believed that sharing code was bad. We had a web and a windows client over the same db. No code shared. He'd rather duplicate the code and maintenance than share it. And the BL should be put in stored procedures, 'cause that's so easy to change in-flight...
-
ok found the object orientated guide but for rust which is functional spaghetti: https://howtocodeit.com/articles/...
it has moved into architecture
... and actually makes a good case for interfaces / traits. generally in languages I just used generics to get around limitations of having to type a lot / duplicate code, and I'd remove interfaces because they're annoying to have to deal with, but I can see this be useful for once now.
like you can start a prototype app with files as a database then move to a small database type then later a more monolithic big data one and all that would be through one trait the whole time. so you could anticipate natural progressions of an app, instead of having to build the last version you can put jank behind interfaces and then switch things in and out to test new technologies which does actually give me a lot of relief for my newfound anxiety of me rewriting my rust codebases because I get some small things wrong. I've been coding in circles due to it and I have several saved files that are out of date now but I don't want to delete and they make the compiler mad cuz I had no interface boundaries as such and now stuff has changed somewhere else in the app and by God pls argh
this also means you can code "top-down". in carl Jung typology that's Te and most programmers are Ti-types so they do the little details and then sort of glue everything together (?) but not everybody thinks this way. I naturally think more top-down, which works for more dynamic languages and is annoying in static languages because then you're just fighting semantics and your earlier work the whole time (actually this is a surprisingly good write-up on the different thinking types: https://bothsidesofthetable.com/the...)
wheeeee -
Sometimes in our personal projects we write crazy commit messages. I'll post mine because its a weekend and I hope someone has a well deserved start. Feel free to post yours, regex out your username, time and hash and paste chronologically. ISSA THREAD MY DUDES AND DUDETTES
--
Initialization of NDM in Kotlin
Small changes, wiping drive
Small changes, wiping drive
Lottie, Backdrop contrast and logging in implementation
Added Lotties, added Link variable to Database Manifest
Fixed menu engine, added Smart adapter, indexing, Extra menus on home and Calendar
b4 work
Added branch and few changes
really before work
Merge remote-tracking branch 'origin/master'
really before work 4 sho
Refined Search response
Added Swipe to menus and nested tabs
Added custom tab library
tabs and shh
MORE TIME WASTED ON just 3 files
api and rx
New models new handlers, new static leaky objects xd, a few icons
minor changes
minor changesqwqaweqweweqwe
db db dbbb
Added Reading display and delete function
tryin to add web socket...fail
tryin to add web socket...success
New robust content handler, linked to a web socket. :) happy data-ring lol
A lot of changes, no time to explain
minor fixes ehehhe
Added args and content builder to content id
Converted some fragments into NDMListFragments
dsa
MAjor BiG ChANgEs added Listable interface added refresh and online cache added many stuff
MAjor mAjOr BiG ChANgEs added multiClick block added in-fragment Menu (and handling) added in-fragment list irem click handling
Unformatted some code, added midi handler, new menus, added manifest
Update and Insert (upsert) extension to Listable ArrayList
Test for hymnbook offline changing
Changed menuId from int to key string :) added refresh ...global... :(
Added Scale Gesture Listener
Changed Font and size of titlebar, text selection arg. NEW NEW Readings layout.
minor fix on duplicate readings
added isUserDatabase attribute to hymn database file added markwon to stanza views
Home changes :)
Modular hymn Editing
Home changes :) part 2
Home changes :) part 3
Unified Stanza view
Perfected stanza sharing
Added Summernote!!
minor changes
Another change but from source tree :)))
Added Span Saving
Added Working Quick Access
Added a caption system, well text captions only
Added Stanza view modes...quite stable though
From work changes
JUST a [ush
Touch horizontal needs fix
Return api heruko
Added bible index
Added new settings file
Added settings and new icons
Minor changes to settings
Restored ping
Toggles and Pickers in settings
Added Section Title
Added Publishing Access Panel
Added Some new color changes on restart. When am I going to be tired of adding files :)
Before the confession
Theme Adaptation to views
Before Realm DB
Theme Activity :)
Changes to theme Activity
Changes to theme Activity part 2 mini
Some laptop changes, so you wont know what changed :)
Images...
Rush ourd
Added palette from images
Added lastModified filter
Problem with cache response
works work
Some Improvements, changed calendar recycle view
Tonic Sol-fa Screen Added
Merge Pull
Yes colors
Before leasing out to testers
Working but unformated table
Added Seperators but we have a glithchchchc
Tonic sol-fa nice, dots left, and some extras :)))
Just a nice commit on a good friday.
Just a quickie
I dont know what im committing...3 -
Spent a whole morning trying to make a unit test work only to find out it didn't work because of duplicated code.... Fml
-
Nothing like trying to understand a single 1500-line source file that implements the API usage in the frontend. Without a single comment.
No, wait. There are comments! But it's only commented-out code. Or explicit shit (like "gets the version" before a getAssetVersion function).
Functions with unused parameters? ✅
Weird var names (like "tmpX")? ✅
`console.log(var)` everywhere? ✅
Long-ass lines with 150+ chars? ✅
Duplicate code? ✅✅
Not a single interface was used so everything is var: any? ✅
Random unreadable RegEx? ✅
If-chains of 6+ more levels? ✅
Many `else if` towers instead of a switch? ✅
And did I mention it was written by a fucker who can't speak proper English so shit like visiable, cataloge and isExist is everywhere? Yeah.
Fun day at the office reading spaghetti code 🙃 -
So i recently inherited some legacy code.
Its actually not to bad. Just a few thousand locs which are mostly stretched across a handfull of functions lmao (800lines per function yay).
So the main thing i wana ask. Does someone here know of good techniques to gradually reimplement all of this.
Since im not gonna apply bandaids to this mess anymore than is needed.
Unfortunately this is a very important system and it only runs on production xD.
Idealy i would somehow be able to duplicate the tcp traffic to the reimplementation but that doesnt seem feasible.
Also what the individual modules classes and so on do wa snever documented and no one even knows how or why certain things even exist.
If anyone has any idea of what i can do. Apart from hoping to god i dont miss any weird quirky edge cases. Do let me know7 -
Have this problem which already took me well over a day to figure out.
Thinking: "I might try SO, maybe I'll get an answer there.".
*Posts question with nice explanation and code example.*
Literally 5 mins later: question is marked as duplicate of a super generic question, which does not answer mine.1 -
February will be the first full year at this company as full time employee.
I've updated so many legacy projects, optimized a lot of workflows as well as built new tools to improve efficiency and remove unnecessarily duplicate projects (sometimes literally only 3 variables were different between multiple projects)
My one co-worker taught himself enough code to do the job but doesn't think like a programmer though he is asking me for help and advice to improve what he does since ive proven i know a little. my other direct co-worker I'm practically teaching a Programming 100 course to them
My direct manager at one point said he was so happy he took a chance on me even though I didn't interview well
I like my job, I find it so much better than my last job which was horribly toxic, and more fun than my first 'real' job as a night shift help desk for basically a warehouse environment.
But I feel under paid sometimes for how much i do and all ive improved in my first year, I have my first yearly review coming up. I'm hoping to get a decent raise for all ive done and I want to somehow go over everything with the HR person to justify it. But I have no idea how to talk about my dev work to them in a way a non technical person could understand. I'm also not sure how the review process will work. Like will my manager be there. Or is it just me and HR, is there a paper I'll be sent to fill before hand,1 -
Doing someone else's Code Review in my project: "You must retain the holiness and piety of the code you write by following PascalCase naming for files and kebab-case naming for CSS variables. Avoid using duplicate strings by declaring enums in a constants.ts file and using that all throughout the app"
During my own Code Review in someone else's project: "WHAT THE FUCK DO YOU MEAN I CANNOT PASS FUNCTION REFERENCES AS PROPS TO A REACT COMPONENT AND ALWAYS NEED TO INVOKE IT INSIDE AN INLINE FUNCTION FOR THE PROP."
"WHAT KINDA FKIN DRUGS ARE YOU ON TO USE snake_case IN TYPESCRIPT DID YOUR MOM DROP YOU ON YOUR HEAD WHEN YOU WERE BORN YOU SACRILEGIOUS PIECE OF SHIT"
"WHAT DO YOU MEAN I SHOULD USE BOTH SINGLE AND DOUBLE QUOTES FOR IMPORTS AS PER LOCAL OR GLOBAL; I'LL SHOVE THE SINGLE QUOTE UP YOU WHERE THE SUN DOESN'T SHINE YOU FKIN DEGENERATE MORON"
As much as I do believe in self righteousness of my own coding conventions over others (I might be slightly better than others but I really can't claim good authority because I've had my lapses in conventions too; and being one of the newer members of the team certainly doesn't help, despite my boss supporting my initiative), I guess it is high time we bring in some already established code conventions in the team that is finally big enough to warrant them. Maybe AirBnB. -
So we have duplicate code because dumb devs thinks Bootstrap (4) is kick-ass for mobile. 😒 Can't do jack with their tables.
I told them to use Flexbox instead. Bootstrap (even 4) is antiquated and there's better options.
My recommendation is to use Flexbox Grid with React to build a modular living style guide with built in unit testing for styles and interactions.
Basically got told that my opinion is just an opinion and is the same as using Bootstrap. 😭
Anyone have some solid "facts" on Bootstrap I can use in the long run? We haven't even launched anything and we're already in technical debt because of this stupid framework decision. Someone please help. 😞3 -
I'm interning at a mech eng company. Our products have many possible permutations that customers can choose from a spec sheet.
The backend for us mechanical designers is equivalent to copying and pasting the same code (with slight changes) into a massive switch statement depending on the program's options. So many near duplicate drawings. Each with individual settings that need to be tweaked and linked to other new duplicates every time a new order comes in.
As a programmer it drives me absolute bonkers! I've talked to them about automating it but "we've just always done it this way, so it probably won't change". Well, as soon as I'm done grinding this current project, I'm hoping to put together a practical demo to change their minds.2 -
A year ago I built my first todo, not from a tutorial, but using basic libraries and nw.js, and doing basic dom manipulations.
It had drag n drop, icons, and basic saving and loading. And I was satisfied.
Since then I've been working odd jobs.
And today I've decided to stretch out a bit, and build a basic airtable clone, because I think I can.
And also because I hate anything without an offline option.
First thing I realized was I wasn't about to duplicate all the features of a spreadsheet from scratch. I'd need a base to work from.
I spent about an hour looking.
Core features needed would be trivial serialization or saving/loading.
Proper event support for when a cell, row, or column changed, or was selected. Necessary for triggering validation and serialization/saving.
Custom column types.
Embedding html in cells.
Reorderable columns
Optional but nice to have:
Changeable column width and row height.
Drag and drop on rows and columns.
Right click menu support out of the box.
After that hour I had a few I wanted to test.
And started looking at frameworks to support the SPA aspects.
Both mithril and riot have minimal router support. But theres also a ton of other leightweight frameworks and libraries worthy of prototyping in, solid, marko, svelte, etc.
I didn't want to futz with lots of overhead, babeling/gulping/grunting/webpacking or any complex configuration-over-convention.
Didn't care for dom vs shadow dom. Its a prototype not a startup.
And I didn't care to do it the "right way". Learning curve here was antithesis to experimenting. I was trying to get away from plugin, configuration-over-convention, astronaut architecture, monolithic frameworks, the works.
Could I import the library without five dozen dependancies and learning four different tools before getting to hello world?
"But if you know IJK then its quick to get started!", except I don't, so it won't. I didn't want that.
Could I get cheap component-oriented designs?
Was I managing complex state embedded in a monolith that took over the entire layout and conventions of my code, like the world balanced on the back of a turtle?
Did it obscure the dom and state, and the standard way of doing things or *compliment* those?
As for validation, theres a number of vanilla libraries, one of which treats validation similar to unit testing, which seems kinda novel.
For presentation and backend I could do NW.JS, which would remove some of the complications, by putting everything in one script. Or if I wanted to make it a web backend, and avoid writing it in something that ran like a potato strapped to a nuclear rocket (visual studio), I could skip TS and go with python and quart, an async variation of flask.
This has the advantage that using something thats *not* JS, namely python, for interacting with a proper database, and would allow self-hosting or putting it online so people can share data and access in real time with others.
And because I'm horrible, and do things the wrong way for convenience, I could use tailwind.
Because it pisses people off.
How easy (or hard) would it be to recreate a basic functional clone of the core of airtable?
I don't know, but I have feeling I'm going to find out!1 -
Getting a duplicate record error in MySQL from a unique key constraint. Trying to decide if I should fix the Java code that possibly sending a duplicate save || drop the unique constraint from the table? 😂😂😂3
-
It took me 48 hours ( not continuously) to fix a bug by going through a cluster fuck code of multiple modules. Tracing the error through 5 or 6 layers. And u dont get error logs right away. You need to recreate that error and see the logs on a kubernetes pod. Just to find out the bug was a duplicate.
Yes jokes are on me. I fucked up by not checking for duplicate. I steered right away on that shit dipped bug like a hungry/zombie hound. Fuck me. -
When you are trying to write event handlers in JavaScript and nothing is working so you spend hours and hours trying to figure out what the fuck is wrong with your js code only for it to be a duplicate id. Fuck sake. I really wish JavaScript warned you about duplicate ids, but then again that's what you get for using such a weakly typed language.
-
I’ve been at this issue at work for four days now and no progress and I feel really bad because we have important stories to pick up and I feel I’m wasting my capacity like this because I haven’t fixed it. Basically, only in our QA environment (one before production) our services is not acknowledging duplicate events posted by Kafka, thus keeps reprocessing them. I’ve spent so long trying to diagnose the code, which is the same in all envs currently, seeing how this suddenly occurred, restarted things, went through complications of using different tools, asked for help from others a lot but IVE gotten NOWHERE. Idr wanna say to my team that I should prioritise other things because we have deadlines but I feel this issue is important to fix but I just can’t figure out how. Now I’m worried this whole sprint will go without me doing anything and then fingers pointed at me later6
-
My boss is a very smart man, but sometimes he's superstitious as hell. He cannot trust context.list.find() in c# to accept null values, despite that being a thing forever. He's certain that it will break in a future entity framework update, so we have all these duplicate if statements all over our site.
If(blah == null){ //stuff}
Thing thing = context.things.find(blah);
If(thing == null){//stuff}
It kills me a little each time, but I guess he could be worse. I'm glad that he's finally trusting the null conditional operator, because it's a fucking lifesaver for duplicate code!3 -
wasting time trying to write good code and minimize duplication , but it probably won't work and there are no working examples
duplicate code and do the stupid thing, which will work, with extra dumbass boilerplate code to convert between swagger2 & 3 schema
fuck you swagger code gen -
I'm starting to gain a dislike for OOP.
I think classes make it easy for me to think of the entities of a problem and translate them into code.
But when you to attempt to test classes, that's when shit hits the fan.
In my opinion, it is pointless to test classes. If you ever seen test code for a class, you'll notice that it's usually horrible and long.
The reason for this is that usually some methods depend on other methods to be called first.
This results in the usual monolithic test that calls every goddamn method on the class.
You might say "ok, break the test into smaller parts". Ok. But the result of that attempt is even worse, because you end up with several big tests cases and a lot of duplicate code, because of the dependency of some methods on others.
The real solution to this is to make the classes be just glue: they should delegate arguments onto functions that reside on its own file, and, maybe afterwards emit events if you are using events.
But they shouldn't have too much test code classes though. The test code for classes should be running a simple example flow, but never doing any assertions other than expecting no exceptions.
For the most part, you'd be relying on the unit testing that is done for each delegated function.
If you take any single function you'll see that it's extremely easy to write tests for it. In fact, you can have the test right next to the fuction, like <module>.xyz <module>.test.xyz
So I don't think classes shouldn't be used at all, they should just be glue.
As you do normal usage of this software this way, when a bug is discovered you'll notice that the fix and testing code for this bug is very usually applied to the delegated functions instead of being a problem of classes.
I think classes by themselves sound sane in paper, but in practice they turn into a huge fucking messes that become impossible to understand or test.
How can something like traditional classes not get chaotic when a single class can have x attributes and y methods. The complexity grows exponentially. And sometimes more attributes and methods are added.
Someone might say "well, it's just the nature of problems. Problems can have a lot of variables".
Yeah, but cramming all of that complexity into a single 200 lines class is insanity.12 -
Just found a few methods in the same file which does the same task written by different devs just because they did not know a method already existed in the first place. How tough is it for them to do a grep on the file?1
-
It's now 3am and this issue has been keeping me up for inner an hour... In Entity Framework..
I have a 2 tables/classes in a relationship: Item has many Tags.
I'm trying to delete some Tags using context.allTags.RemoveRange({list of tag objects I want deleted}) but now for some reason it's trying to reinsert/duplicate all Items and thereby violating all uniqueness constraints.
Guess will post the source code TMR but this is like wtf?1 -
So I already posted about this a couple of months ago, but I'm still working on my little game, Lore Seeker.
https://apps.apple.com/jp/app/...
I added a bunch of stuff - cards are now divided into 4 factions, and I added a whole slew of different abilities. It's getting pretty close to what I envisioned when I started imo. I also ported it from iPhone to Mac Os X, so if you have a mac you can do me a huge favor by checking it out and giving me a rating! I don't think the mac os app store gets any traffic though.
I have no idea if anyone actually wants to play this thing even if I add a million levels/cards but I'm just continuing to work on it and improving it hoping someone will notice eventually.
The most common question I get seems to be "where's android", so I've been messing around with android studio trying to figure out the basics. I have a tiny platform layer of Swift code that doesn't do much, and most of my code is in C++. So I just need to learn how to embed C++ code and then duplicate a small platform layer. I thought I could just jump into that and 'wing it' but I'm starting to think I will have to actually do some studying to figure out how android works... seems pretty confusing so far.
Anyway, thanks for any comments / advice / disses! <3334 -
Need some advise from all you clever devs out there.
When I finished uni I worked for a year at a good company but ultimately I was bored by the topic.
I got a new job at a place that was run by a Hitler wannabee that didn't want to do anything properly including writing tests and any time I improved an area or wrote a test would take me aside to have a go so I quit after 3 months.
Getti g a new job was not that hard but being at companies for short stints was a big issue.
My new job I've been here 3 months again but the code base is a shit hole, no standardisation, no one knows anything about industry standards, no tests again, pull requests that are in name only as clearly broken areas that you comment on get ignored so you might as well not bother, fake agile where all user stories are not user stories and we just lie every sprint about what we finished, no estimates and so forth, and a code base that is such a piece of shit that to add a new feature you have to hack every time. The project only started a few months back.
For instance we were implementing permissions and roles. My team lead does the table design. I spent 4 hours trying to convince him it was not fit for purpose and now we have spent a month on this area and we can't even enforce the permissions on the backend so basically they don't exist. This is the tip of the iceberg as this shit happens constantly and the worst thing is even though I say there is a problem we just ignore it so the app will always be insecure.
None of the team knows angular or wants to learn but all our apps use angular..
These are just examples, there is a lot more problems right from agile being run by people that don't understand agile to sending database entities instead of view models to client apps, but not all as some use view models so we just duplicate all the api controllers.
Our angular apps are a huge mess now because I have to keep hacking them since the backend is wrong.
We have a huge architectural problem that will set us back 1 month as we won't be able to actually access functionality and we need to release in 3 months, their solution even understanding my point fully is to ignore it. Legit.
The worst thing is that although my team is not dumb, if you try to explain this stuff to them they either just don't understand what you are saying or don't care.
With all that said I don't think they are even aware of these issues somehow so I dont think it's on purpose, and I do like the people and company, but I have reached the point that I don't give a shit anymore if something is wrong as its just so much easier to stay silent and makes no difference anyway.
I get paid very well, it's close to home and I actually learn a lot since their skill level is so low I have to pick up the slack and do all kinds of things I've never done much of like release management or database optimisation and I like that.
Would you leave and get a new job? -
Had to refractor and abstract some code into an angular 2 component so it can be reused by another. Well I could have just copied and pasted the code from component 1 to 2, that would have been a lot more faster than making this piece of code separate. The later is better, removes code duplicate and your code reads better.
-
Last days i’m digging in the legacy of this company. As if the first styleguide i had to work with wasnt worse enough i found two others now that are using different frameworks and are not part of the deployment process.
So far i had fractal, now busy with patternlab and yesterday foundation and the latest one; storybook.
There is duplicate code everywhere how on earth do they expect me to keep any kind of overview in this freaking mess they made?!