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 - "refractor"
-
I HOPED I WOULDN'T BE BALD AS MY DAD BUT AT THIS RATE I WILL BE HAIRLESS FROM TEARING IT OUT ON MY BLOODY OWN
I got hired for cleaning up a 2 year project of rushed spaghetti code , where they previously only had 1 programmer aND HE WROTE 37 THOUSAND LINES OF CODE!
OH WE NEED A NEW FEATURE?! LEMME JUST RESEARCH THIS COMMENT-LESS CRAP FOR MULTIPLE MILLENIA BEFORE I CAN GRASP WHAT THE FLYING FRICKIN FRIDGE CODE DOES
To top it off, I've about ONE MONTH LEFT BEFORE BETA RELEASE TO FIX THE CODE!
I'm super grateful for this job as it's my first programming job BUT I'M GONNA SET THE REPOSITORY ON FIRE SOON AAAAHHHHHH
HOW CAN YOU, THE PREVIOUS PROGRAMMER, WORK IN THIS ENVIRONMENT WHERE MOSTLY ALL FILES ARE +2000 ROWS OF UNDOCUMENTED CODE
OH AND JUST GOT A MESSAGE FROM THE PREVIOUS PROGRAMMER:
"You can just remove the unused code and refractor it some, izi"
IZI MY SHITTY POOP CAR
AAAAAAAAAAAAAAAHHHHH!!!
Now with that out of the way, how would you recommend handling a stressful release deadline?6 -
i was hired to join a team of old devs (40+) in an unnamed European country "yay goodbye 3rd world it's time to enjoy the quality of life" assist with enhancing already existing software and creating new solutions.
prior to my arrival most things were slow and super buggy, looking at the code base it shouldn't be a surprise, amateur hour everyone, logic implemented that is not needed, comment driven development, last time code review was done back in 1996. lots of anti patterns.
i swear there is a for loop that does nothing but it loops through a 100+ elements list, trunk based development with tfs since git is "not really needed"
test projects are not there.
>enter me an educated fool, with genuine passion for the craft and somehow a decent amount of knowledge.
>spent the last year fixing stuff educating people on principles and qualities.
> countless hours of training and explaining. team is showing cooperation, a new requirement comes in to develop with react.
> tear my ass creating reusable shit and self explanatory code with proper naming etc using git with feature branching, monday is first deployment day.
> today a colleague was working on an item submit a pull request and self approve it
> look at the code..... WTF the dumb fuck copied and pasted the whole code from different kendo components but somehow managed to refractor the name to test component, commented out all the code that he didn't use did the api call directly from the component, has 2 useeffects that depends on the a fucking text box changes for no reason, no redux implementation, the acceptance criteria is not achieved, and it doesn't work it just look right.
> first world country shit cannot scold, cannot complain, lead by example.
>asked him why you did this, the response was yeah probably i shouldn't have done that, i really didn't understand anything in the training but didn't want to waste time!!!!
> rest of the team created a different styled disaster with different flavors they don't even name their shit the same way.
fellow developers I'm stuck in a spaceship with a bunch of imposters, seriously i never cried in my entire life now I'm teary and on the verge of a break down.
talk with management "improving needs time" and offers me to join a yoga session to release the stress as if reaching nirvana would deliver shit on monday.
i really don't know what do is this a rant, is this a cry for help, I'm not sure, any advice is welcomed.7 -
After reading Clean Code principles:
Before you rename your method, remember to use the refractor option
😌4 -
"Refractor this method to reduce its Cognitive Complexity from 110 to 15 allowed."
*Pan*
Ok let's do it :
label : for(....) {
if(...){
for(.....){
If(...){
....
break label;
}
}
}
}
*Pan Pan*1 -
that moment when you code for two days just to find out that your manager asks you to refractor the whole code
-
After writing my first php script that displayed a random forum signature image. Took me far too long but the end result was worth it.
Felt proud after my first mini refractor that automatically picked up images from a folder on my geocities web hosting lol.
Cannot tell you how much win I felt at the time :)1 -
Don't refractor for fun!
An anecdote from my previous company. A developer had written a shitty java console app for fetching stock prices. About 3000 LOC. just one java GOD class. So, when me and my friend looked at it, we were amazed how that code works with all that if conditions spanning 100LOC. so. My dear friend underestimated the complexity. Since it just fetches stock price and puts in database right. I can write it in few days and much better one. So, he started writing code in an OO way. Three days later I see he still working on it. Having a glimpse at code. The app is now Object oriented shitty and ugly.
Guess what new code never goes in prod too.
Learning
Don't underestimate complexity of app.
Be empathic about fellow developer. Don't think he has written a shitty code. Think why he had to do so.
Don't work on refractors if there is no one to guide you.3 -
More of a moaning than ranting.
I feel like I care a bit too much.
I'm not a great programmer - I may be decent, but nothing more. I know Java and C# enough to write production code that works but as I gather more experience it's getting more and more annoying that I have no one to teach me in work. All I know is what I have learned by myself, from courses online, books and just writing code.
And what drives me crazy is how I'm being pushed from one project and technology to another! It's been a week since I've returned from my exams and I've already worked in C# (ASP.Net Core, MS Office AddIn, WPF, .Net console app), Java (Spring, some legacy project with JBoss, Android) and to top it all, I had to come back to the worst project I've ever been in, where I'm implementing some third party system to county administration, just to finish it off.
I'm happy to gather experience - invaluable with only two years of real, production experience, but I can't focus on one thing because I'm immediately forced to work on another. For some reason I'm seen as Jack-of-all-trades but I really don't feel like that. It makes me anxious as fuck. Not to mention that my personal development as a Dev is held off because of working all alone with no supervisor.
Post Scriptum
Fuck my boss. He won't let me refractor our biggest project yet (console, C#) because "he can listen to my moaning all day but when clients start complaining he has to act fast". Yeah, right. Wish me luck with fixing sluggish performance without reworking base of the app. -
My side project has been a SPA. One part was to make it "serverless" (folder of markdown and html files for content,config.json, no database). Another part was I wanted anybody to be able to choose whatever theme/framework they wanted and easily be able to change the config file, so I looked for a templating framework... and found PugJs. I choose it solely because I liked the logo :^).
3 days later, after successfully figuring out how to use pugjs on the client side, implementing different templates, and making sure everything loaded in the right order. I tested how big the website was without any content.
Woof.
So I'm just going to use a feature that was already in Bone.io to begin with :^). (Bone.io has a router and a "view mount" feature) -
Anyone here know any good communities to join? The only thing that has taught me are error messages and the occasional internet video. I never knew that the word refractor existed until now.7
-
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.