IT/Software career thread: Invert binary trees for dollars.

Tuco

I got Tuco'd!
<Gold Donor>
45,453
73,543
Vinen, I agree with your sentiment that refactoring (or any change to the code) can add regression defects. That's why I generally prefer to refactor only when I need to do major work in a component. Ex: I'm tasked with porting a set of motor controller code from a previous code base into a new one. This code, while well tested and working in the previous code base, is pretty bad and was written by a junior guy basically learning to program. None of us want to maintain it as is, we don't feel sure when modifying it and debugging any problems (software, mechanical or electrical) is a mess when it gets involved.

Even if no changes are made, I will have to fully validate it in the new code base. So since I'm going to eat that cost I may as well spend a couple days refactoring it so that it's no longer a stumbling block.
 

Khane

Got something right about marriage
19,840
13,357
People actually refactor code that doesn't need functionality or versioning changes? What a colossal waste of time. Does the business you work for not have any real work that needs to be done?
 

Vinen

God is dead
2,783
490
People actually refactor code that doesn't need functionality or versioning changes? What a colossal waste of time. Does the business you work for not have any real work that needs to be done?
I <3 people who live in Ivory Towers. (Not referring to you!)
 

Kovaks

Mr. Poopybutthole
2,354
3,142
Sounds like I'm weird. If your code base is small and your tdd or automated suite is strong (unit, spec, integration and e2e) then refactoring and regression should be relatively painless. If it is gonna throw off the sprint then makeing a todo to add to the backlog and getting back to it can also make sense but if something is really bad like tuco mentioned where every time you touch it you have no idea what else you'll break you are probably better off fixing it.
 

Vinen

God is dead
2,783
490
Sounds like I'm weird. If your code base is small and your tdd or automated suite is strong (unit, spec, integration and e2e) then refactoring and regression should be relatively painless. If it is gonna throw off the sprint then makeing a todo to add to the backlog and getting back to it can also make sense but if something is really bad like tuco mentioned where every time you touch it you have no idea what else you'll break you are probably better off fixing it.
If your code base is small and you have to refactor that often you are likely doing something wrong.

I'm referring to refactoring large areas and not targeted areas. EX: A full feature.
 

Tenks

Bronze Knight of the Realm
14,163
606
Or your requirements are constantly changing. Most of my refactors occur because I write something (or someone wrote something) and now product is like "Oh yeah we want this too and we want this to work this way now."
 

Vinen

God is dead
2,783
490
Or your requirements are constantly changing. Most of my refactors occur because I write something (or someone wrote something) and now product is like "Oh yeah we want this too and we want this to work this way now."
Read: Doing something wrong.

Sounds like whomever is understanding your requirements has no idea what they are doing.

I can understand small pivots but it shouldn't be the case where it is a super common occurrence. This is just a lack of foresight and planning (AKA Agile)
 

Kovaks

Mr. Poopybutthole
2,354
3,142
So are you doing waterfall? Our agile teams work in 1 to 2 week sprints and develop what the user thinks they want. Then they adjust to the feedback of what they really want as the add on to the product. Some refactoring comes from that but also when production systems come up for enhancements really old ones are crap and need fixing or recent ones may still be behind our current practices and if refactoring makes sense we do what we can.
 

Tenks

Bronze Knight of the Realm
14,163
606
Maybe but it can also stem from product not fully understanding what they're asking. I recall most was I was working on a project where product told us we're going to be delivering large-sized collections on a daily basis. So I designed it with the intention on a daily basis we'll be comparing a pre-image to a post-image and delivering changes. Then they wanted it on a schedule (ie: non-daily.) Ok not really a problem. But now they also wanted so if a collection was being delivered and an item number from one collection was being delivered they want the item to be delivered most up-to-date regardless of the delivery schedule. EG if one collection has item#1 on a weekly schedule and another collection has item#1 but on a monthly schedule I needed to deliver item#1 rolled up by the two. But I also needed to know that now the pre-image of the monthly has been delivered mid-month and when I compare that item later to only go back a certain amount because it was delivered earlier this month. It became a nightmare because I had to basically re-engineer the entire HBase table and rewrite almost all the code to accomplish this. Product thought it was just a minor feature addition. I never really thought "I completely fucked up the design" because it worked well until this feature was required. I could have shoe-horned this feature in with my old design but it would be creaky so I opted for an almost full redesign and rewrite of the application. However it would have been nice if product let me know when I was initially designing the application this would be a future use instead of telling me everyone wants it every day.
 

Noodleface

A Mod Real Quick
37,961
14,508
We define customer requirements up front. If they want any changes at all, no matter how small, they have to meet with the corporation and get it fully vetted by us. Even changing a 0 to a 1 and turning something on requires it.
 

Lendarios

Trump's Staff
<Gold Donor>
19,360
-17,424
Tenks.. For the love of God.
rrr_img_106441.jpg
 

Kovaks

Mr. Poopybutthole
2,354
3,142
We define customer requirements up front. If they want any changes at all, no matter how small, they have to meet with the corporation and get it fully vetted by us. Even changing a 0 to a 1 and turning something on requires it.
I have been in this situation too. From a coding perspective I much prefer just working closely with the users to make what they want, but I also understand that from a money making perspective this can be necessary. Our budget is way different than corporate so we have alot more flexibility
 

moontayle

Golden Squire
4,302
165
Handed off my redesign project for testing earlier today. Pretty stoked about this, even though it's just an internal tool. Basically took the work that was being done in three separate internal apps and condensed it to one. I also moved in another bit of functionality that probably should have existed in the tool in the first place but was in a fourth app. This will make the team that uses this very happy and cut down on what they need to do to get a device ready.
 

Noodleface

A Mod Real Quick
37,961
14,508
I had to write the new bios (a lot of porting too) for our new servers coming out all by myself. Only been doing bios since October so a fairly large and important task to myself. Servers came in so we finally got to load my bios and wouldn't you know that shit booted first attempt. Boss said I did awesome and for once actually felt like I did good work.
 

Lendarios

Trump's Staff
<Gold Donor>
19,360
-17,424
Congrats guys. It's all about the little victories. Savor them for those times where the thing crashes because you missed an !
 

Vinen

God is dead
2,783
490
I had to write the new bios (a lot of porting too) for our new servers coming out all by myself. Only been doing bios since October so a fairly large and important task to myself. Servers came in so we finally got to load my bios and wouldn't you know that shit booted first attempt. Boss said I did awesome and for once actually felt like I did good work.
Nice.
 

Kovaks

Mr. Poopybutthole
2,354
3,142
Successful hackathon today. Built some robots programmed them to do obstical courses, follow lines and capture the flag... all teams got them working through a Web interface command and 3 of them were able to get them autonomous for the challenges. I ran it so I didn't get to code much other than helping out but it was a shit load of fun and a great break from the everyday.
 

moontayle

Golden Squire
4,302
165
Successful hackathon today. Built some robots programmed them to do obstical courses, follow lines and capture the flag... all teams got them working through a Web interface command and 3 of them were able to get them autonomous for the challenges. I ran it so I didn't get to code much other than helping out but it was a shit load of fun and a great break from the everyday.
That's pretty cool. Previous employer has one of those every year. Sometimes it even produced something we'd use internally.

Next thing I get to work on is attempting to connect one android device to another, essentially having one act as a server. The challenge is doing that when the server IP is dynamic. I've already done proof of concept with static IPs but got shuffled off to other work before I could dive into that other aspect. Android has NSD (network service discovery) so trying that first.