Book Image

PhpStorm Cookbook

By : Mukund Chaudhary
Book Image

PhpStorm Cookbook

By: Mukund Chaudhary

Overview of this book

Table of Contents (16 chapters)
PhpStorm Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Introduction


Grandma's advice: stick to software engineering.

Software engineering advice: emphasize on code reusability. Any code base engineered according to the software engineering paradigm will be reusable. That is to say, you can use your code forever having written it once. They say "Write once, use forever".

Revisiting the pizza baking use case, you will observe that in order to cook whatever dish, you just had to use the add function since you stuck to the mentioned paradigm. Suppose there are 50 different types of dishes that you are about to cook. Each dish is different in itself, but each will require the add method. If you convert this into technology, you will, in most cases, inherit the Dish class. That is your PizzaDish. The methods of the Dish class are reused in all the classes such as PizzaDish.

If you want to change the business logic, you can happily and comfortably change the logic inside the method body, and the changes will be reflected in all of the classes that inherit...