上传者: python2007cn
|
上传时间: 2022-09-12 19:55:27
|
文件大小: 3.29MB
|
文件类型: PDF
Code alone isn’t enough. Sure, it’s what the computer runs, but code has to come from somewhere. A programmer has
to sit down and decide what features to include, how they should be implemented, what other software to utilize, and
how to provide hooks for future enhancements to be added. It’s easy to skip straight to code, ignoring the cognitive
process that produces it, but great programmers always have reasons for the decisions they make.
With a framework, like Django, many such decisions have already been made, and the tools provided are shaped by
these decisions, and by the programmers who made them. By adopting these philosophies in your own code, not only will
you be consistent with Django and other applications, but you may even be amazed at what you’re able to accomplish.
Beneath even the simplest code is the thought process that went into its creation. Decisions were made about
what it should do and how it should do it. This thought process is a step often overlooked in books and manuals,
leading to an army of technicians slaving away, writing code that manages to accomplish the task at hand but without
a vision for its future.
While the rest of this book will explain in detail the many basic building blocks Django provides for even the
most complicated of projects, this chapter will focus on even more fundamental aspects of the framework. For those
readers coming from other backgrounds, the ideas presented in this chapter may seem considerably foreign, but that
doesn’t make them any less important. All programmers working with Python and Django would do well to have a solid
understanding of the reasons Django works the way it does, and how those principles can be applied to other projects.
You may want to read this chapter more than once, and perhaps refer to it often as you work with Django. Many
of the topics are common knowledge in the Django community, so reading this chapter carefully is essential if you
plan to interact with other programmers.