Recently we presented on WordCamp Thessaloniki how we can use WordPress as a Framework. In this presentation you can find some nice ideas on what is a Framework, how WordPress can be used as one and how we can start building custom apps using WordPress. Enjoy!
Recently we presented on WordCamp Thessaloniki how we can use WordPress as a Framework. In this presentation you can find some nice ideas on what is a Framework, how WordPress can be used as one and how we can start building custom apps using WordPress. Enjoy!
HTML5 or Android for Mobile Development?Reto Meier
Android apps or the mobile web? It's often a hard choice when deciding where to invest your mobile development resources. While the mobile web continues to grow, apps and app stores are incredibly popular. We will present both perspectives and offer some suggestions for making the most of each platform.
Adding another piece of free information in the form of PDF allows your users to value your blog higher than usual. It also gives you free offline marketing. Learn how to embed or link your PDF here
source: https://deftpdf.com/blog
In this presentation, Intergen's Mark Delaney (Interactive Designer, Portals and Content) talks about mobile content strategy, context, device experience and gives advice on how to start your journey on creating a responsive website.
Learn Bootstrap 4 Step by Step for Beginners
This Bootstrap tutorial pdf and training material will teach you how to quickly prototype and build responsive websites using Bootstrap 4. You will become familiar with common components, setting up a grid, and how to customize the look and feel. Get your copy at https://bootstrapcreative.com/shop/bootstrap-quick-start/
Android is fast becoming one of the biggest platforms for programmers today. There is a huge demand for skilled Android Developers all over the world. Most businesses across multiple domains are building Android Apps both for enterprise and retail products. Whether you are student or in the IT industry, possessing Android Development skills will help you take the next big leap in your career.
This session is about how to get started with mobile development. Most developers are used to build software for desktop. Regardless of the technology you pick up for building mobile apps there are some tips and tricks that can help smooth your path.
Kirtesh Khandelwal,Project on HTML and CSS ,Final Year BCA , Dezyne E'cole Co...dezyneecole
Student of Dezyne E'cole College ,doing his Degree Programme in Bachelors Degree in Computer Application. .Along with the Degree programme the student is also updating his industry required skills of IT through the regular work sessions taken during the 365 days of study at college. .This is a work showcase of the work of this student after Two year of his study of Bachelors Degree in Computer Application.
www.dezyneecole.com
With the commercialization of the web, web development has become one of the blooming industries. Learning web development enables you to create attractive websites using HTML, CSS, JQuery and JavaScript. Web development includes developing simple and complex web-based applications, electronic businesses and social networking sites. Being a web developer you can deliver applications as web services which is only available in desktop applications.
HTML5 or Android for Mobile Development?Reto Meier
Android apps or the mobile web? It's often a hard choice when deciding where to invest your mobile development resources. While the mobile web continues to grow, apps and app stores are incredibly popular. We will present both perspectives and offer some suggestions for making the most of each platform.
Adding another piece of free information in the form of PDF allows your users to value your blog higher than usual. It also gives you free offline marketing. Learn how to embed or link your PDF here
source: https://deftpdf.com/blog
In this presentation, Intergen's Mark Delaney (Interactive Designer, Portals and Content) talks about mobile content strategy, context, device experience and gives advice on how to start your journey on creating a responsive website.
Learn Bootstrap 4 Step by Step for Beginners
This Bootstrap tutorial pdf and training material will teach you how to quickly prototype and build responsive websites using Bootstrap 4. You will become familiar with common components, setting up a grid, and how to customize the look and feel. Get your copy at https://bootstrapcreative.com/shop/bootstrap-quick-start/
Android is fast becoming one of the biggest platforms for programmers today. There is a huge demand for skilled Android Developers all over the world. Most businesses across multiple domains are building Android Apps both for enterprise and retail products. Whether you are student or in the IT industry, possessing Android Development skills will help you take the next big leap in your career.
This session is about how to get started with mobile development. Most developers are used to build software for desktop. Regardless of the technology you pick up for building mobile apps there are some tips and tricks that can help smooth your path.
Kirtesh Khandelwal,Project on HTML and CSS ,Final Year BCA , Dezyne E'cole Co...dezyneecole
Student of Dezyne E'cole College ,doing his Degree Programme in Bachelors Degree in Computer Application. .Along with the Degree programme the student is also updating his industry required skills of IT through the regular work sessions taken during the 365 days of study at college. .This is a work showcase of the work of this student after Two year of his study of Bachelors Degree in Computer Application.
www.dezyneecole.com
With the commercialization of the web, web development has become one of the blooming industries. Learning web development enables you to create attractive websites using HTML, CSS, JQuery and JavaScript. Web development includes developing simple and complex web-based applications, electronic businesses and social networking sites. Being a web developer you can deliver applications as web services which is only available in desktop applications.
Slides from my talk at the GTA-PHP Meetup Group about getting mixed HTML / PHP code into objects using SOLID principles.
Meetup page: http://www.meetup.com/GTA-PHP-User-Group-Toronto/events/230656470/
Code is on github: https://github.com/zymsys/solid
L5 SOLID - Five agile principles that should guide you every time you write code
Part:1. Laravel 5 NEW things - quick review
Part: 2. SOLID
- - -
S - Single Responsibility (SRP)
O - Open/Close
L - Liskov's Substitution
I - Interface Segregation
D - Dependency Inversion
This course provides a detailed introduction to the Object Oriented techniques identified by Robert Martin as the SOLID principles of software design. Intended for both novice and intermediary developers, each of the five principles are fully defined and explored. Real-world coding examples are provided for each software tenant to help fully expound upon the design techniques. By the end of the session, developers will be able to identify common code smells while applying SOLID programming practices that ensure clean and maintainable code.
Building Drupal sites mobile first with lazy loading, responsive media and Varnish - without driving anyone insane.
A combined session, technical overview, and outlined solution.
Includes the notes from the workshop at the end.
Ways to Hire iOS Programmer for Your Company in 2023.pptxSemaphoreSoftware1
Based on this fact, we can determine that custom iOS app development has the potential to target the right audience and generate better ROI for the business.
But, do you know how to develop an iOS app? What tools does it take to accomplish and how much does it cost to develop an iOS app?
In this guide, we have given insights on best ways to Hire iOS Programmers in 2023, what factors to consider while hiring best iOS Programmers, and how much does it cost.
https://www.semaphore-software.com/hire-ios-developers/
If you are looking to hire a Node.JS developer, then you need to ask the right questions in order to identify the best
candidate for the job. In this blog post, we will discuss ten job interview questions for hiring Node.JS developers.
To know more visit at : https://www.thinktanker.io/blog/10-job-interview-questions-for-hiring-nodejs-developers.html
React Native App Development in 2023-Tips to Practice.pdfTechugo
Cross-platform development is not a new trend. However, it is a necessity in modern app development. React Native, a cross-platform tool, allows you to create mobile apps for Android and IOS at the same time. The framework should be familiar to developers.
NodeJS is a cross-platform open-source framework. It is used for developing real-time and scalable network applications based on JavaScript. It was released in 2009. Since 2012, many companies have utilized node development to create a variety of helpful apps.
NodeJS employs a single-threaded paradigm with event looping. It is capable of server-side programming, which is essential in the current circumstance. Its event-driven features and open-source functionality are the reasons why developers choose NodeJS.
A ridiculously long presentation from IBM Connect 2013, formerly Lotusphere, from Rob Novak @IBMRockStar and Jerald Mahurin @SociallyCurious on the tools, language, and methods we used to transition from Domino, Quickr and overall web developers to becoming IBM Connections 4.0 developers. From the abstract:
With IBM Connections 4.0, IBM has released the most important new platform - yes platform - for social business development since the Notes client. As a Domino developer, you have excelled. Now, faced with an entire new glossary of terms, new concepts in customization and development, and a whole new set of tools, it could take some time to get up to speed. This session will help you cut weeks off that ramp-up time by showing you exactly what a Connections development environment looks like. We'll cover how to choose your tools and toolkits as well as configuration for development and testing. From the fundamentals of skill gap identification to real working samples, this session is sure to give you a huge head start.
2015.01.09 - Writing Modern Applications for Mobile and WebMarco Parenzan
Traditional programming is quite old (60+ years)
Object Oriented Programming is not so old, but old enough (35+ years)
We can say that OOP is able to satisfy our needs of Modern programming
Modern is not about modern programming principles and paradigms
Modern is about current scenarios in which our programming abilities have to be spent these days
Just 10 years ago (in 2K years) we were focusing on something else
Modern Programming for about modern programming challenges:
- Cloud
- Big Data
- Mobile and Devices
- Internet of Things
Principles
- Application Lifecycle Management
- Scrum
- Maintainable Code
Imperative Modeling
- Don’t tell what you want to do: just do it!
Responsibility Modeling
- Why are you coding? Which is the intention inside every line you write?
Functional Modeling
- Declare what you need! I’ll implement it!
Object Modeling
- Classes are the way to describe model into a domain
Contract Modeling
- Class is not just encapsulation. It’s also declaration of a contract
Interface Modeling
- Class should be implementation only. Interfaces are a better way to describe a contract
Three tier Modeling
- An Architectural model for an application
“Blueprints” Modeling
- Feel free to express yourself…or not? Please refer to some work done by experts!
“No more One” Modeling
- One model DOES NOT FITS for all. Multiple models are needed to single aspects of an application
9 reasons why programmers should learn react nativeReact Sharing
A React Native app is a real mobile app
With React Native, you don't build a “mobile web app”, an “HTML5 app”, or a “hybrid app”. You build a real mobile app that's indistinguishable from an app built using Objective-C or Java. React Native uses the same fundamental UI building blocks as regular iOS and Android apps. You just put those building blocks together using JavaScript and React.
The presentation discusses software design. It discusses the characteristics of a good and bad design. Then it talks about how to achieve a good design. Then finally we discuss the SOLID Principles of Object Oriented Design. These are 5 principles compiled by Rober Cecil Martin aka Uncle Bob. The benefit of these principles is to achieve a good OO design which is high in cohesion and low in coupling thus easily adaptable to change
Elevating Tactical DDD Patterns Through Object CalisthenicsDorra BARTAGUIZ
After immersing yourself in the blue book and its red counterpart, attending DDD-focused conferences, and applying tactical patterns, you're left with a crucial question: How do I ensure my design is effective? Tactical patterns within Domain-Driven Design (DDD) serve as guiding principles for creating clear and manageable domain models. However, achieving success with these patterns requires additional guidance. Interestingly, we've observed that a set of constraints initially designed for training purposes remarkably aligns with effective pattern implementation, offering a more ‘mechanical’ approach. Let's explore together how Object Calisthenics can elevate the design of your tactical DDD patterns, offering concrete help for those venturing into DDD for the first time!
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™UiPathCommunity
In questo evento online gratuito, organizzato dalla Community Italiana di UiPath, potrai esplorare le nuove funzionalità di Autopilot, il tool che integra l'Intelligenza Artificiale nei processi di sviluppo e utilizzo delle Automazioni.
📕 Vedremo insieme alcuni esempi dell'utilizzo di Autopilot in diversi tool della Suite UiPath:
Autopilot per Studio Web
Autopilot per Studio
Autopilot per Apps
Clipboard AI
GenAI applicata alla Document Understanding
👨🏫👨💻 Speakers:
Stefano Negro, UiPath MVPx3, RPA Tech Lead @ BSP Consultant
Flavio Martinelli, UiPath MVP 2023, Technical Account Manager @UiPath
Andrei Tasca, RPA Solutions Team Lead @NTT Data
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
The Metaverse and AI: how can decision-makers harness the Metaverse for their...Jen Stirrup
The Metaverse is popularized in science fiction, and now it is becoming closer to being a part of our daily lives through the use of social media and shopping companies. How can businesses survive in a world where Artificial Intelligence is becoming the present as well as the future of technology, and how does the Metaverse fit into business strategy when futurist ideas are developing into reality at accelerated rates? How do we do this when our data isn't up to scratch? How can we move towards success with our data so we are set up for the Metaverse when it arrives?
How can you help your company evolve, adapt, and succeed using Artificial Intelligence and the Metaverse to stay ahead of the competition? What are the potential issues, complications, and benefits that these technologies could bring to us and our organizations? In this session, Jen Stirrup will explain how to start thinking about these technologies as an organisation.
Securing your Kubernetes cluster_ a step-by-step guide to success !KatiaHIMEUR1
Today, after several years of existence, an extremely active community and an ultra-dynamic ecosystem, Kubernetes has established itself as the de facto standard in container orchestration. Thanks to a wide range of managed services, it has never been so easy to set up a ready-to-use Kubernetes cluster.
However, this ease of use means that the subject of security in Kubernetes is often left for later, or even neglected. This exposes companies to significant risks.
In this talk, I'll show you step-by-step how to secure your Kubernetes cluster for greater peace of mind and reliability.
A tale of scale & speed: How the US Navy is enabling software delivery from l...sonjaschweigert1
Rapid and secure feature delivery is a goal across every application team and every branch of the DoD. The Navy’s DevSecOps platform, Party Barge, has achieved:
- Reduction in onboarding time from 5 weeks to 1 day
- Improved developer experience and productivity through actionable findings and reduction of false positives
- Maintenance of superior security standards and inherent policy enforcement with Authorization to Operate (ATO)
Development teams can ship efficiently and ensure applications are cyber ready for Navy Authorizing Officials (AOs). In this webinar, Sigma Defense and Anchore will give attendees a look behind the scenes and demo secure pipeline automation and security artifacts that speed up application ATO and time to production.
We will cover:
- How to remove silos in DevSecOps
- How to build efficient development pipeline roles and component templates
- How to deliver security artifacts that matter for ATO’s (SBOMs, vulnerability reports, and policy evidence)
- How to streamline operations with automated policy checks on container images
Epistemic Interaction - tuning interfaces to provide information for AI supportAlan Dix
Paper presented at SYNERGY workshop at AVI 2024, Genoa, Italy. 3rd June 2024
https://alandix.com/academic/papers/synergy2024-epistemic/
As machine learning integrates deeper into human-computer interactions, the concept of epistemic interaction emerges, aiming to refine these interactions to enhance system adaptability. This approach encourages minor, intentional adjustments in user behaviour to enrich the data available for system learning. This paper introduces epistemic interaction within the context of human-system communication, illustrating how deliberate interaction design can improve system understanding and adaptation. Through concrete examples, we demonstrate the potential of epistemic interaction to significantly advance human-computer interaction by leveraging intuitive human communication strategies to inform system design and functionality, offering a novel pathway for enriching user-system engagements.
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
Climate Impact of Software Testing at Nordic Testing DaysKari Kakkonen
My slides at Nordic Testing Days 6.6.2024
Climate impact / sustainability of software testing discussed on the talk. ICT and testing must carry their part of global responsibility to help with the climat warming. We can minimize the carbon footprint but we can also have a carbon handprint, a positive impact on the climate. Quality characteristics can be added with sustainability, and then measured continuously. Test environments can be used less, and in smaller scale and on demand. Test techniques can be used in optimizing or minimizing number of tests. Test automation can be used to speed up testing.
Essentials of Automations: The Art of Triggers and Actions in FMESafe Software
In this second installment of our Essentials of Automations webinar series, we’ll explore the landscape of triggers and actions, guiding you through the nuances of authoring and adapting workspaces for seamless automations. Gain an understanding of the full spectrum of triggers and actions available in FME, empowering you to enhance your workspaces for efficient automation.
We’ll kick things off by showcasing the most commonly used event-based triggers, introducing you to various automation workflows like manual triggers, schedules, directory watchers, and more. Plus, see how these elements play out in real scenarios.
Whether you’re tweaking your current setup or building from the ground up, this session will arm you with the tools and insights needed to transform your FME usage into a powerhouse of productivity. Join us to discover effective strategies that simplify complex processes, enhancing your productivity and transforming your data management practices with FME. Let’s turn complexity into clarity and make your workspaces work wonders!
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfPaige Cruz
Monitoring and observability aren’t traditionally found in software curriculums and many of us cobble this knowledge together from whatever vendor or ecosystem we were first introduced to and whatever is a part of your current company’s observability stack.
While the dev and ops silo continues to crumble….many organizations still relegate monitoring & observability as the purview of ops, infra and SRE teams. This is a mistake - achieving a highly observable system requires collaboration up and down the stack.
I, a former op, would like to extend an invitation to all application developers to join the observability party will share these foundational concepts to build on:
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Developing solid applications
1.
2. Developing SOLID Applications by Brandon Savage
Table of Contents
The practice of object oriented design ....................................................................................... 3
So, what is SOLID? .................................................................................................................... 5
Why does this matter, anyway? ................................................................................................. 6
S - The Single Responsibility Principle ....................................................................................... 8
The definition of a “responsibility” .......................................................................................................9
One class, one job. .............................................................................................................................. 12
An example from PHP core.................................................................................................................. 12
O – The Open/Closed Principle .................................................................................................16
The polymorphic open/closed principle .............................................................................................. 17
Interfaces in PHP ................................................................................................................................ 18
An interface example .......................................................................................................................... 19
L - Liskov substitution principle ................................................................................................20
Effective code comments .................................................................................................................... 21
Type hints and PHP ............................................................................................................................. 22
I – Interface Segregation .........................................................................................................23
Too many methods.............................................................................................................................. 24
1
3. Developing SOLID Applications by Brandon Savage
Unnecessary methods in an interface ................................................................................................. 25
D – Dependency Inversion ........................................................................................................26
Dependency injection made easy ........................................................................................................ 27
If I’m supposed to inject dependencies, where do I instantiate objects? ............................................ 28
The model – where dependencies are injected ....................................................................................... 28
The controller – where we create objects .............................................................................................. 29
The view – display logic only! .............................................................................................................. 30
Dependency injection makes unit testing possible .............................................................................. 30
2
4. Developing SOLID Applications by Brandon Savage
The practice of object
oriented design
In the very beginning of software development,
programming langauges were simple: developers wrote in
languages like Assembly, and then moved onto more
advanced (for the time) languages like C. There was no
such thing as “object oriented development”, nor was
there really a need in the early seventies.
But as programming became more complex, the memory
in computers became larger and the need to express ideas
developed further, the concept of object oriented
programming was born.
Design Patterns was written in 1994, and is by far one of
the most famous object oriented design books in the
The “Gang of Four” was made up of
modern era. More than half a million copies have been
Erich Gamma, Richard Helm, Ralph
sold: a testament to the overwhelming interest by
Johnson and John Vlissides.
programmers in the object oriented development world.
3
5. Developing SOLID Applications by Brandon Savage
Of course, object oriented programming is widespread
If you don’t have “Design Patterns:
today; in fact, unless you’re still writing in low-level
Elements of Reusable Object-Oriented
languages like C and Assembly, object oriented
Software”, pick up a copy now.
development is probably going to be the stuff you do on a
Really, go here now:
regular basis.
http://amzn.to/13UeZem. I’ll wait.
The problem is that object oriented programming is hard.
It’s not hard from a syntax point of view, but from a
theoretical point of view. To complicate matters, many of
us in the PHP world don’t have the “formal” background in
computer science that other developers do; this makes
concepts in object oriented development even harder to
grasp and understand.
But there’s hope: object oriented programming is
something that can be learned, can be taught, and can be
understood even without a classical computer science
education.
This guide focuses on one aspect of the object oriented
development world: a practice known as SOLID. While
4
6. Developing SOLID Applications by Brandon Savage
there are dozens of concepts, acronyms and behaviors in
the object oriented programming world, understanding
and working with SOLID will help you be a better
programmer, and equip you to work within the modern
object oriented development world.
So, what is SOLID?
Great question! Let’s define what SOLID stands for. SOLID
is an acronym that comprises five basic, core principles in
object oriented development:
• The Single Responsibility Principle, which states
that classes and objects should have only one job.
• The Open/Closed Principle, which states that
These formal definitions really suck.
objects should be open to extension, but closed to
But don’t worry: I’ll explain what each
modification.
of these means (and how you can use
• The Liskov Substitution Principle, which states
them to your advantage) shortly.
that objects of the same type should be
interchangeable.
5
7. Developing SOLID Applications by Brandon Savage
• The Interface Segregation Principle, which states
that small, compact interfaces are preferable to
large, God objects.
• The Dependency Inversion Principle, which
states that applications should depend upon
abstractions, not concrete instances of an object.
Many of these principles relate and interact with one
another. What this means for the developer is that as they
grasp certain principles others become easier to
understand as well; also, it means that employing a few of
the principles will make it easier to implement all the
principles later on.
Why does this matter,
anyway?
A lot of times it can seem easier to avoid object oriented
programming, focusing instead on functional programming
6
8. Developing SOLID Applications by Brandon Savage
or just writing classes that do what we need them to do.
But there are several advantages to SOLID development
practices:
• Code is reusable. Reusing code makes it easier to
move on to new projects, especially if you are
careful in how you design your libraries.
• SOLID code is easier to maintain. Because the code
is in pieces and you’ve implemented the strategies
here, you don’t have to have full domain knowledge
to make small improvements in parts of the code
you’re unfamiliar with.
• Object oriented code is easier to test. And the SOLID
principles make testing easy to accomplish through
Did I mention that most employers
the possibility of using mock objects, etc. More on
these days want their employees to
this later.
understand and use SOLID?
• Most frameworks are object oriented in PHP. You’ll
need a good understanding of OO in order to work
That’s right. And when I learned
with them.
object oriented programming it
earned me a $12,000 raise. These
Whatever your reason for developing object oriented
skills are valuable!
7
9. Developing SOLID Applications by Brandon Savage
applications, using the principles in the SOLID arsenal will
improve your code, and strengthen the resulting
applications that you develop.
Let’s dive right in…
S - The Single Responsibility
Principle
Every class should have a single
responsibility, and that
responsibility should be entirely
The first principle in SOLID is the Single Responsibility
encapsulated by that class. All its
Principle. This principle states that each concrete object
services should be narrowly aligned
should have one job, and only one job. Objects with more
with that responsibility.
than one job are discouraged, and should be abstracted.
This seemingly simple principle creates confusion for
many developers, because they overanalyze what
constitutes a job. For example, is validation of inputs a
separate job from assigning those inputs? Let’s take a
look.
8
10. Developing SOLID Applications by Brandon Savage
The definition of a “responsibility”
A responsibility is nothing more than a discrete behavior
or group of behaviors that cannot be separated. For
example, validating data before assigning it in an object is
a single responsibility. A group of validation functions in
the same object are not different responsibilities because
they cannot stand alone.
In contrast, connecting to a database is a different
responsibility from using data that comes out of a
database. This is where many developers struggle: they’ll
include their connection code in the object, when really it
belongs elsewhere.
The Single Responsibility Principle is
really all about abstraction.
Abstraction is the process by which
data and programs are defined with a
representation similar in form to its
meaning (semantics), while hiding
away the implementation details.
Abstraction tries to reduce and factor
out details so that the programmer
can focus on a few concepts at a
time.
9
11. Developing SOLID Applications by Brandon Savage
For example, let’s review the following code snippet:
<?php
class PostTweet
{
protected function connect()
{
return mysql_connect(‘localhost’,
‘user’, ‘pass’);
}
public function postTweet($tweet)
{
$conn = $this->connect();
return $this->processTweet($tweet,
$conn);
}
/...
}
This object has two jobs: (1)
connecting to a database, and (2)
posting a tweet on Twitter.
In this example, we’re doing two jobs in the same object:
connecting to the database, and posting a tweet.
It therefore becomes impossible for us to effectively test
this code, since we can’t effectively mock the database
connection.
10
12. Developing SOLID Applications by Brandon Savage
In addition, if we ever switch databases we’ll have to
come in here and change everything. An abstraction
would allow us to do this more easily.
If we correctly abstract this code in accordance with the
single responsibility principle, it ends up looking like this:
<?php
class PostTweet
{
protected function getConnection()
{
return DatabaseLayer::getConnection();
}
public function postTweet($tweet)
{
$conn = $this->getConnection();
return $this->processTweet($tweet,
$conn);
}
/...
}
This object now has one job: posting
a tweet on Twitter. The connection to
the database is handled elsewhere by
another object.
With the database connection abstracted to another
object, we are more able to test this object, and abstract
different database types (and this could be further
11
13. Developing SOLID Applications by Brandon Savage
improved with dependency injection, which we’ll discuss
later).
One class, one job.
Each object that you create should have a single
responsibility or a single job. When developing your
classes, carefully consider whether or not their
responsibilities are in line with the single responsibility
principle.
In doing this, it’s also important not to over-abstract your
code. Remembering that a “job” is something that is
discrete, stands alone and might be reused elsewhere in
your application will help you understand the difference
between a reasonable abstraction for reuse and an
unreasonably complicated abstraction.
A single responsibility stands alone
and may have reuse potential in your
code.
An example from PHP core
12
14. Developing SOLID Applications by Brandon Savage
The PDO extension is a great representation of the single
responsibility principle at work. Let’s take a look at the
interface of this class:
PDO {
public __construct ( string $dsn [, string
$username [, string $password [, array
$driver_options ]]] )
public bool beginTransaction ( void )
public bool commit ( void )
public mixed errorCode ( void )
public array errorInfo ( void )
public int exec ( string $statement )
public mixed getAttribute ( int $attribute )
public static array getAvailableDrivers ( void )
public bool inTransaction ( void )
public string lastInsertId ([ string $name = NULL
] )
public PDOStatement prepare ( string $statement
[, array $driver_options = array() ] )
public PDOStatement query ( string $statement )
public string quote ( string $string [, int
$parameter_type = PDO::PARAM_STR ] )
public bool rollBack ( void )
public bool setAttribute ( int $attribute , mixed
$value )
}
This documentation si straight from
the online PHP manual; it’s pseudo
code.
This is the interface documentation for the PDO object;
the PDO object is the starting point for PDO connections to
13
15. Developing SOLID Applications by Brandon Savage
a database. In this documentation, se can see that the
PDO object has essentially one job: to connect to the
database and manage that connection.
The PDO object also is responsible for preparing SQL
queries but it is not responsible for executing them.
Instead, it returns a PDOStatement object. The reason the
PDO object is responsible for preparing SQL queries is
because this is a crucial component of the connection
object.
The connection object is responsible
There are also convenience methods for beginning and
for preparing the statement because
managing transactions, as well as a method for executing
it is based on the encoding of the
simple queries.
database.
The PDOStatement object is chiefly responsible for
Also, transaction management
managing the query process for individual queries to the
happens at the connection level, not
database, including returning a result to the application:
the query level (since multiple queries
can take place inside a single
PDOStatement implements Traversable {
transaction).
/* Properties */
14
16. Developing SOLID Applications by Brandon Savage
readonly string $queryString;
/* Methods */
public bool bindColumn ( mixed $column ,
mixed &$param [, int $type [, int $maxlen [,
mixed $driverdata ]]] )
public bool bindParam ( mixed $parameter ,
mixed &$variable [, int $data_type =
PDO::PARAM_STR [, int $length [, mixed
$driver_options ]]] )
public bool bindValue ( mixed $parameter ,
mixed $value [, int $data_type = PDO::PARAM_STR ]
)
public bool closeCursor ( void )
public int columnCount ( void )
public void debugDumpParams ( void )
public string errorCode ( void )
public array errorInfo ( void )
public bool execute ([ array
$input_parameters ] )
public mixed fetch ([ int $fetch_style [, int
$cursor_orientation = PDO::FETCH_ORI_NEXT [, int
$cursor_offset = 0 ]]] )
public array fetchAll ([ int $fetch_style [,
mixed $fetch_argument [, array $ctor_args =
array() ]]] )
public string fetchColumn ([ int
$column_number = 0 ] )
public mixed fetchObject ([ string
$class_name = "stdClass" [, array $ctor_args ]] )
public mixed getAttribute ( int $attribute )
public array getColumnMeta ( int $column )
15
17. Developing SOLID Applications by Brandon Savage
public bool nextRowset ( void )
public int rowCount ( void )
public bool setAttribute ( int $attribute ,
mixed $value )
public bool setFetchMode ( int $mode )
}
It’s easy to see here the division of responsibility between
the PDO object and the PDOStatement object. They have
very different responsibilities, and yet they work together
to provide a seamless and comprehensive access point to
the database.
O – The Open/Closed
Principle
Many develoeprs have an inherent understanding of the
single responsibility principle: after all, they use it every
time they write discrete functions. In fact, single
Objects should be open for extension
but closed for modification.
responsibility is probably the easiest of the five concepts
to grasp.
16
18. Developing SOLID Applications by Brandon Savage
And then, we get to the Open/Closed Principle and
developers go “huh?” and wander off, never to be seen
again.
Let’s keep that from happening here, shall we?
The polymorphic open/closed principle
One of the methodologies for the open/closed principle is
the polymorphic open/closed principle.
Polymorphism is a big long word for a very simple
concept: same behavior, different methodologies. For
example, take spiders: they all look different and they
may catch prey in different ways, but they all act in very
similar manners. They are polymorphic.
In nature, polymorphism means the
natural occurrence of a thing in
different forms.
In computer science, it means that an
object works in different ways, but
implements a common interface or
behavior.
What does this mean for object oriented programming in
PHP? It means making use of solidified and defined
interfaces for creating objects where those objects have
17
19. Developing SOLID Applications by Brandon Savage
similar behaviors but different internals.
Interfaces in PHP
PHP natively supports the creation of interfaces. These
items provide a public API for use by the classes that
implement them and are of the type that is defined by the
interface (e.g. an interface of type MyInterface will
provide that same type to all objects that implement it).
PHP’s interface methodology is perhaps the most
PHP has a ton of documentation on
interfaces at http://bit.ly/4nYL7n
misunderstood bit in the PHP object model. Interfaces are
seen as not useful because they can’t contain any code; in
fact, they are not useless, they are most useful for this
reason.
An interface provides a shell, a framework of sorts for an
object. The internals are entirely available for
implementation based on your specific needs or desires.
The interface gives the developer maximum flexibility in
developing an object while still having a standard interface
18
20. Developing SOLID Applications by Brandon Savage
that can be used in other objects, allowing developers the
best of both worlds.
An interface example
Below is an example of an interface that might be defined
for a caching library:
<?php
interface CachingI {
Wondering about the difference
public function get($key);
between interfaces and abstract
public function set($key, $value);
classes?
public function delete($key);
// Purge the whole cache
public function purge();
}
Note that this interface allows the developer to implement
a whole host of different cache types, from a Memcache
cache to an APC cache. But because the interface is
consistent, the objects that implement this interface are
An interface defines none of the
internals; it provides a public API
only.
An abstract class provides a public
interface and defines some of the
internals of an object.
19
21. Developing SOLID Applications by Brandon Savage
effectively interchangeable in the application.
L - Liskov substitution
principle
The Liskov substitution principle
states that objects in a program
should be replaceable with instances
Interfaces allow us to create objects that are polymorphic
of their subtypes without altering the
because we can implement the same inputs for all the
correctness of that program.
objects of a particular type. But what about outputs?
E.g. if A is a type of D, then A can
Our outputs are not controlled, and in fact in PHP there is
replace instances of D.
no standard way to say “you’ll get this kind of output from
this method” and enforce that in code.
That’s why the Liskov substitution principle is important.
It states that we should be able to swap objects of the
same type without altering the correctness of the
program. This means the outputs must be as predictable
as the inputs.
20
22. Developing SOLID Applications by Brandon Savage
In PHP, this means two things: effective code comments,
combined with type hints that tell us what objects to
expect.
Effective code comments
It’s generally become accepted in the PHP world to
comment methods and functions with both expected input
parameters and expected output parameters. It is crucial
that to employ this principle, developers use this
technique (which is often interpreted by IDEs and other
code documentation components).
This is a crucial part of design by
contract, which states that
developers should establish
expectations for their objects through
specific interfaces.
The most effective way is with the docblock style
comment:
/**
* Get a random element from an array based on
* weighted array values.
* @param array $array array of val => weight
*
pairings
* @param int $sum total of added weightings
* @return bool value of randomly selected
* element
*/
PEAR has a great set of coding
standards for this. Check them out at
http://bit.ly/c7vAEO
21
23. Developing SOLID Applications by Brandon Savage
By documenting in this way, the expected inputs and the
expected outputs are established beforehand, avoiding
confusion.
Type hints and PHP
The second way we can enforce this principle is by using
type hints which indicate to developers which objects a
program expects (and also forces developers to use these
objects).
Type hints in PHP allow us to anticipate the API, and when
used in conjunction with comments like the ones
The PHP manual has tons of
documentation on how type hinting
works, including on how to type hint
arrays; check it out at
http://bit.ly/a4uQ0N
described above, give us the opportunity to fully honor the
Liskov substitution principle.
Type hinting in PHP is easy. For example:
function myFunction(myObject $object) {
// …
}
In PHP 5.4, you can use the “callable”
The myObject type hint tells PHP that an object of type
implementing __invoke() are
type hint to specify that objects
provided, regardless of specific type.
22
24. Developing SOLID Applications by Brandon Savage
myObject must be passed into this function definition. If
this is not provided, PHP will raise a fatal error until the
developer corrects the problem.
I – Interface Segregation
When first approaching object oriented programming, its
common for developers to start thinking about objects as
The interface segregation principle
groups of functions, and grouping similar functions
states that no object should be forced
together (or grouping all their functions together in a
to depend upon or implement
single class).
methods that it doesn’t use.
These large, “god” objects make refactoring and testing a
This principle exists to make
nightmare. This is why there exists a principle of
refactoring easier.
“interface segregation”, which specifies that interfaces
should be as small as necessary and that objects shouldn’t
rely on methods they don’t use or need.
23
25. Developing SOLID Applications by Brandon Savage
Too many methods
Too often, developers use too many methods when they
are developing their applications. A good rule of thumb is
that more than five to seven methods indicates a refactor
is necessary.
Rule of thumb: more than 5-7
methods indicates a refactor.
This isn’t always true, but many times it is. Having more
than five to seven public methods means that your object
has a lot of responsibility; it is probably an object that has
more than one job, and that is something that violates the
Single Responsibility Principle, too.
Just because you refactor a single object into a few
smaller objects doesn’t mean they can’t work together or
communicate; they can in fact form a library, and you can
have a mediator object that handles the interfaces
between them.
24
26. Developing SOLID Applications by Brandon Savage
Unnecessary methods in an interface
Another common mistake that I see pretty frequently is
the inclusion of unnecessary methods in an object
interface.
What this means is that developers will include methods
Rule of thumb: if you’re defining
empty methods in a concrete class to
satisfy an interface, refactor.
that apply to some objects, but not all objects of the same
type. And then, because the methods are defined in the
interface, they must also be defined in the concrete
object, but are left blank or empty.
PHP allows the implementation of multiple interfaces in a
single object, so it’s still possible to require all the
methods you need but allow objects that don’t need them
to not implement them.
For example:
25
27. Developing SOLID Applications by Brandon Savage
class myClass implements myInterfaceA,
myInterfaceB {
// ...
}
PHP will automatically require that all the methods in
myInterfaceA and myInterfaceB are included and defined.
Meanwhile, you can drop myInterfaceB for objects that
don’t require that specific type.
Another possible solution to this issue is to include traits.
Traits do not change the type of the object (so you cannot
type hint on a trait), but they do provide additional
methods (and those methods can be defined. For more,
see the documentation on traits (available in PHP 5.4)
here.
D – Dependency Inversion
It seems the inventors of SOLID saved the hardest
principle for last. The concept of dependency inversion has
been frustrating developers ever since it was coined (and
26
28. Developing SOLID Applications by Brandon Savage
probably before they had a way to describe it).
Objects should depend upon
There are many different ways to practice dependency
abstractions, not concrete methods.
inversion. Two methods have risen to the top of that pack,
and of those we will discuss the one that applies best to
Which is a really complicated way of
PHP development: dependency injection.
saying “don’t type hint for concrete
objects; type hint for abstractions or
Dependency injection made easy
interfaces.”
Dependency injection is not as hard as the name makes it
sound, or as many blog posts do too. Dependency
injection is something that every developer is already
familiar with, in fact: we do it all the time with function
definitions.
Every argument that is passed into a function is a
dependency. But in the context of object oriented
development and software design, dependencies are other
objects that our object expects and relies upon.
27
29. Developing SOLID Applications by Brandon Savage
When we type hint, we are expecting that a dependency
will be injected into the method or object we’re using. This
object will be acted upon. The type hint guarantees us
Don’t need a specific concrete object?
that the API will be consistent, and allows us to rely upon
Type hint on the interface or abstract
an abstraction of the object.
class.
If I’m supposed to inject dependencies,
where do I instantiate objects?
Many developers struggle with object oriented design in
PHP because we have to create objects somewhere. When
using dependency injection, there’s a fairly common
structure for applications: model, view, controller or MVC.
Most modern frameworks in PHP are
model-view-controller in some way or
The m odel – where dependencies are
another.
injected
Many developers link models with a single table and leave
it at that. But models are far more complex.
28
30. Developing SOLID Applications by Brandon Savage
Models encapsulate the business logic of your application.
They interface with the data storage layer, validate inputs,
handle the creation of new objects and new data, and
return data to the controller (which is ultimately returned
to the view).
Because the business and validation logic lives in the
model, this is where dependency injection really shines.
Objects (other than value objects which represent specific
The model is for business logic.
components of the application) should never be
instantiated here. They should be injected as
dependencies.
The controller – where we create objects
Controllers are usually where people think they should put
their business logic, but controllers should actually be very
small and control only the flow of a program based on
The controller is for control and
predetermined inputs.
program flow logic.
The controller is a great place to instantiate objects.
29
31. Developing SOLID Applications by Brandon Savage
Because instantiating objects here makes this layer
difficult (if not impossible) to test, we focus on putting as
little code as possible in the controller.
Well designed controllers will closely resemble the unit
tests, because they will contain only the code minimally
necessary to interface with the model and view layers.
The view – display logic only!
There should be no validation, business or control logic in
the view. The view is for display only. No object
The view is for display logic. No
instantiation, no manipulation of data (beyond
phone number formatting in the
manipulating it for display purposes). The view is pretty
model – that goes here!
much static.
Dependency injection makes unit testing
possible
With dependency injection, it’s possible to create mock
30
32. Developing SOLID Applications by Brandon Savage
objects (either with a library or by hand) and write true
unit tests on your model units. Without dependency
Not writing tests? You’re missing out
injection, this becomes much more difficult (if not
on an easy way to validate your work!
impossible). Instead, you resort to functional tests.
Write a test today.
Unit tests are a crucial part of object oriented
development. For more details on how you can write
testable applications, see The Grumpy Programmer’s
Guide To Building Testable Applications; for more on using Get both of these great books for $40
PHPUnit see The Grumpy Programmer's PHPUnit
by visiting http://bit.ly/1biePCT (and
Cookbook.
I highyl recommend them!)
31
33. Want to learn more?
Write better object oriented PHP today!
Object oriented programming always leaves you with a headache.
What if you could master it instead? Stop struggling with object
oriented PHP. Mastering Object Oriented PHP is the answer!
Use coupon code SOLIDGUIDE to get 10% off now!
Visit http://masteringobjectorientedphp.com/ today!
Take your career to the next level!
A unique, two week class that will take your object oriented skills from mediocre to master.
Hands on instruction that will give you not only the theoretical parts of OO PHP, but the
practical applications as well!
NOW ACCEPTING APPLICATIONS for September 2013. Apply now at
http://www.objectorientedphpmasterclass.com