Static also allows the compiler to make better optimizations, knowing that nothing outside of the current compilation unit will ever use it. Const also allows the compiler to optimize better with the knowledge that the called function won't perform any writes to the object state. Access modifiers give you a way to separate out functions that can be called externally vs those that shouldn't. The API doc generator won'…
The Wrong Kind of Paranoia
31–40 of 54 posts
Re: The Wrong Kind of Paranoia
#32`private` is a joke in C++. Coupling happens at the header file level, not the class level. Any C++ programmer who cares about reducing dependencies should be thinking about header files, not classes. Man, we really need a module system. I think the problem is not that `private` exists, but that it is taught/sold to programmers as a silver bullet for making software architectures better. People think "Decoupled syste…
And you might be getting one: https://isocpp.org/files/papers/n4214.pdf
It's under consideration for C++17, as I recall.
EDIT: Also, CLANG allows you to use modules right now, but IIRC those are CLANG specific extensions and the final module spec. may or may not be compatible with them.
Re: The Wrong Kind of Paranoia
#33Re: The Wrong Kind of Paranoia
#34`private` is a joke in C++. Coupling happens at the header file level, not the class level. Any C++ programmer who cares about reducing dependencies should be thinking about header files, not classes. Man, we really need a module system. I think the problem is not that `private` exists, but that it is taught/sold to programmers as a silver bullet for making software architectures better. People think "Decoupled syste…
Re: The Wrong Kind of Paranoia
#35This post resonates with my experiences of the last 6 months. I'm a very good web developer, and have been working for a while now on a couple iOS projects. Coming from javascript which everyone seems to regard as dangerous and overall terrible, I expected that after some time I would get used to and appreciate working in Objective-C and Swift. Nothing could be further from the truth. While you can shoot yourself in…
Re: The Wrong Kind of Paranoia
#36TLDR sorry James, we have tried the elegance of extremely simple and open language/runtime architectures, and that was always an abject failure.
Re: The Wrong Kind of Paranoia
#37> If they're not in the tutorial, examples, or reference, you don't even know they exist. If you use the header file for documentation, and internal methods are grouped together beneath the terse comment "internal methods," then why are you calling them? Autocomplete is a thing. Even if there is a big comment explicitly saying not to use a function, if it doesn't show up in the autocomplete window someone will inevit…
If I'm reading this correctly, you're saying that someone will use a function for which there is no documentation, no external reference, and the user hasn't even seen the code (since they didn't see the comment saying not to use it)? Just a function name and (maybe) a method signature in the autocomplete? The caller deserves whatever woes befall them.
Re: The Wrong Kind of Paranoia
#38When you are working to refactor software written by others, things like "private methods" are a gift. If you are trying to refactor some piece of code, you only have to make sure that the callers within the said class are modified to guarantee that the codebase is not broken.
I don't think a lot of people understand that maintainers in the real world do not have the time to read and understand every line of your code. And the toughest part of doing software maintenance is figuring out how much you can safely ignore. I feel qualifiers like "private" were designed to help with this problem.
I also severely dislike the architecture proposed by the author with loosely coupled services talking over a socket. This style of code is only maintainable if you understand the entire system inside and out. For example, lets say the maintainer receives a ticket that says 'Report X has wrong data'. She will start investigation with the question : 'Why does it have wrong data ?'. She will walk back up the call tree looking for why and eventually learn that the data coming off the socket is wrong and that is where the trail ends (unless there is a document describing who is responsible for putting said data there).
I have faced this issue in real life. I can understand when this style of decoupling is necessary to improve modularity, but it does not have a positive maintenance impact.
Re: The Wrong Kind of Paranoia
#39As other comments say, its a documentation to future self and others.
Re: The Wrong Kind of Paranoia
#40I wonder how much the software state of the art is advanced by software developers as opposed to software maintainers. When you are working to refactor software written by others, things like "private methods" are a gift. If you are trying to refactor some piece of code, you only have to make sure that the callers within the said class are modified to guarantee that the codebase is not broken. I don't think a lot of…