Essay sample library > Unnecessary classes

Unnecessary classes

2024-01-02 07:22:35

Today I opened a python module that made me feel sad. There are two classes: one has four methods, all methods are static, no properties; the other has only one method: __ init__ and five properties

It is not a class with only static methods. If this class exists only for grouping functions into a common namespace and then creating a new module (.py file), python will organize the namespace.

I usually only start to make the necessary function, but as far as this comes, there are several functions to do the related work, just create a module and move there.

This is a class similar to the C structure. You can use a dictionary here, in this example you run the factory function of __init__ work.

Another interesting embedded data structure is tuple. It has a clever implementation, you should check out :)

One rule I follow when using a dictionary in the example above is to always modify them using special functions. It is a well-defined structure and module that knows how to build and manage these structures within an application.

Here I propose that writing classes with states and methods, maintaining the state of the dictionary (or tuples, lists, sets), and actually writing functions that manipulate states OO is the opposite. I recently used this method over class.

Stopping writing is a wonderful presentation done by Jack Diederich at PyCon 2012 and shows examples of using too much of the course.

As the course referred to in this article is unnecessary at university, the university still has many unnecessary courses. The title of the course "think locally and act globally" is like a global development course. The only real complaint I found in the article was that the professor used the class as an immigrant and the class Indian girl was angry for a good reason. The professor said that Indian immigrants had no family because racism is the purpose of these courses. Let white men regret for those immigrants who really do not want sympathy until they are brainwashed by the same elite cultural Marxist. Divide races and destroy Western civilization from their goals

The university also teaches basic thinking skills. Many people complain that unnecessary courses are necessary to obtain a university degree. For example, why do you need to learn English and history lessons in Mathematics major? Why does British literature major take courses in biology and astronomy? Why do some people have to take a course of philosophy? Until the end of the year, most people understand the purpose of liberal arts, in addition to cultural experience and the development of fully developed individuals, but also teaches methods to learn and solve problems. For math students, there may not be the advantage of participating in an English literature course and having to read and understand the novels that you dislikes, but that teaches reading comprehension. Philosophy teaches different thought processes. The English major will benefit from the problem solving required in the mathematics curriculum