Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Hands-On Enterprise Application Development with Python
Hands-On Enterprise Application Development with Python

Hands-On Enterprise Application Development with Python: Design data-intensive Application with Python 3

Arrow left icon
Profile Icon Saurabh Badhwar
Arrow right icon
R$50 per month
Paperback Dec 2018 374 pages 1st Edition
eBook
R$80 R$245.99
Paperback
R$306.99
Subscription
Free Trial
Renews at R$50p/m
Arrow left icon
Profile Icon Saurabh Badhwar
Arrow right icon
R$50 per month
Paperback Dec 2018 374 pages 1st Edition
eBook
R$80 R$245.99
Paperback
R$306.99
Subscription
Free Trial
Renews at R$50p/m
eBook
R$80 R$245.99
Paperback
R$306.99
Subscription
Free Trial
Renews at R$50p/m

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
Table of content icon View table of contents Preview book icon Preview Book

Hands-On Enterprise Application Development with Python

Design Patterns – Making a Choice

When a software application development project is taken up, it is essentially thought of as a problem that requires a solution. When we start to develop the application, we start developing a solution specific to the given problem. Eventually, this solution may start getting reused in problems of a similar kind, and becomes a standard solution for solving such problems. As time passes, we see that a lot of problems that display the same pattern. Once we modify our standard solution to work on this observed pattern, we come up with a design pattern. Design patterns are no joke; they take years to produce, after being tried and tested for solving a great number of problems with a similar pattern.

The design patterns not only define the way in which we architect our software application, they also provide knowledge about what worked and what...

Technical Requirements

Design patterns

A design pattern defines a way in which we can organize our solution to a given problem. It does not define algorithms that can be used to solve the problem, but rather provides an abstraction about how, for example, the code should be organized, what classes need to be defined, what their granularity will be, and how the different objects will be created.

The design patterns have gained a lot of traction, and the book Design Patterns: Elements of Reusable Object-Oriented Software, though published in 1994, still serves as a de facto reference when trying to understand design patterns.

A design pattern will usually consist of the following elements:

  • A problem statement: A problem statement describes what we want to solve and hence also defines the design patterns we can use. The problem statement will tell us about the scope of the design that we are...

Object-oriented Python

Object-oriented programming (OOP) refers to the organization of code in a format where we are not concerned with the organization of methods, but rather we are concerned with the objects, their properties, and their behavior.

An object may represent any logical entity, such as an animal, vehicle, and furniture, and will contain properties and behaviors describing them.

The basic building block of an OOP-based language is the class that often groups the logically related entities together into a single unit. When we need to work with this unit, we create a new instance of this unit known as the class object, and manipulate the object using the public interfaces exposed by the object.

Object-oriented programming in Python differs quite a lot from what a person might see in C++ or Java, and these differences also affect the way in which we implement the different...

The Singleton pattern

The Singleton pattern is one of the patterns that finds its place in the book by Gang of Four, and which can have various uses where all we want is a class to have a single instance throughout an application.

The Singleton pattern enforces that a class will have only one instance that will be used by any of the components/modules inside an application. This kind of enforcement can be useful when we want to control the access to a resource using only one object. These type of resources can be log files, databases, crash-handling mechanisms, and so on.

In most of the OOP-based languages, to implement the Singleton pattern, the first step is to make the class constructor private and then use a static method inside a class to return the same instance whenever some part of the code needs to use the functionality of the class. In Python, we do not have the functionality...

The Factory pattern

During the development of large applications, there are certain cases where we might want to initialize a class dynamically, based upon the user input or some other dynamic factor. To achieve this, either we can initialize all the possible objects during the class instantiation and return the one that is required based on the inputs from the environment, or we can altogether defer the creation of class objects until an input has been received.

The Factory pattern is the solution to the latter case, where we develop a special method inside a class, which will be responsible for initializing the objects dynamically, based on the input from the environment.

Now, let's see how we can implement the Factory pattern in Python in a simplistic way, and then we will see how we can use the dynamic nature of Python to make our Factory class more dynamic.

So, let&apos...

The Model-View-Controller pattern

Let's start the discussion about the MVC pattern with a diagram:

The diagram shows the flow of a request in an Application using the MVC pattern. When a user makes a new Request, the Request is intercepted by the Application, which then forwards the Request to the appropriate Controller for that Request. Once the Request is received by the Controller, it then interacts with the model, which performs some business logic based on the Request received by it. This could involve the updating of databases, or fetching some data. Once the business logic is executed by the Model, the Controller executes the View with any data that needs to be passed to the View, which then displays the Response for the Request.

