Charles Lee

2025-01-12 Clean Code, Log, Comments, and Musings

Created: 2025-01-13

Created: 2025-01-13 00:16

Let's look at the world.

Economy

Outing

  • Bupyeong Station Underground Shopping Center (First visit due to a friend's visit): Packed with people. It's not easy to stand still. It's huge, the prices are low, and it's good.
2025-01-12 Clean Code, Log, Comments, and Musings

IT

English Study

  • I prepare English in advance and ask questions like this using ChatGPT to get satisfying answers. It seems that English teachers' jobs will be given, and it is very helpful for my writing. I am summarizing the articles I read every day and asking ChatGPT to check for better sentences.
    • Please correct the following English mistakes and indicate the mistakes separately. Please answer in markdown format. Please remove blank lines.

Code

  • What is the best way to use logs? I found and wrote about loggers to use in Python and Bash from open source. Python has a built-in standard module called logger, but I thought it would be better to choose loguru, which has more functions, and I added test results showing class names, etc. For Bash, I also thought it was necessary to distinguish between info/warn/critical, so I dealt with related open sources: https://github.com/cheoljoo/publish/blob/main/log.md
  • Comments should be made as clean as possible, as discussed in clean-code, to make the code as readable as possible. However, in Python, it seems good to add comments in docstring format for class/function units because it can be automatically documented. In the case of Bash, if you write it like a docstring by simply changing the prefix to #, I think it is possible to create a tool to automatically generate documents. :https://github.com/cheoljoo/publish/blob/main/comments.md
    • In Bash, pay particular attention to the fact that all variables are global variables, so if you express them well in the comments, you can create a map using this later to see at a glance where the variables are used. (Please suggest if you have a good idea.)

Comments0