售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Title Page
Copyright and Credits
Hands-On Enterprise Application Development with Python
About Packt
Why subscribe?
Packt.com
Contributors
About the author
About the reviewer
Packt is searching for authors like you
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Conventions used
Get in touch
Reviews
Using Python for Enterprise
Technical requirements
Recent developments in Python
Dropping backward compatibility
It's all Unicode
Support for type hinting
Where Python shines
The requirements of enterprise IT
Python in the enterprise ecosystem
Introducing BugZot – a RESTful bug tracker
Gathering requirements before development
Asking for the user requirements
Categorizing the requirements
Prioritizing the requirements
Generating the software requirement specification document
Summary
Questions
Further reading
Design Patterns – Making a Choice
Technical Requirements
Design patterns
Classification of design patterns
Defining the choice of design patterns
Object-oriented Python
The basic OOP principles
Encapsulation
Composition
Inheritance
Multiple inheritance in Python
Method resolution order in multiple inheritance
Utilizing mixins
Abstract base classes
Metaclasses
The Singleton pattern
The __call__ magic method
The Factory pattern
The Model-View-Controller pattern
Controller
Model
View
Summary
Questions
Building for Large-Scale Database Operations
Technical requirements
Database and object relational mappers
Setting up SQLAlchemy
Building optimal database models
Issues with our model definition
Optimizing our models
Taking advantage of indexes
Maintaining database consistency
Utilizing transactions to maintain consistency
Understanding lazy loading versus eager loading
Using relationships
Lazy loading
Eager loading
Optimizing data loading
Utilizing caching
Caching at the database level
Caching at the block level
Using user-level caching
Summary
Questions
Dealing with Concurrency
Technical requirements
The need for concurrency
Concurrency in GUI applications
Concurrency in enterprise applications
Concurrent programming with Python
Concurrency with multithreading
Thread synchronization
Re-entrant locks
Condition variables
Common pitfalls with multithreading
Race conditions
Deadlocks
The story of GIL
Concurrency with multiprocessing
Python multiprocessing module
Synchronizing processes
Summary
Questions
Building for Large-Scale Request Handling
Technical requirements
The problems of accommodating increased concurrency
The multiple options to scale up
Engineering the application for scalability
Controlling the concurrency
Using thread pools for handling incoming connections
Asynchronous programming with AsyncIO
AsyncIO terminology
Event loop
Co-routines
Tasks
Writing a simple Python AsyncIO program
Implementing a simple socket server with AsyncIO
Boosting the application concurrency
Running behind a reverse proxy
Improved security
Improved connection handling
Resource caching
Serving static resources
Summary
Questions
Example – Building BugZot
Technical requirements
Defining the requirements
Entering the development phase
Setting up the development environment
Setting up the database
Setting up the virtual environment
Structuring our project
Initializing the Flask project
Creating the configuration
Developing database models
Migrating the database models
Building the views
Developing the index view
Getting the index view to render
Building the user registration view
Deploying for concurrent access
Setting up Gunicorn
Setting up Nginx as reverse proxy
Establishing communication between Nginx and Gunicorn
Summary
Questions
Building Optimized Frontends
Technical requirements
The need for optimizing frontends
Components of an optimized frontend
What causes frontend issues
Optimizing the frontend
Optimizing resources
Fetching CSS in parallel by avoiding CSS imports
Bundling JavaScript
Utilizing client-side caching
Setting application-wide cache control
Setting request level cache control
Utilizing web storage
Working with local web storage
Working with session storage
Summary
Questions
Writing Testable Code
Technical requirements
The importance of testing
The different kinds of testing
Unit testing
Integration testing
Building an application with testing in mind
Test-driven development
Writing unit tests
Writing unit tests with Python unittest
Writing unit tests with pytest
Let's set up pytest
Writing our first test with pytest
Writing functional tests with pytest
Summary
Questions
Profiling Applications for Performance
Technical requirements
Behind the scenes of performance bottlenecks
Looking at the causes of performance bottlenecks
Probing an application for performance issues
Writing performance benchmarks
Writing our first benchmark
Writing an API benchmark
Doing component-level performance analysis
Measuring slow operations with timeit
Profiling with cProfile
Profiling for memory usage with memory_profiler
Collecting live performance data
Logging performance metrics
Avoiding performance bottlenecks
Summary
Questions
Securing Your Application
Technical requirements
Enterprise application security
The importance of enterprise security
Challenges in system security
Taking a look at the attack vectors
Security issues with native applications
Security issues with web applications
Security anti-patterns
Not filtering user input
Storing Sensitive Data Unencrypted
Ignoring bound-checking
Not keeping the libraries updated
Giving full privileges of the database to a single user
Improving your application's security
Summary
Questions
Further reading
Taking the Microservices Approach
Technical requirements
The shift toward microservices
Monolithic development model versus microservices
Advantages of the microservices architecture
Guidelines for microservice development
Service-level agreements in microservices
Building your first microservices application
The user microservice
The to-do manager service
Service discovery in microservices
Service registry inside microservices
Client-side service discovery
Server-side service discovery
API gateways in microservices
Asynchronous communication in microservices
Message queues for microservices communication
Summary
Questions
Further reading
Testing and Tracing in Microservices
Technical requirements
Testing in the microservices world
Unit testing in microservices
Functionality testing in microservices
Integration testing in microservices
End-to-end testing in microservices
Scalability testing
Challenges in microservices testing
Tracing requests inside microservices
The OpenTracing standard
Implementing tracing inside ToDo manager
Distributed tracing
Benefits of distributed tracing
Summary
Questions
Going Serverless
Technical requirements
The serverless approach to application development
Components of serverless architecture
Backend as a service
Function as a service
The restrictions on state management
Restrictions on execution times
Executing functions inside FaaS
API gateways in the serverless architecture
Understanding the execution of a serverless application
Cold-starting a function
Hot-starting a function
Building our first serverless application
A quick introduction to Apache OpenWhisk
Setting up the development environment
Building our configuration file
Integrating with the GitHub API
Getting the code ready to run with OpenWhisk
Taking the final steps toward deployment
Deploying to OpenWhisk
Understanding the execution of application Inside Openwhisk
Advantages of going serverless
Summary
Questions
Further reading
Deploying to the Cloud
Technical requirements
Deploying enterprise applications
Making a choice about the deployment strategy
The different deployment strategies
Recreated deployments
Rolling deployments
Blue/green deployments
Canary deployments
A/B deployments
Shadow deployments
Making a choice of infrastructure
The traditional infrastructure
Containerized approach toward application packaging
The move toward the cloud
The different types of cloud deployments
Private clouds
Public clouds
Hybrid clouds
Summary
Questions
Enterprise Application Integration and its Patterns
Technical requirements
The need for EAI
Point-to-point integration
Moving towards EAI
The traditional approach to EAI
The introduction of the ESB
Patterns in EAI
Integration patterns
Mediation pattern
Federation pattern
Access patterns
Asynchronous access patterns
Synchronous access patterns
Issues in EAI
Summary
Questions
Microservices and Enterprise Application Integration
Technical requirements
Microservices and the changing EAI landscape
Challenges of traditional EAI in microservices
Point-to-point integration of microservices
Integrating microservices using the ESB
Utilizing API gateways for the integration of microservices
Transformation of the ESB
Rethinking EAI in microservices
Summary
Questions
Assessment
Chapter 1
Answer 1
Answer 2
Answer 3
Answer 4
Answer 5
Chapter 2
Answer 1
Answer 2
Answer 3
Chapter 3
Answer 1
Answer 2
Answer 3
Answer 4
Chapter 4
Answer 1
Answer 2
Answer 3
Answer 4
Answer 5
Chapter 5
Answer 1
Answer 2
Answer 3
Answer 4
Chapter 6
Answer 1
Answer 2
Answer 3
Answer 4
Chapter 7
Answer 1
Answer 2
Answer 3
Chapter 8
Answer 1
Answer 2
Answer 3
Answer 4
Chapter 9
Answer 1
Answer 2
Answer 3
Answer 4
Answer 5
Chapter 10
Answer 1
Answer 2
Answer 3
Answer 4
Chapter 11
Answer 1
Answer 2
Answer 3
Answer 4
Answer 5
Chapter 12
Answer 1
Answer 2
Answer 3
Answer 4
Chapter 13
Answer 1
Answer 2
Answer 3
Answer 4
Chapter 14
Answer 1
Answer 2
Answer 3
Answer 4
Chapter 15
Answer 1
Answer 2
Answer 3
Chapter 16
Answer 1
Answer 2
Answer 3
Other Books You May Enjoy
Leave a review – let other readers know what you think
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