Although we will be implementing the MVC pattern later in the book, when we develop our BugZot application, let's take a look at the...

Summary

In this chapter, we went through the concept of design patterns and how they can help us solve some of the commonly encountered problems in designing our applications. We then went through how to decide upon which design pattern to use, and if it is compulsory to choose one of the patterns that has already been defined. Moving further in the chapter, we explored some of the object-oriented capabilities of Python as a language, and also explored some examples of implementing abstract classes and metaclasses in Python, and how we can use them to build other classes and modify their behavior.

Equipped with the knowledge of object-oriented Python, we moved on to implement some of the common design patterns, such as the Singleton and Factory patterns in Python, and also explored the MVC pattern, learning about what problems they try to solve.

Now with the knowledge of design...

Technical Requirements


The code listings in this book can be found under chapter02 directory at https://github.com/PacktPublishing/Hands-On-Enterprise-Application-Development-with-Python.

The code samples can be cloned by running the following command:

git clone https://github.com/PacktPublishing/Hands-On-Enterprise-Application-Development-with-Python

The instructions to run the code samples can be found under the README.md file present inside the chapter directory.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Explore various Python design patterns used for enterprise software development
  • Apply best practices for testing and performance optimization to build stable applications
  • Learn about different attacking strategies used on enterprise applications and how to avoid them

Description

Dynamically typed languages like Python are continuously improving. With the addition of exciting new features and a wide selection of modern libraries and frameworks, Python has emerged as an ideal language for developing enterprise applications. Hands-On Enterprise Application Development with Python will show you how to build effective applications that are stable, secure, and easily scalable. The book is a detailed guide to building an end-to-end enterprise-grade application in Python. You will learn how to effectively implement Python features and design patterns that will positively impact your application lifecycle. The book also covers advanced concurrency techniques that will help you build a RESTful application with an optimized frontend. Given that security and stability are the foundation for an enterprise application, you’ll be trained on effective testing, performance analysis, and security practices, and understand how to embed them in your codebase during the initial phase. You’ll also be guided in how to move on from a monolithic architecture to one that is service oriented, leveraging microservices and serverless deployment techniques. By the end of the book, you will have become proficient at building efficient enterprise applications in Python.

Who is this book for?

If you’re a developer who wants to build enterprise-grade applications, this book is for you. Basic to intermediate-level of programming experience with Python and database systems is required to understand the concepts covered in this book.

What you will learn

  • Understand the purpose of design patterns and their impact on application lifecycle
  • Build applications that can handle large amounts of data-intensive operations
  • Uncover advanced concurrency techniques and discover how to handle a large number of requests in production
  • Optimize frontends to improve the client-side experience of your application
  • Effective testing and performance profiling techniques to detect issues in applications early in the development cycle
  • Build applications with a focus on security
  • Implement large applications as microservices to improve scalability

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Dec 28, 2018
Length: 374 pages
Edition : 1st
Language : English
ISBN-13 : 9781789532364
Category :
Languages :
Tools :

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

Publication date : Dec 28, 2018
Length: 374 pages
Edition : 1st
Language : English
ISBN-13 : 9781789532364
Category :
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
R$50 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
R$500 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just R$25 each
Feature tick icon Exclusive print discounts
R$800 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just R$25 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total R$ 852.97
Hands-On Enterprise Application Development with Python
R$306.99
Hands-On RESTful Python Web Services
R$272.99
Mastering Concurrency in Python
R$272.99
Total R$ 852.97 Stars icon

Table of Contents

18 Chapters
Using Python for Enterprise Chevron down icon Chevron up icon
Design Patterns – Making a Choice Chevron down icon Chevron up icon
Building for Large-Scale Database Operations Chevron down icon Chevron up icon
Dealing with Concurrency Chevron down icon Chevron up icon
Building for Large-Scale Request Handling Chevron down icon Chevron up icon
Example – Building BugZot Chevron down icon Chevron up icon
Building Optimized Frontends Chevron down icon Chevron up icon
Writing Testable Code Chevron down icon Chevron up icon
Profiling Applications for Performance Chevron down icon Chevron up icon
Securing Your Application Chevron down icon Chevron up icon
Taking the Microservices Approach Chevron down icon Chevron up icon
Testing and Tracing in Microservices Chevron down icon Chevron up icon
Going Serverless Chevron down icon Chevron up icon
Deploying to the Cloud Chevron down icon Chevron up icon
Enterprise Application Integration and its Patterns Chevron down icon Chevron up icon
Microservices and Enterprise Application Integration Chevron down icon Chevron up icon
Assessment Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.