Presentation made at GTA meetup in 2012-02-07.
Object Calisthenics is a set of exercise rules to reach better code, maintainable, testable and readable.
Performance and testing are just one aspect of code, to really be successful your code needs to be readable, maintainable and generally easier to comprehend and work with. This talk draws from my own experience in applying the techniques of object calisthenics and code readability, within an existing team. It will help you identify trouble areas, learn how to refactor them and train you to write better code in future projects avoiding common pitfalls.
PHP unserialization vulnerabilities: What are we missing?Sam Thomas
Video at: https://www.youtube.com/watch?v=PqsudKzs79c
An introduction to PHP unserialization vulnerabilities, with some practical tips on methodology. Based around three new exploits for old vulnerabilities (CVE-2011-4962, CVE-2013-1453, CVE-2013-4338).
Performance and testing are just one aspect of code, to really be successful your code needs to be readable, maintainable and generally easier to comprehend and work with. This talk draws from my own experience in applying the techniques of object calisthenics and code readability, within an existing team. It will help you identify trouble areas, learn how to refactor them and train you to write better code in future projects avoiding common pitfalls.
PHP unserialization vulnerabilities: What are we missing?Sam Thomas
Video at: https://www.youtube.com/watch?v=PqsudKzs79c
An introduction to PHP unserialization vulnerabilities, with some practical tips on methodology. Based around three new exploits for old vulnerabilities (CVE-2011-4962, CVE-2013-1453, CVE-2013-4338).
These are the slides of my "Fake it Outside-In TDD" session at the #XP2017 conference. Do not miss to check out the referenced screencasts that illustrate the approach very well: https://www.youtube.com/playlist?list=PL_ueet93U84VIy8O7U4dUV0GyGvuzFAt8
Most of us use Design Patterns on a daily basis without noticing. Design patterns are commonly defined as solutions to recurring design problems. Frameworks like Laravel use Design Patterns throughout the codebase to keep structure and maintainability. In this talk we will explore the Design Patterns used in Laravel.
Introduction, Technologies included in ajax,
Ajax Evolution,
Pro’s and Con’s,
Beginners Problem?,
Types and choices of request,
Ajax on hands (Example),
Global Ajax Event Handlers,
Helper Functions,
Low Level interface,
Shorthand Methods for Ajax request.
Kotlin Bytecode Generation and Runtime Performanceintelliyole
In this talk, we'll dive into the details of how various language features supported by Kotlin are translated to Java bytecode. We'll use the JMH microbenchmarking tool to study the relative performance of various constructs and to understand how we can ensure top performance of the Kotlin code that we write.
"We’ve all seen poorly written code that’s hard to understand, test, and maintain. Object-oriented programming promised to save us from our old procedural code, allowing us to write software incrementally, reusing as we go along. But sometimes it seems like we’re just chasing down the same old complex, coupled designs in Java that we had in C.
Good object-oriented design is hard to learn. Transitioning from procedural development to
object-oriented design requires a major shift in thinking that is more difficult than it seems.
Many developers assume they’re doing a good job with OO design, when in reality they’re
unconsciously stuck in old habits that are hard to break. It doesn’t help that many examples and best practices (even Sun’s code in the JDK) encourage poor OO design in the name of
performance or simple weight of history." -- Jeff Bay
Here are some key rules which are going to improve your OO designing skills and make you a better programmer. Some are harder to implement but will open your mind for new ways of coding. Happy coding! :)
Your code sucks, let's fix it - DPC UnConRafael Dohms
How do you measure the quality of your code? Performance and testing are just one aspect of code, in order to meet deadlines and make maintenance quicker you also need your code to be readable, decoupled and generally easier to comprehend and work with. This talk will go over tips and exercises to help you identify trouble areas, refactor them and train you to write better code in future projects. Come make your code look and function better.
These are the slides of my "Fake it Outside-In TDD" session at the #XP2017 conference. Do not miss to check out the referenced screencasts that illustrate the approach very well: https://www.youtube.com/playlist?list=PL_ueet93U84VIy8O7U4dUV0GyGvuzFAt8
Most of us use Design Patterns on a daily basis without noticing. Design patterns are commonly defined as solutions to recurring design problems. Frameworks like Laravel use Design Patterns throughout the codebase to keep structure and maintainability. In this talk we will explore the Design Patterns used in Laravel.
Introduction, Technologies included in ajax,
Ajax Evolution,
Pro’s and Con’s,
Beginners Problem?,
Types and choices of request,
Ajax on hands (Example),
Global Ajax Event Handlers,
Helper Functions,
Low Level interface,
Shorthand Methods for Ajax request.
Kotlin Bytecode Generation and Runtime Performanceintelliyole
In this talk, we'll dive into the details of how various language features supported by Kotlin are translated to Java bytecode. We'll use the JMH microbenchmarking tool to study the relative performance of various constructs and to understand how we can ensure top performance of the Kotlin code that we write.
"We’ve all seen poorly written code that’s hard to understand, test, and maintain. Object-oriented programming promised to save us from our old procedural code, allowing us to write software incrementally, reusing as we go along. But sometimes it seems like we’re just chasing down the same old complex, coupled designs in Java that we had in C.
Good object-oriented design is hard to learn. Transitioning from procedural development to
object-oriented design requires a major shift in thinking that is more difficult than it seems.
Many developers assume they’re doing a good job with OO design, when in reality they’re
unconsciously stuck in old habits that are hard to break. It doesn’t help that many examples and best practices (even Sun’s code in the JDK) encourage poor OO design in the name of
performance or simple weight of history." -- Jeff Bay
Here are some key rules which are going to improve your OO designing skills and make you a better programmer. Some are harder to implement but will open your mind for new ways of coding. Happy coding! :)
Your code sucks, let's fix it - DPC UnConRafael Dohms
How do you measure the quality of your code? Performance and testing are just one aspect of code, in order to meet deadlines and make maintenance quicker you also need your code to be readable, decoupled and generally easier to comprehend and work with. This talk will go over tips and exercises to help you identify trouble areas, refactor them and train you to write better code in future projects. Come make your code look and function better.
How do you measure the quality of your code? Performance and testing are just one aspect of code, in order to meet deadlines and make maintenance quicker you also need your code to be readable, decoupled and generally easier to comprehend and work with. This talk will go over tips and exercises to help you identify trouble areas, refactor them and train you to write better code in future projects. Come make your code look and function better.
This session introduces most well known design patterns to build PHP classes and objects that need to store and fetch data from a relational databases. The session will describe the difference between of the Active Record, the Table and Row Data Gateway and the Data Mapper pattern. We will also examine some technical advantages and drawbacks of these implementations. This talk will expose some of the best PHP tools, which ease database interactions and are built on top of these patterns.
Adding Dependency Injection to Legacy ApplicationsSam Hennessy
Dependency Injection (DI) is a fantastic technique, but what if you what to use dependency injection in your legacy application. Fear not! As someone who as done this very thing, I will show how you can successful and incrementally add DI to any application. I will present a number of recipes and solutions to common problems and give a tour of the various PHP DI projects and how they can help.
By the sum of PHPUnit assertion power and Symfony2 functional testing tools the developer can obtain a deep control on the developed application.
Here you can find some suggestions on how to leverage that power.
[PHPCon 2023] “Kto to pisał?!... a, to ja.”, czyli sposoby żeby znienawidzić ...Mateusz Zalewski
Czysty kod. Jakościowe oprogramowanie. Dobre praktyki. Święte Graale pracy programisty, o których każdy z nas wie, a mimo to wciąż zachowujemy się tak, jakby ich nie było. Bo przecież ten kod to tylko na chwilę. A tego to w ogóle nie będziemy używać. A tę klasę się zrefaktoruje później. Wszyscy od czasu do czasu zaciągamy dług u samych z siebie z przyszłości - dług, którego potem (nie bez powodu) bardzo nie chcemy spłacać.
Zagłębmy się więc w ten fascynujący świat słabego oprogramowania. Przejdźmy przez las nieużytych wzorców projektowych, przebrnijmy przez bagna zagnieżdżonych pętli. Wejdźmy na kolejny ośmiotysięcznik, a może z jego szczytu uda nam się dojrzeć zatokę pięknego kodu - w której, miejmy nadzieję, tym razem pozostaniemy na dłużej.
Persistence is one of the most important part in a PHP project. Persisting data to a database came with PHP/FI and its MySQL support. From native extensions and PHP4 database abstraction libraries to PDO and modern ORM frameworks, you will (re)discover how persistence has evolved during the last decade. This talk will also introduce the future of data persistence with the growing success of alternative storage engines.
Similar to Object Calisthenics Applied to PHP (20)
Presentation gave at ConFoo 2012 (2012-03-01)
As soon as you decide to use an ORM tool, one of the biggest factors is Rapid Application Development.
Everything is wonderful during development phase, but when it hits production, performance doesn't work like you expect.
You may think it's ORM's fault, your expected it to write as efficient queries as you manually do, but like guns, ORMs don't kill your database, developers do!
This talk will go deep into Doctrine 2 ORM by exploring performance tips that can save your application from its deepest nightmare.
Apresentação ministrada em 27/09/2011 no Tribeca Pub em São Paulo.
Object Calisthenics são exercícios que podem ser praticados com o objetivo de melhor
Apresentação feita no Latinoware 2010 apresentando o conceito de Dependency Injection no PHP 5.3.
Esta palestra é uma tradução e simplificação da palestra Dependency Injection in PHP 5.3 de Fabien Potencier.
Doctrine 2.0 Enterprise Persistence Layer for PHPGuilherme Blanco
One area that was mostly abandoned in applications is the Model layer. Doctrine is a project that brings enterprise support this layer through a powerful ORM implementation.
Allied with new support introduced in PHP 5.3, Doctrine 2.0 brings the concept of ORM in PHP to the next level. It introduces a couple of concepts known from other languages and areas, like Annotations, Object Query Languages and Parsers. This talk will introduce these new concepts as well as explain most of its architecture.
Doctrine é uma ferramenta de ORM (mapeamento objeto-relacional) para
PHP que sobrepõe a poderosa DBAL (camada de abstração de Banco de
Dados) PDO do PHP.
Um de seus principais recursos é a possibilidade adicional de escrever
consultas à base de dados através de um dialeto-SQL OO (orientado à
objeto) chamado DQL inspirado no HQL do Hibernate. Isto provê aos
desenvolvedores uma alternativa poderosa ao SQL que mantém o máximo de
flexibilidade sem qualquer necessidade de duplicação de código.
O tema da palestra é apresentar a ferramenta como uma solução ágil
para problemas recorrentes.
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.
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!
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
Keynote at DIGIT West Expo, Glasgow on 29 May 2024.
Cheryl Hung, ochery.com
Sr Director, Infrastructure Ecosystem, Arm.
The key trends across hardware, cloud and open-source; exploring how these areas are likely to mature and develop over the short and long-term, and then considering how organisations can position themselves to adapt and thrive.
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
91mobiles recently conducted a Smart TV Buyer Insights Survey in which we asked over 3,000 respondents about the TV they own, aspects they look at on a new TV, and their TV buying preferences.
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
JMeter webinar - integration with InfluxDB and GrafanaRTTS
Watch this recorded webinar about real-time monitoring of application performance. See how to integrate Apache JMeter, the open-source leader in performance testing, with InfluxDB, the open-source time-series database, and Grafana, the open-source analytics and visualization application.
In this webinar, we will review the benefits of leveraging InfluxDB and Grafana when executing load tests and demonstrate how these tools are used to visualize performance metrics.
Length: 30 minutes
Session Overview
-------------------------------------------
During this webinar, we will cover the following topics while demonstrating the integrations of JMeter, InfluxDB and Grafana:
- What out-of-the-box solutions are available for real-time monitoring JMeter tests?
- What are the benefits of integrating InfluxDB and Grafana into the load testing stack?
- Which features are provided by Grafana?
- Demonstration of InfluxDB and Grafana using a practice web application
To view the webinar recording, go to:
https://www.rttsweb.com/jmeter-integration-webinar
UiPath Test Automation using UiPath Test Suite series, part 3DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 3. In this session, we will cover desktop automation along with UI automation.
Topics covered:
UI automation Introduction,
UI automation Sample
Desktop automation flow
Pradeep Chinnala, Senior Consultant Automation Developer @WonderBotz and UiPath MVP
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Jeffrey Haguewood
Sidekick Solutions uses Bonterra Impact Management (fka Social Solutions Apricot) and automation solutions to integrate data for business workflows.
We believe integration and automation are essential to user experience and the promise of efficient work through technology. Automation is the critical ingredient to realizing that full vision. We develop integration products and services for Bonterra Case Management software to support the deployment of automations for a variety of use cases.
This video focuses on the notifications, alerts, and approval requests using Slack for Bonterra Impact Management. The solutions covered in this webinar can also be deployed for Microsoft Teams.
Interested in deploying notification automations for Bonterra Impact Management? Contact us at sales@sidekicksolutionsllc.com to discuss next steps.
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Albert Hoitingh
In this session I delve into the encryption technology used in Microsoft 365 and Microsoft Purview. Including the concepts of Customer Key and Double Key Encryption.
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
Essentials of Automations: Optimizing FME Workflows with ParametersSafe Software
Are you looking to streamline your workflows and boost your projects’ efficiency? Do you find yourself searching for ways to add flexibility and control over your FME workflows? If so, you’re in the right place.
Join us for an insightful dive into the world of FME parameters, a critical element in optimizing workflow efficiency. This webinar marks the beginning of our three-part “Essentials of Automation” series. This first webinar is designed to equip you with the knowledge and skills to utilize parameters effectively: enhancing the flexibility, maintainability, and user control of your FME projects.
Here’s what you’ll gain:
- Essentials of FME Parameters: Understand the pivotal role of parameters, including Reader/Writer, Transformer, User, and FME Flow categories. Discover how they are the key to unlocking automation and optimization within your workflows.
- Practical Applications in FME Form: Delve into key user parameter types including choice, connections, and file URLs. Allow users to control how a workflow runs, making your workflows more reusable. Learn to import values and deliver the best user experience for your workflows while enhancing accuracy.
- Optimization Strategies in FME Flow: Explore the creation and strategic deployment of parameters in FME Flow, including the use of deployment and geometry parameters, to maximize workflow efficiency.
- Pro Tips for Success: Gain insights on parameterizing connections and leveraging new features like Conditional Visibility for clarity and simplicity.
We’ll wrap up with a glimpse into future webinars, followed by a Q&A session to address your specific questions surrounding this topic.
Don’t miss this opportunity to elevate your FME expertise and drive your projects to new heights of efficiency.
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.
5. Object Calisthenics
Erm... WTH is Object Calisthenics?
‣ Object Calisthenics
Term derived from greek,
“exercise”, under the
context of gymnastics.
6. Object Calisthenics
Erm... WTH is Object Calisthenics?
‣ Jeff Bay in The ThoughtWorks Anthology [1]
coined the term Object Calisthenics in computers,
as a group of exercises to Object Oriented
programming.
[1] The ThoughtWorks Anthology: Essays on Software Technology and Innovation
7. Object Calisthenics
Motivation
‣ Readable Code
‣ Comprehensible
‣ Testable
‣ Maintainable
Learning about good code practices
at Object CaIisthenics talk of
@guilhermeblanco on @gtaphp
25. Object Calisthenics
Rule 3: Wrap primitive types and strings
‣ This rule cannot be completely ported to PHP, because
the language does not perform well with an entirely
Object Oriented code with a huge amount of instances
26. Object Calisthenics
Rule 3: Wrap primitive types and strings
‣ But... if the variable of primitive type has a behavior, it
must be encapsulated
27. Object Calisthenics
Rule 3: Wrap primitive types and strings
class UIComponent
{
! // ...
!
public function repaint($animate = true)
{
// ...
}
}
// ...
$component->repaint(false);
28. Object Calisthenics
Rule 3: Wrap primitive types and strings
class UIComponent
{
! // ...
!
public function repaint($animate = true)
{
// ...
}
}
// ...
$component->repaint(false);
29. Object Calisthenics
Rule 3: Wrap primitive types and strings
class UIComponent
{
! // ...
!
public function repaint(Animate $animate)
{
// ...
}
}
class Animate
{
public $animate;
public function __construct($animate = true)
{
$this->animate = $animate;
}
}
// ...
$component->repaint(new Animate(false));
32. Object Calisthenics
Rule 4: Only one dot per line
‣ ...but multiple nested calls...
‣ tend to expose an encapsulation problem
‣ increase difficulty to debug and exception handling
‣ do not represent an atomic action
34. Object Calisthenics
Rule 4: Only one dot per line
‣ A chain of different objects, but only if the execution
only includes getters and setters
$user->getLocationPoint()->getCountry()->getName();
35. Object Calisthenics
Rule 4: Only one dot per line
‣ A chain of a unique object, through the usage of a
fluent interface
$filterChain->addFilter(new Zend_Filter_Alpha())
->addFilter(new Zend_Filter_StringToLower());
39. Object Calisthenics
Rule 5: Do not abbreviate
‣ Think about it... why do you want to abbreviate?
‣ Write the same name repeatedly?
40. Object Calisthenics
Rule 5: Do not abbreviate
‣ Think about it... why do you want to abbreviate?
‣ Write the same name repeatedly?
‣ Then your method is reused multiple times,
signalling a code duplication.
41. Object Calisthenics
Rule 5: Do not abbreviate
‣ Think about it... why do you want to abbreviate?
‣ Write the same name repeatedly?
‣ Then your method is reused multiple times,
signalling a code duplication.
‣ Method name too long?
42. Object Calisthenics
Rule 5: Do not abbreviate
‣ Think about it... why do you want to abbreviate?
‣ Write the same name repeatedly?
‣ Then your method is reused multiple times,
signalling a code duplication.
‣ Method name too long?
‣ Maybe your class has multiple responsibilities or it
is missing a helper class (bad architecture).
43. Object Calisthenics
Rule 5: Do not abbreviate
‣ Think about it... why do you want to abbreviate?
‣ Write the same name repeatedly?
‣ Then your method is reused multiple times,
signalling a code duplication.
‣ Method name too long?
‣ Maybe your class has multiple responsibilities or it
is missing a helper class (bad architecture).
46. Object Calisthenics
Rule 6: Keep your entities small
‣ Adapted to PHP: 100 lines per class and no more than
15 classes per package.
‣ The change is necessary because of the lack of rule for
documentation, which can easily occupy up to 50% of
the lines of a class.
47. Object Calisthenics
Rule 7: Do not create classes with more than 2 instance variables
‣ Do not create classes with more than 2 instance
variables
48. Object Calisthenics
Rule 7: Do not create classes with more than 2 instance variables
‣ Objective:
‣ Low cohesion
‣ Better encapsulation
49. Object Calisthenics
Rule 7: Do not create classes with more than 2 instance variables
‣ The original rule points to 2 instance variables
‣ To PHP, the suggestion is no more than 5 variables
51. Object Calisthenics
Rule 8: Use first class collections
‣ The rule is simple: Any class that contains a collection
(array to PHP), cannot contain any other properties
52. Object Calisthenics
Rule 8: Use first class collections
‣ Objectives:
‣ Specific behaviors have a good place to stay
‣ Filtering, combining, mapping, ...
53. Object Calisthenics
Rule 8: Use first class collections
‣ DoctrineCommonCollectionsArrayCollection
‣ Countable
‣ IteratorAggregate (inherits Traversable)
‣ ArrayAccess
54. Object Calisthenics
Rule 9: Do not create getter/setter methods to properties
‣ Do not create getter/setter methods to properties
55. Object Calisthenics
Rule 9: Do not create getter/setter methods to properties
‣ Non-applicable to PHP due to language’s nature
56. Object Calisthenics
Rule 9: Do not create getter/setter methods to properties
/**
* THIS CLASS WAS GENERATED BY THE DOCTRINE ORM. DO NOT EDIT THIS FILE.
*/
class ApplicationCoreDomainUserModelUserProxy
! extends ApplicationCoreDomainUserModelUser
! implements DoctrineORMProxyProxy
{
// ...
public function getId()
{
$this->__load();
return parent::getId();
}
public function setId($id)
{
$this->__load();
return parent::setId($id);
}
// ...
}