Questions about how to manage your own classes [closed]

Asked 2 years ago, Updated 2 years ago, 110 views

Do you want to improve this question?Update your question, Edit this post to be answered with facts and quotes.

Closed 4 years ago.

4 years ago

C++, Python, etc. are classified to make it easy for you to use.
Over time, you forget what you made and reinvent the wheel.

How do you manage your own classes and functions?
I am very sorry for the vague question, but I would appreciate your advice.
Thank you for your cooperation.

python java c++ visual-studio

2022-09-30 18:18

2 Answers

"What would you do?" Questionnaire questions are not preferred in SO.In fact, at this point, there are three votes for now.It might have been nice if this was "What are some techniques to improve the reuse of source code?"

So, what level are you talking about?Have you reimplemented the same functions as those found in the standard library?Have you reimplemented a well-known, efficient algorithm?Have you reimplemented features specific to your program?

I want to avoid the former two as much as possible.This can be avoided by knowledge and experience.Here's the last one.

"Forgetting" itself is a matter of course, and it is rare for people to reuse/can do exactly the same code (such as changing chips to reduce costs in embedded systems).

"Reuse is ""specifications"" or rather ""ground"" that adopts such specifications (it can be used as a basis for adopting the same specifications or as a basis for changing specifications)."It's not supposed to be written in the source code, it's supposed to be written in the specifications or know-how, but programmers prefer to read the source code rather than the specifications, so they have to write that much on the source code.If it's a technique to make it easier to reuse,

  • Manage source code with the source code management tool
  • Leave keywords for specifications (in a grep-friendly way). SO's tag is better.)
  • When you first write a code, write a comment so that you can search the specifications properly
  • Leave evidence and reasons for making such a decision in the form of separate documents and comments

Specifications are often reused, but the source code itself is not.In that case, rewriting the source code is not "reinventing the wheels," but "reinventing the wheels" (reinventing at the invention level is very rare) Refactoring is just a re-inventing the same function...

To improve your skills, it's not a waste to write code or decide specifications better than the old ones.In order to do that, it would be impossible to find the previous code and specifications.The above is a way to do this, so you can write more sophisticated, faster, and smaller codes.Don't hesitate to write a new code.


2022-09-30 18:18

In my case, I don't manage anything in particular.
Sometimes I remember that I made something like this before, but I still don't remember the specifications.

When I need a class similar to the one I made before, I rarely use it as it is, even though I may refer to the previous code.

If you're aiming for a library that many people can use, there are many functions that many people can use, and you can use it anytime, but if you're just making it yourself and using it yourself, I think it's better to have a class specification that fits the program you want to create now.

Therefore, we do not specifically manage or write documents, and we only refer to the previous code.

The following is Snakefoot.
I don't think "reinventing wheels" is so bad/avoidable.
If you mean that the "reinventing the wheel" part is stuck in your mind, why don't you reinvent it a little more comfortably?


2022-09-30 18:18

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.