Is this something professional programmers are having trouble with??
This is the kind of problem you face in your first year working, no? I am honetly curious what others think. Do you have trouble deciding when to use an interface (assuming your language has that), or a type wrapper (I don't think that's the brightest idea), or a function to extract the field to sort by (most languages do that)??
Your confidence that there is an obviously optimal way to model something reads as either brilliance or hubris and brilliance is a lot rarer.
Typically there are subtle trade-offs and compromises which only prove themselves to be useful/detrimental as the software changes over time. You can place bets based on experience but you can only really be cocky about your choices when looking back not looking forward
> Is this something professional programmers are having trouble with??
I would say, yes. So does everybody else. If you don't believe it, I don't think you appreciate the depth of these problems.
I am reminded of Eric Meijer saying that the interface (in the Java sense) part of the contract between types is the least interesting part. What is important are their algebraic properties, which can be modeled using functional types and other bunch of advanced type-theoretical ideas (like linear types for instance).
Modelling stuff with types is not easy, it's an art.
> Is this something professional programmers are having trouble with??
Nobody said this.
There is value in thinking about things like this sometimes, because it has long-term consequences for the projects we work on. Even if you're a "professional" programmer (whatever that means), it's valuable to go back to beliefs and knowledge you've established long ago to evaluate whether to change them in the face of new experiences you've made since the last time you've thought about it.
If you think "professional" programmers don't get this sort of thing wrong in some form or another, I have a bridge to sell you.
Why scare quotes though? Professional programmer just means someone who writes software for a living. Software is your profession... there's no doubt what that means , is there??
If you do that, you'll have run into this sort of decision very early in your career, and hopefully will understand the best way to handle it, which IMHO just depends on the language (because certain features lead to different optimum solutions) and the culture around it. But sure, I am happy to discuss fundamental topics like this, that's why I am engaging and asking what others think.
This is the kind of problem you face in your first year working, no? I am honetly curious what others think. Do you have trouble deciding when to use an interface (assuming your language has that), or a type wrapper (I don't think that's the brightest idea), or a function to extract the field to sort by (most languages do that)??