Skip to content

How can I push my refactored code here? #63

Description

@Wangsutan

How can I push my refactored code here?

Hello everyone, my name is Wang Sutan, a programming enthusiast from China. I have refactored this ASCII art project.

Recently, the inappropriate use of this project by a well-known Chinese blogger, He Tongxue, has made this library known to many Chinese people. I believe that the actions of He Tongxue's team have damaged the image of Chinese programmers. I took this opportunity to refactor the project, with the first goal being to understand the project and learn the related technologies, and the second goal is to try to showcase a good image of Chinese programmers.

The basic logic of the original project is largely correct, but the code has a low degree of modularity and lacks readability. I mainly did the following work (you can also refer to this article):

  • Unified the management of core data related to characters.
  • The function get_args() for reading command line arguments has been decoupled in terms of parameter passing.
  • Completely refactored the algorithms related to ASCII art into several functions. In this process, I even discovered a significant flaw in the original code, which is that the original project had serious size issues when dividing a string of characters on a long strip of images. When I tried to divide Chinese characters, the result was chaotic. Now it has been fixed.
  • Added and improved type annotations.

I also have a certain understanding of Chinese character culture, and I took this opportunity to select some interesting Chinese characters and put them into the dictionary.

I obtained the code and resources by directly downloading the .zip file. The new code has been placed in my own repository. I don't know how to push my modifications to the original project, can anyone tell me?

My refactoring may introduce some new issues, and I welcome everyone to provide more opinions and suggestions.

如何将我重构的代码推送过来?

大家好,我是来自中国的编程爱好者王苏谈,重构了这个字符画项目。

近期,中国知名博主何同学对这个项目的不当使用,使得这个库被很多中国人知道。本人认为,何同学团队的做法损害了中国程序员的形象。我趁此机会,将该项目进行了重构,目的一是了解该项目,学习相关技术,二是尝试展现我们中国程序员的一种良好形象。

原项目的基本逻辑大体上是正确的,但是代码的模块化程度较低,缺乏可读性。我主要做了这些工作(还可以参考这篇文章):

  • 将与字符相关的核心数据统一起来管理。
  • 读取命令行参数的函数get_args()传递参数的方式实现了解耦。
  • 彻底重构了字符画相关的算法,做成了若干函数。在这个过程中,甚至发现了原代码的重大缺陷,就是原项目在划分一长条的图片上的一串字符时,尺寸是有严重问题的。我尝试划分汉字的时候,结果是混乱的。现在也改好了。
  • 添加和完善了类型注解。

我还对中国汉字文化有一定的了解,借此机会,挑选了一些好玩的汉字,放到字典中。

我是通过直接下载.zip的方式获取代码和资源的,新的代码放到了自己的仓库中。不知道怎么将我的修改推送到原项目,大家能告诉我吗?

我的重构也许会引入一些新的问题,欢迎大家多提意见建议。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions