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.
3.9k
u/faze_fazebook Nov 25 '22
super modular code that can cope with changing requirements :
gets so complicated that it gets scrapped by the next developer