Python is engineering, not art, Python engineering, Art

Source: Internet
Author: User

Python is engineering, not art, Python engineering, Art

When Python first emerged on the software scene in the early 1990s, it spawned what is now something of a classic conflict between its proponents and those of another popular scripting language, Perl. Personally, I think the debate is tired and unwarranted today—developers are smart enough to draw their own conclusions.                                             Still, this is one of the most common topics I’m asked about on the training road, so it seems fitting to say a few words on the topic here.

When Python emerged in Early 1990s, It stirred up a classic conflict between Python supporters and another popular language, Perl advocates. Now this debate has become a thing of the past.

I personally think that this debate is boring and unfounded. Developers are very smart and know how to choose. So far, this is still the most famous debate.

I am often asked during my training. Therefore, it is necessary to say a few words on this topic.

The short story is this: you can do everything in Python that you can in Perl, but you can read your code after you do it. That’s it—their domains largely overlap, but Python is more focused on producing readable code.                                                         For many, the enhanced readability of Python translates to code reuseability and maintainability, making Python a better choice for programs that will not be written once and thrown away. Perl code is easy to write, but difficult to read. Given that most software has a lifespan much longer than its initial creation, many see Python as a more effective tool.

In short: Perl can do everything in Python, but you must be able to understand it after writing. Obviously, this is the main intersection between them.

Obviously: Python focuses more on code readability. In most cases, it improves code readability and converts it:Code reusability and maintainability.

In this way, Python becomes a good choice: It will be discarded after it is not written. Perl code is easy to write but hard to read.

Since software has a long life cycle and is far longer than initial development, many people regard Python as a more effective tool.

The somewhat longer story reflects the backgrounds of the designers of the two languages,and underscores some of the main reasons people choose to use Python.Python’s creator is a mathematician by training; as such, he produced a language witha high degree of uniformity—its syntax and toolset are remarkably coherent. Moreover,like math, its design is orthogonal—most of the language follows from a small setof core concepts. For instance, once one grasps Python’s flavor of polymorphism, therest is largely just details.
This largely reflects the background of two Language designers and reflects the reasons why many people choose to use Python.

The creator of Python is a well-trained mathematician, which makes the language it invented highly unified:

Both her syntax and toolset have significant consistency. Even more, like mathematics, its design is orthogonal:

That is, most languages follow the core concepts of a group. For example, once you have mastered polymorphism, most of the others are details.

By contrast, the creator of the Perl language is a linguist, and its design reflects this heritage.There are many ways to accomplish the same tasks in Perl, and languageconstructs interact in context-sensitive and sometimes quite subtle ways—much likenatural language. As the well-known Perl motto states, “There’s more than one way todo it.” Given this design, both the Perl language and its user community have historicallyencouraged freedom of expression when writing code. One person’s Perl code canbe radically different from another’s. In fact, writing unique, tricky code is often asource of pride among Perl users.
Compared with Perl, Perl was created by a linguistics, so its design reflects the features of this language.

In Perl, there are many ways to perform the same task. The language structure is affected by context interaction.

Sometimes it is very sensitive and very similar to natural language. As the famous Perl motto says:

All roads pass Rome! In view of this design, not only the Perl language itself and the Perl user community,

They all encourage and advocate the spirit of freedom when writing code. Therefore, the code written by a person may be very different from that written by others!

In fact, Perl developers are proud to write unique and skillful code!

But as anyone who has done any substantial code maintenance should be able to attest,freedom of expression is great for art, but lousy for engineering. In engineering, weneed a minimal feature set and predictability. In engineering, freedom of expressioncan lead to maintenance nightmares. As more than one Perl user has confided to me,the result of too much freedom is often code that is much easier to rewrite from scratchthan to modify.
But those who have maintained a lot of code can prove that the spirit of free expression is great for art.

But it is very annoying for projects. From the engineering perspective, we need to minimize the feature set and predictability.

In the field of engineering, free expression can lead to a nightmare of maintenance. More than one Perl user confided to me:

The result is that the program can easily be rewritten, but it is difficult to modify it!

Consider this: when people create a painting or a sculpture, they do so for themselvesfor purely aesthetic purposes. The possibility of someone else having to change thatpainting or sculpture later does not enter into it. This is a critical difference betweenart and engineering. When people write software, they are not writing it for themselves.In fact, they are not even writing primarily for the computer. Rather, goodprogrammers know that code is written for the next human being who has to read it inorder to maintain or reuse it. If that person cannot understand the code, it’s all but uselessin a realistic development scenario.
In view of this: When people paint the statue, they can apply it at will from a purely aesthetic perspective.

In the future, if someone has to change his painting or creativity, it will not be considered. This is the key difference between art and engineering.

When people write code, they cannot write code for themselves. In fact, they do not even write code for computers. Of course, good programmers know:

Code is written for future maintenance or even rewriting. If the person in charge of maintenance cannot understand the code at all, the code is practically useless in reality.

This is where many people find that Python most clearly differentiates itself from scriptinglanguages like Perl. Because Python’s syntax model almost forces users to writereadable code, Python programs lend themselves more directly to the full softwaredevelopment cycle. And because Python emphasizes ideas such as limited interactions,uniformity, regularity, and consistency, it more directly fosters code that can be usedlong after it is first written.
This is the most significant difference between Python and Perl, another scripting language.

Because the syntax mode of Python forces users to write readable code, the Python language will guide them forward towards the complete software development process. Because Python emphasizes:

Limited interactivity, consistency, regularity, and consistency can further lead to a long time since Python was first written.

In the long run, Python’s focus on code quality in itself boosts programmer productivity,as well as programmer satisfaction. Python programmers can be creative, too, andas we’ll see, the language does offer multiple solutions for some tasks. At its core,though, Python encourages good engineering in ways that other scripting languagesoften do not.
For a long time, Python's focus on code quality has also improved programmer productivity and developer satisfaction.

Python programmers will become more creative and we will understand later that for some projects:

This language does provide a variety of solutions. At the core, Python advocates that engineering development is not available in other scripting languages.

At least, that’s the common consensus among many people who have adopted Python.You should always judge such claims for yourself, of course, by learning what Pythonhas to offer. 
This is a consensus among many Python users. Of course, you can also determine what Python provides for you.


NOTE:This article is excerpted from Learning Python, Python is engineer, not art.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.