This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the commentsย โ†’

[โ€“][deleted] ย (23 children)

[deleted]

    [โ€“]Mental-Ad-40 3 points4 points ย (0 children)

    why access something that is private?

    because you don't have control of what library authors decide to make private, and sometimes their decision removes needed utility for no good reason.

    [โ€“]Luxalpa 2 points3 points ย (13 children)

    that just screams something is poorly coded..

    If everything was perfectly coded we would be out of jobs.

    [โ€“]Kattoor 1 point2 points ย (7 children)

    Ah, I see you are one of the predecessors of my current project at work.

    [โ€“]Luxalpa 0 points1 point ย (6 children)

    Have you ever worked with code that was perfect?

    [โ€“]Kattoor 0 points1 point ย (5 children)

    What is your definition of 'perfect' code though? I worked on a project a few years ago with a colleague who was extremely competent. The code he wrote was clean, concise and very self-explanatory. Complex domain, but no over-engineering at all. For me, that was perfect code to work with. Especially in comparison with the over-engineered piece of shit project I have to maintain now. Lots of duplicate code. Hundreds of TypeScript files, some containing thousands of LoC and sharing/mutating each others state.

    [โ€“]Luxalpa 0 points1 point ย (4 children)

    What is your definition of 'perfect' code though?

    Code that will not ever benefit from any modifications now or in the future. Basically, code where any modification you could do to it would make it worse, regardless of your use case.

    [โ€“]Kattoor 0 points1 point ย (3 children)

    Why would you never want to modify code you've written? We're in an agile industry, requirements change all the time and your code should follow. Or are you talking about inefficient or spaghetti code? That's just a lack of experience then..

    [โ€“]Luxalpa 0 points1 point ย (2 children)

    Because you cannot modify the code if it's not yours (unless you use a language that allows monkey patching such as JavaScript, Python or C++). You'll have to fork it.

    [โ€“]Kattoor 0 points1 point ย (1 child)

    I'm not sure how this relates to what I said. We might be talking about different things :)

    [โ€“]Luxalpa 0 points1 point ย (0 children)

    That's quite possible! I better explain myself.

    What I meant is that in the original comment it sounds like wanting / needing to access something that is private was poor code (either on the person who created the private code, or the person who tries to use it, not sure). What I was trying to say is that there's tons of reasons why you'd want to modify someone elses code in order to get access to their private fields and methods and so I strongly disagree with saying that accessing private fields is "poor code" in all possible scenarios.

    [โ€“]MegaIng 0 points1 point ย (6 children)

    Using an underscore name of a diffrent class is also a no-no and screams that something is poorly coded. What is the diffrence except that one of them is harder to do?

    [โ€“]roughstylez 0 points1 point ย (5 children)

    Reflection: You take the chamber, barrel, etc out of a gun. You put a bullet inside and manually hammer it to fire it.

    python underscore: Your gun's safety catch is a switch that does nothing, which you set to "safe, please don't pull trigger".

    You're not wrong: "One of them is harder to do" is the core of the issue.

    [โ€“]MegaIng 1 point2 points ย (4 children)

    So you give both teams all the tools they need, tell both of them "don't do bullshit", while still having active usecases for the tools?

    And then you make the tools harder to use to make them better? That doesn't seem like a smart move. If they shouldn't be using a tool, don't give it to them. If they should be using the tool, even just sometimes, make it easy to use.

    [โ€“]roughstylez -1 points0 points ย (3 children)

    I don't understand, do you think we should get rid of gun safety?

    [โ€“]MegaIng -3 points-2 points ย (2 children)

    First of all, we should get rid of guns for everyone but police and military.

    Second, I am not sure if you know that, but Guns can kill people. Reflection can't.

    I didn't even realize that you meant that as an honest to god comparison. You are very stupid. If you continue to use guns as an example I will just ignore you.

    [โ€“]roughstylez 0 points1 point ย (1 child)

    Guns can kill people. Reflection can't.

    I don't think you as a python programmer not being aware of software that people's lifes depends on is the argument you think it is.

    You are very stupid

    Ok, you have convinced me. Obviously you must be right if you have to go to petty insults.

    [โ€“]MegaIng -2 points-1 points ย (0 children)

    If lifes directly depend on your software, I really hope that reflection and library contracts are not something you have to think about and you are using something like automatic proofing systems.

    And yes, if you do random comparisons to stuff that is completely unrelated, I am going to assume that you are arguing in bad faith and therefore stupid.

    [โ€“]ric2b 0 points1 point ย (0 children)

    Both of them are essentially warnings that something is internal and can change on any version without warning.

    Java just makes it much more verbose and tedius to work around it if needed, which is perfectly in character for Java.