r/ProgrammerHumor • • Nov 25 '22

Meme Coding strategies

Post image
52.2k Upvotes

385 comments sorted by

View all comments

Show parent comments

46

u/[deleted] Nov 25 '22

A team lead at AT&T told me that a single function shouldn't be too clever because that makes it harder to read, maintain, and reuse. This was in reference to a monstrosity I created that would take in an object of data that could have arbitrarily nested arrays and objects and try to transform them into html groups, headings, tables, etc. I made it a little too clever when we wanted to handle some data differently so I added a second parameter for transformation options like rules for pluralizing, sorting, or entirely replacing some keys.

I started this solution because they gave me 2 or 3 days to model and map literally hundreds of fields into a very simply formatted series of tables. The tedium was so great that doing it by hand would actually take longer than the time allotted. It was actually great for a few sprints that whenever we wanted to add another massive page they could just pipe the data through my ember component. But eventually we started adding overseas people to the teams and coordination was harder and they were much less skilled, so the team lead tasked a few people with converting all of those pages to html.

Unfortunately they didn't ask me to. They were happy with the generated output, but they wanted it to be easier to maintain by the new folks. That's all well and good, but we could have saved a lot of dev hours if they mentioned that so I could tell them to just capture the html being generated by the component instead of writing all of the HTML since they were not changing names, orders, or styles lol.

And that's my story :)

13

u/shrubs311 Nov 25 '22

this is the most classic software developer horror story lol it has everything

14

u/[deleted] Nov 25 '22

I have other stories where I'm the hero! I don't think I can tell the PEGA story but a small excerpt I can share anonymously would be that I get to write a duck type parser. It was complicated and clever, but it needed to be. As you can imagine, some systems at AT&T are very old. How old is PEGA? It has its own concept of arrays. If you had a data page with 1 user and you asked for the name, your data key would be "name". If there were 2 users on the page, you data keys would become "name1" and "name2"

And the data wasn't grouped, just a big blob. If you had a name2 there was probably also an age2 on the results somewhere. So naturally I parsed these numbers into an array and assigned the keys as properties of that index, so user[2] = name2. This worked great until one day we encountered a field called "business". This crashed a server because the value was business29999999999 where 2 is the index and 999 etc is a business phone number. Even att servers didn't like when I tried to allocate an array of that size.

So naturally the next move was to identify something that might be an index and look through the data to find a matching one. If we had a "name 2" we could check for any fields that were indexed with 2 and then check the remainder to see if it was formatted like a phone number.

That's probably the worst proprietary format I've ever had the displeasure of working with, but as far as my att adventures go that is neither the oldest system nor the most ridiculous. It might be the most unique though for others here in the field.

Having to get account status by reading through multiple gigs of logs and computing state from change messages? I'm sure that's no big deal for some of you. Having to truncate and format your responses for an ancient API that uses a screen reader that breaks if it receives more than 60 characters at a time? Everyone's had a few of those, right?

7

u/shrubs311 Nov 25 '22

that format makes me want to cry lol. someone on my team had to do something loosely similar and all i could think was thank god it's not me

4

u/[deleted] Nov 25 '22

Building it wasn't fun but it's a great resume piece to talk about

7

u/elon-bot Elon Musk ✔ Nov 25 '22

If you can't build a computer out of transistors, you shouldn't be working here.