Sounds reasonable to me: With what I’ve written I don’t think I’ve ever been in a situation like the one you describe, with an algorithm split over several classes. I feel like a major point of OOP is that I can package the data and the methods that operate on it, in a single encapsulated package.
Whenever I’ve written in C, I’ve just ended up passing a bunch of structs and function pointers around, basically ending up doing “C with classes” all over again…
This makes sense to me, thanks! I primarily use Python, C++ and some Fortran, so my typical programs / libraries aren’t really “pure” OOP in that sense.
What I write is mostly various mathematical models, so as a rule of thumb, I’ll write a class to represent some model, which holds the model parameters and methods to operate on them. If I write generic functions (root solver, integration algorithm, etc.) those won’t be classes, because why would they be?
It sounds to me like the issue here arises more from an “everything is a nail” type of problem than anything else.
I have to be honest: I dont see the problem of including the entire signature at the top of the doc, and the listing the params below. If I know the class/function, a quick look at the signature is often all I need, so I find it convenient that it’s at the top of the doc. If it’s a class/function I’m not familiar with, I just scroll to the bullet points.
I agree on the bit about whitespace in signatures though. Luckily Python allows me to use as many lines as I want within a parentheses.
Yes, typing <p> in HTML is like pressing enter in word, but that doesn’t make it a programming language, it makes it a markup language.
A markup language is also what you can use to format comments here: You use a specific syntax to indicate how you want things formatted.
The separation from a programming language is that a programming language can be used to implement logic, like saying: In the following paragraph, a word should be bold if it contains the letter “A”. That cannot be done with a markup language.
A markup language (which is what HTML is) is like an advanced text container. When you write a post or comment here, you can use specific syntax to indicate the size of the text, a hyperlink, a quote, etc. HTML is that. It doesn’t “do” anything, you’re just writing in what you want it to display, and that is displayed.
A programming language lets you somehow “do” something. Instead of declaring explicitly “write this text in bold” a programming language can be used to process all the text in an arbitrary document, and change the word “aeroplane” to bold whenever it turns up. That is: The output from the code isn’t just a rendering of what is explicitly written there, which is what a markup language gives you.
I don’t know if this is done in practice, but if you have a nuclear powered sub, implementing a water electrolyzer that makes oxygen is fairly trivial. Then you have air as long as you have power, so they could in principle stay submerged for ≈ 20 years, or however long the nuclear reactors can go without refill.
Not even “not so bad”, I would say that as a scripting language it’s fantastic. If I’m writing any actually complex code, then static typing is much easier to work with, but if you want to hack together some stuff, python is great.
It also interfaces extremely easily with C++ through pybind11, so for most of what I do, I end up writing the major code base in C++ and a lightweight wrapper in Python, because then you don’t have to think about anything when using the lib, just hack away in dynamically typed Python, and let your compiled C++ do the heavy lifting.
I use a GUI (GitKraken) to easily visualise the different branches I’m working on, the state of my local vs. the remote etc. I sometimes use the gui to resolve merge conflicts. 99 % of my gut usage is command line based.
GUI’s definitely have a space, but that space is specifically doing the thing the command line is bad at: Visualising stuff.
I really don’t see the hassle… just pick one (e.g. pip/venv) and learn it in like half a day. It took college student me literally a couple hours to figure out how I could distribute a package to my peers that included compiled C++ code using pypi. The hardest part was figuring out how to cross compile the C++ lib. If you think it’s that hard to understand I really don’t know what to tell you…
I’ve grown up learning to type on my regional layout. Why would I go through the hassle of re-learning key placements when most laptops/keyboards sold in my country use the regional layout? I don’t think I’ve ever been in a situation where I’ve had to work on any other layout for more than a few minutes.
I am very fond of the idea of “stateless” code, which may seem strange coming from a person that likes OOP. When I say “stateless”, I am really referring to the fact that no class method should ever have any side-effect. Either it is an explicit
set
method, or it shouldn’t affect the output from other methods of the object. Objects should be used as convenient ways of storing/manipulating data in predictable/readable ways.I’ve seen way too much code where a class has methods which will only work"as expected" if certain other methods have been called first.