r/badcode • u/646c726f576f6c6c6548 • Apr 07 '21
java Apparently Java can only handle 255 parameters in a constructor...
4.0k
Upvotes
r/badcode • u/646c726f576f6c6c6548 • Apr 07 '21
View all comments
Show parent comment
7
u/SireBillyMays Apr 07 '21
TL;DR: 70 columns could be necessary, but probably isn't. If it's a low-cost system just for internal use it's honestly probably fine to not touch it. The way to reduce/optimize the database could be quite complex, and not necessarily distill-able to a single comment. I took the courses through uni, so I have no clue about online resources.
If it's a pre-existing solution for the org. you're interning at I would probably be a bit careful suggesting changes to that. Other than that, I can give some generic advice. There are "formal" ways to identify, categorize and optimize the tables, but if you haven't taken any courses I probably wouldn't jump straight to that. The TL;DR: way is to look and identify duplicated/unecessary data, and then find ways to split that data out into it's own tables. A simple example can be:
In the above "database", the colour:colourcode information is directly linked, where the "colour" field is really just adding information to the colourcode-field (or vice versa.) Let's split the table above into two distinct tables:
The table with customer ID and a simple colourcode:
And then a separate table linking the colourcodes to the colour names:
For this small example, it doesn't really save that much, but imagine we instead had 1000 entries. That's a lot of unnecessary repetitions that #0000ff is blue.
As for courses, I've only taken database courses at a university. No clue about online resources, unfortunately. But I will tell you that every book I've seen in the field is unnecessarily wordy and tends to cover minutiae that is hardly ever relevant, so I would definitively recommend learning it "distilled" through someone else.
Best of luck!