Modular Programming with JavaScript


– Learn CakePHP: With Unit Testing
– Modular Programming with JavaScript
– Typed PHP: Stronger Types For Cleaner Code

1 Accelerate your development of PHP applications using the popular CakePHP web application development framework and unit testing This short book shows you how to carry out test-driven development with fixtures, model tests, controller tests, mocks, and test suites Learn CakePHP contains all you need to get started with the CakePHP framework to build faster, better PHP-based web applications

You’ll learn about unit testing and how to implement it in CakePHP This approach to coding leads to better code, better applications, and better programming habits With this knowledge your PHP skills will go from strength to strength allowing you to write more and improved code

What you’ll learn
What is unit testing and CakePHP and how to put the two together
What is clean coding
What is TDD and the development cycle using this approach
How to work with fixtures, model tests, text callbacks, controller tests, and more
How to do mocks, test suites, testing from the command line and more
How to work with code coverage, fixtures data, and private methods

Who this book is for
This book is for experienced PHP programmers and web developers who have little or no experience using CakePHP and/or unit testing

2 Modularize your JavaScript code for better readability, greater maintainability, and enhanced testability

About This Book
Design and build fully modular, modern JavaScript applications using modular design concepts
Improve code portability, maintainability, and integrity while creating highly scalable and responsive web applications
Implement your own loosely coupled code blocks that can power highly maintainable and powerful applications in a flexible and highly responsive modular architecture
Who This Book Is For
If you are an intermediate to advanced JavaScript developer who has experience of writing JavaScript code but probably not in a modular, portable manner, or you are looking to develop enterprise level JavaScript applications, then this book is for you

A basic understanding of JavaScript concepts such as OOP, prototypal inheritance, and closures is expected

What You Will Learn
Understand the important concepts of OOP in JavaScript, such as scope, objects, inheritance, event delegation, and more
Find out how the module design pattern is used in OOP in JavaScript
Design and augment modules using both tight augmentation and loose augmentation
Extend the capabilities of modules by creating sub-modules using techniques such as cloning and inheritance
Move from isolated module pieces to a cohesive, well integrated application modules that can interact and work together without being tightly coupled
See how SandBoxing is used to create a medium for all the modules to talk to each other as well as to the core
Use the concepts of modular application design to handle dependencies and load modules asynchronously
Become familiar with AMD and CommonJS utilities and discover what the future of JavaScript holds for modular programming and architecture
In Detail
Programming in the modular manner is always encouraged for bigger systems-it is easier to achieve scalability with modular programming Even JavaScript developers are now interested in building programs in a modular pattern Modules help people who aren’t yet familiar with code to find what they are looking for and also makes it easier for programmers to keep things that are related close together

Designing and implementing applications in a modular manner is highly encouraged and desirable in both simple and enterprise level applications

This book covers some real-life examples of modules and how we can translate that into our world of programming and application design After getting an overview of JavaScript object-oriented programming (OOP) concepts and their practical usage, you should be able to write your own object definitions using the module pattern You will then learn to design and augment modules and will explore the concepts of cloning, inheritance, sub-modules, and code extensibility You will also learn about SandBoxing, application design, and architecture based on modular design concepts Become familiar with AMD and CommonJS utilities

By the end of the book, you will be able to build spectacular modular applications in JavaScript

Style and approach
This in-depth step-by-step guide will teach you modular programming with JavaScript Starting from the basics, it will cover advanced modular patterns that can be used in sophisticated JavaScript applications

3 Discover how stronger types mean cleaner, more efficient, and optimized PHP applications This unique book looks at typed PHP: PHP types, strings, regular expressions, and more from PHP 7 as found in standard PHP libraries, user libraries, extensions, and cross-compilers You’ll see how to create a set of reusable tools that unify and ease the scalar types of PHP

PHP has a rich history and a dominant place on the web It has achieved much despite language inconsistencies and difficulties Bjarne Stroustrup once said: “There are only two kinds of languages: the ones people complain about and the ones nobody uses”

PHP is one of those languages that everybody uses, yet that’s often seen as a good reason to ignore the bad parts and just get stuff done We’re all for getting stuff done, and to that end, the author has used Plain Ol’ PHP for many years It’s always bugged him how procedural PHP is, in an ecosystem of OOP libraries and frameworks So he decided to take a deeper look at building a stronger type system on top of PHP That’s the goal of this book

What You’ll Learn
Discover the fundamentals of PHP strings, regex, underscores, native function inconsistencies, and more
Examine the structure of PHP types including boxing, regex, namespace functions, composer autoload, null problem, optional values, and more
Work with extensions like vagrant + phansible, provisioning, vagrant commands, SPL types, scalar objects, zephir, and more
Design using scalar, SPL, zephir, structure types, resolving types, chaining, combining number types, PHPUnit, packaging, and more
Plan for the future using a case study example

Who is this book for
This book is for experienced web developers and PHP programmers