This document discusses dependency injection and its benefits. It defines dependencies as components that an application relies on. Hard-coded dependencies are problematic because they are tightly coupled, not reusable, difficult to test, and complicate development. Dependency injection solves these issues by injecting dependencies through interfaces rather than having components directly instantiate their dependencies. This allows for loose coupling, reuse, testability, and flexible configurations of classes.
Stephan Hochdörfer discusses various techniques for testing code that is difficult to test, known as "untestable code". He covers approaches like using autoloading and modifying the include path to mock dependencies, as well as overriding language functions with runkit. Generative programming is proposed as a way to automatically generate testable code by replacing dependencies with mocks. The key messages are that one should write testable code from the start, and that PHP provides many creative ways to test code through language features and workarounds.
The document discusses strategies for testing code that is considered "untestable" due to issues like tight coupling, dependencies on external resources, or private methods. It provides examples of techniques like using autoloading, stream wrappers, and reflection to mock dependencies and make code more testable without changing the code itself. Generative programming is also presented as a way to automatically generate test cases from configurations.
The document discusses testing untestable code. It begins by defining untestable code as code that is difficult to test in isolation without dependencies like databases or external resources. It then provides several techniques for making code more testable such as using dependency injection, manipulating include paths, and mocking dependencies. Specific examples are given for techniques like overriding internal functions and using stream wrappers to mock includes. The talk emphasizes writing testable code from the beginning through principles like dependency injection and avoiding direct dependencies where possible.
The document discusses strategies for testing code that is otherwise difficult or impossible to test directly. It presents examples of untestable code involving object construction, external resources like databases and web services, and language issues like private methods. For each problem, it proposes solutions like dependency injection, mocking dependencies, overriding language functions, and using aspects and generative programming to make code more testable. The overall message is that writing testable code requires refactoring legacy code or designing new code for testability from the start.
This document discusses strategies for testing code that is difficult or impossible to test directly. It begins by defining "untestable code" as code with tight coupling, dependencies on external resources, or other factors that prevent direct testing. The document then explores approaches like refactoring code to loosen dependencies and increase testability, using techniques like dependency injection and mocking external resources. It also discusses more advanced approaches like generative programming, where a framework can automatically generate test doubles and modify code structure to enable automated testing. The overall message is that with creativity, even legacy or complex code can be made testable through approaches that control dependencies and isolate the system under test.
This document discusses testing untestable code. It begins with an introduction and agenda. It then discusses what constitutes untestable code and some techniques for making code more testable, including dependency injection, manipulating include paths, namespaces, and mocking filesystems. It also discusses strategies for testing procedural code and internal functions. Finally, it introduces the concept of generative programming and generating test code from configurations.
The document discusses strategies for testing code that is initially difficult or impossible to test, referred to as "untestable code". It provides examples of untestable code involving object construction, external resources like databases and web services, and language issues. It then describes approaches to make such code more testable, including refactoring, using mocks, dependency injection, stream wrappers, and generative programming with frames. The goal is to find ways to test existing legacy code without changing the code itself.
The document discusses dependency injection, providing definitions and examples. It defines dependency as application layers depending on other layers or external components. Dependency injection manages these dependencies by allowing external code to fulfill dependencies at runtime rather than hard-coding fulfillment. The document outlines constructor, setter, and interface injection and describes configuration via annotations, XML, YAML, and PHP code. It provides examples of how dependency injection enables easy unit testing and configurable implementations.
Stephan Hochdörfer discusses various techniques for testing code that is difficult to test, known as "untestable code". He covers approaches like using autoloading and modifying the include path to mock dependencies, as well as overriding language functions with runkit. Generative programming is proposed as a way to automatically generate testable code by replacing dependencies with mocks. The key messages are that one should write testable code from the start, and that PHP provides many creative ways to test code through language features and workarounds.
The document discusses strategies for testing code that is considered "untestable" due to issues like tight coupling, dependencies on external resources, or private methods. It provides examples of techniques like using autoloading, stream wrappers, and reflection to mock dependencies and make code more testable without changing the code itself. Generative programming is also presented as a way to automatically generate test cases from configurations.
The document discusses testing untestable code. It begins by defining untestable code as code that is difficult to test in isolation without dependencies like databases or external resources. It then provides several techniques for making code more testable such as using dependency injection, manipulating include paths, and mocking dependencies. Specific examples are given for techniques like overriding internal functions and using stream wrappers to mock includes. The talk emphasizes writing testable code from the beginning through principles like dependency injection and avoiding direct dependencies where possible.
The document discusses strategies for testing code that is otherwise difficult or impossible to test directly. It presents examples of untestable code involving object construction, external resources like databases and web services, and language issues like private methods. For each problem, it proposes solutions like dependency injection, mocking dependencies, overriding language functions, and using aspects and generative programming to make code more testable. The overall message is that writing testable code requires refactoring legacy code or designing new code for testability from the start.
This document discusses strategies for testing code that is difficult or impossible to test directly. It begins by defining "untestable code" as code with tight coupling, dependencies on external resources, or other factors that prevent direct testing. The document then explores approaches like refactoring code to loosen dependencies and increase testability, using techniques like dependency injection and mocking external resources. It also discusses more advanced approaches like generative programming, where a framework can automatically generate test doubles and modify code structure to enable automated testing. The overall message is that with creativity, even legacy or complex code can be made testable through approaches that control dependencies and isolate the system under test.
This document discusses testing untestable code. It begins with an introduction and agenda. It then discusses what constitutes untestable code and some techniques for making code more testable, including dependency injection, manipulating include paths, namespaces, and mocking filesystems. It also discusses strategies for testing procedural code and internal functions. Finally, it introduces the concept of generative programming and generating test code from configurations.
The document discusses strategies for testing code that is initially difficult or impossible to test, referred to as "untestable code". It provides examples of untestable code involving object construction, external resources like databases and web services, and language issues. It then describes approaches to make such code more testable, including refactoring, using mocks, dependency injection, stream wrappers, and generative programming with frames. The goal is to find ways to test existing legacy code without changing the code itself.
The document discusses dependency injection, providing definitions and examples. It defines dependency as application layers depending on other layers or external components. Dependency injection manages these dependencies by allowing external code to fulfill dependencies at runtime rather than hard-coding fulfillment. The document outlines constructor, setter, and interface injection and describes configuration via annotations, XML, YAML, and PHP code. It provides examples of how dependency injection enables easy unit testing and configurable implementations.
This document discusses dependency injection and provides examples of its use. It begins with an introduction to dependency injection, explaining that it is a technique for supplying external dependencies to a component. It then provides examples of how dependency injection can be used to make unit testing easier, configure one class for multiple uses, and mock external services. Benefits include loose coupling and clean separation of configuration from code, while drawbacks include a lack of standardization and potential framework dependencies. Real-world examples demonstrate how dependency injection improves code readability, enables caching, and avoids tight coupling.
This document provides an overview of dependency injection and real world examples of implementing dependency injection. It discusses what dependencies are, why hardcoding dependencies is problematic, and how interfaces can be used to abstract dependencies. It then covers different types of dependency injection like constructor injection, setter injection, and interface injection. The document demonstrates how to configure dependencies using annotations, XML, YAML, or PHP files. It provides examples of how dependency injection enables easier unit testing, handling multiple implementations of a class, mocking external services, and cleaner code. Finally, it shows how to implement dependency injection using the Zend\Di library in PHP.
FxContainer is the ONLY IoC Container written in JavaFX and specifically developed to be used in JavaFX applications. It is powerful, lightweight and 75K in footprint and open source.
Project website: https://fxobjects.dev.java.net
This document discusses UI testing in Xcode 7. It provides an example test for a successful user login. It explains the XCUIApplication and XCUIElement classes which represent the application and UI elements. XCUIElementQuery can be used to find elements. Interactions like tapping and typing are demonstrated. Setting up expectations and assertions for test results is covered. Tips discussed include handling interruptions, improving performance by disabling animations, and changing device orientation in tests.
This document discusses testing untestable code in PHP. It begins by defining untestable code as code with global variables, static methods, tight coupling, or dependencies that cannot be controlled. It then provides examples of how to test such code by manipulating autoloading, namespaces, filesystem mocking with vfsStream, and overwriting internal functions with runkit. Finally, it discusses generating testable code through generative programming that extracts, customizes, and recombines code parts to make it testable. The overall message is that with flexibility, one can work around PHP limitations and change their mindset to write testable code through practices like dependency injection.
This document provides an overview of the Spring framework. Some key points:
- Spring promotes loose coupling and separation of concerns through its lightweight container and use of dependency injection.
- It simplifies configuration for aspects like transactions through declarative programming without needing full J2EE.
- The inversion of control container resolves and "injects" dependencies into components.
- Spring supports aspects through its aspect-oriented programming features which allow cross-cutting concerns to be implemented as aspects.
- It provides transaction management, DAO support, and metadata support to further simplify programming tasks.
QA Lab: тестирование ПО. Станислав Шмидт: "Self-testing REST APIs with API Fi...GeeksLab Odessa
5.12.15 QA Lab: тестирование программного обеспечения.
Upcoming events: goo.gl/I2gJ4H
Доклад о Play-Swagger, проекте с открытым исходным кодом, разрабатываемом в Zalando с использованием Scala и Play Framework. О том, как использование API First и Swagger позволяет ускорить процесс разработки, упростить взаимодействие команд и повысить качество продукта.
The document describes Eugene Fedorenko's blog about dynamically generating view objects, view definitions, and entity definitions in ADF. It provides code snippets for creating dynamic view objects and view definitions based on an agile entity name. It also shows how to dynamically define entity definitions and add agile attributes by extending the appropriate classes and calling necessary registration methods.
5.12.15 QA Lab: тестирование ПО.
Upcoming events: goo.gl/I2gJ4H
Доклад о популярных и/или лучших практиках в веб-автоматизации с точки зрения принципа KISS. Мы быстро пробежимся и оставим след в следующих темах и технологиях: Selenium, обертки вокруг Selenium, xUnit, BDD, длинные и не очень - End to End сценарии, маленькие независимые тесты Unit стиля, простые или красивые репорты, Allure репортинг, PageObject, виджеты-элементы, парадигмы программирования для автоматизации - ООП, процедурное и модульное.
The document provides an overview of new features, changes, deprecations, and removals in PHP 7, as well as how to install PHP 7. Key points covered include:
1. New features such as scalar type hints, return type declarations, the spaceship operator, null coalesce operator, and anonymous classes.
2. Changes like improved performance, uniform variable syntax, semi-reserved keywords, and exceptions being thrown for fatal errors.
3. Deprecated features such as PHP 4 constructors and the salt option for password_hash.
4. Removed features like alternative PHP tags and the date.timezone warning.
5. Installing PHP 7 via packages, compiling from source, or
Java Annotation is quite a handy tool and has the ample potential to make developer's life a lot easier(and exciting!). Learning and using custom Java Annotation Processor takes the power of Annotation even a class higher. This slide goes over a few fundamental things of an Annotation Processor to get someone started to write his/her own Annotation Processor in Java.
Key topics are,
- Java Annotation
- Usage of Annotation
- Custom Java Annotation
- Java Annotation Processor
- Usefulness of Annotation Processor
- Dive into the core of Annotation Processor
- Solve a validation problem with Custom Annotation Processor
- Get to know some exciting Annotation Processing tools that already exist
- Legacy Perl code is code that uses outdated practices, has no tests or documentation, and is difficult to understand and modify. It often results from organic growth over many years and developers.
- Unit testing legacy code provides safety during refactoring, speeds up development by replacing debugging, and creates regression tests. However, the code's dependencies make it difficult to isolate and test.
- Techniques like dependency injection, sprouting, monkey patching, and temporary object reblessing can help break dependencies and make legacy code more testable. Instrumentation with profilers also aids understanding the code.
Mastering Mock Objects - Advanced Unit Testing for JavaDenilson Nastacio
A high-level description of mock testing techniques and their implementation for the Java programming language.
This presentation specifically focus on the JMockit and JMock frameworks.
This document provides tips and best practices for using the Eclipse Modeling Framework (EMF). It discusses designing a model provider API, using item providers, working with the common command framework, reloading working models, finding EMF references, why notifications are called adapters, resource proxies, on-demand loading, useful commands, the role of the editing domain, optimizing Ecore models, defining custom data types, maintaining in-memory lists, creating unique lists, suppressing object creation, controlling command appearance, using custom adapter factories, refreshing viewers and selections, using item providers for labels and content, registering custom resource factories, encrypting/decrypting streams, querying XML data using EMF, serializing QNames, loading resources
The document discusses dynamically generating view objects (VOs) and their definitions in Oracle Application Development Framework (ADF). It describes retrieving an entity definition, creating a VO definition by extending the ViewDefImpl class and setting properties. If a VO does not exist, the definition is used to create a new VO instance. Attribute definitions are added by retrieving attributes from the entity definition.
- Java is a platform independent programming language that is similar to C++ in syntax but similar to Smalltalk in its object-oriented approach. It provides features like automatic memory management, security, and multi-threading capabilities.
- Java code is compiled to bytecode that can run on any Java Virtual Machine (JVM). Only depending on the JVM allows Java code to run on any hardware or operating system with a JVM.
- Java supports object-oriented programming concepts like inheritance, polymorphism, and encapsulation. Classes can contain methods and instance variables to define objects.
Practical tips for dealing with projects involving legacy code. Covers investigating past projects, static analysis of existing code, and methods for changing legacy code.
Presented at PHP Benelux '10
Everyone talks about raising the bar on quality of code, but it's always hard to start implementing it when you have no clue where to start. With this talk I'm shooing that there are many levels developers can improve themselves by using the right tools. In this talk I'll go over each tool with examples how to use them against your codebase. A must attend talk for every developer that wants to scale up their quality. Most PHP developers deploy code that does what the customer requested but they don't have a clue about the quality of the product they deliver. Without this knowledge, maintenance can be a hell and very expensive. In this workshop I cover unit testing, code measuring, performance testing, debugging and profiling and give tips and tricks how to continue after this workshop.
Dapper caches query information like SQL statements and parameters to improve performance when materializing objects from query results. The cache is stored in a ConcurrentDictionary that is never flushed, so it could cause memory issues with dynamically-generated SQL. Queries using parameters are preferred since the cache key depends on the SQL and parameters, allowing caching of the execution plan. Buffering determines if all rows are loaded into memory before iterating. QueryMultiple is used for queries returning multiple result sets. Dirty tracking with interfaces allows Dapper to detect whether updates actually changed data to skip unnecessary SQL generation.
Difference between wcf and asp.net web apiUmar Ali
WCF is Microsoft's unified programming model for building service-oriented applications that supports multiple transport protocols and message exchange patterns. It enables building secure and reliable services that can integrate across platforms. ASP.NET Web API is a framework for building HTTP services and is optimized for browser and mobile access. It only supports HTTP protocol but provides MVC features like routing and controllers. WCF supports advanced protocols like reliable messaging while ASP.NET Web API is best for resource-oriented HTTP services that need to support a broad range of clients. The document compares key differences between WCF and ASP.NET Web API across areas like protocols, hosting, description, and when to choose each technology.
This document discusses dependency injection and provides examples of its use. It begins with an introduction to dependency injection, explaining that it is a technique for supplying external dependencies to a component. It then provides examples of how dependency injection can be used to make unit testing easier, configure one class for multiple uses, and mock external services. Benefits include loose coupling and clean separation of configuration from code, while drawbacks include a lack of standardization and potential framework dependencies. Real-world examples demonstrate how dependency injection improves code readability, enables caching, and avoids tight coupling.
This document provides an overview of dependency injection and real world examples of implementing dependency injection. It discusses what dependencies are, why hardcoding dependencies is problematic, and how interfaces can be used to abstract dependencies. It then covers different types of dependency injection like constructor injection, setter injection, and interface injection. The document demonstrates how to configure dependencies using annotations, XML, YAML, or PHP files. It provides examples of how dependency injection enables easier unit testing, handling multiple implementations of a class, mocking external services, and cleaner code. Finally, it shows how to implement dependency injection using the Zend\Di library in PHP.
FxContainer is the ONLY IoC Container written in JavaFX and specifically developed to be used in JavaFX applications. It is powerful, lightweight and 75K in footprint and open source.
Project website: https://fxobjects.dev.java.net
This document discusses UI testing in Xcode 7. It provides an example test for a successful user login. It explains the XCUIApplication and XCUIElement classes which represent the application and UI elements. XCUIElementQuery can be used to find elements. Interactions like tapping and typing are demonstrated. Setting up expectations and assertions for test results is covered. Tips discussed include handling interruptions, improving performance by disabling animations, and changing device orientation in tests.
This document discusses testing untestable code in PHP. It begins by defining untestable code as code with global variables, static methods, tight coupling, or dependencies that cannot be controlled. It then provides examples of how to test such code by manipulating autoloading, namespaces, filesystem mocking with vfsStream, and overwriting internal functions with runkit. Finally, it discusses generating testable code through generative programming that extracts, customizes, and recombines code parts to make it testable. The overall message is that with flexibility, one can work around PHP limitations and change their mindset to write testable code through practices like dependency injection.
This document provides an overview of the Spring framework. Some key points:
- Spring promotes loose coupling and separation of concerns through its lightweight container and use of dependency injection.
- It simplifies configuration for aspects like transactions through declarative programming without needing full J2EE.
- The inversion of control container resolves and "injects" dependencies into components.
- Spring supports aspects through its aspect-oriented programming features which allow cross-cutting concerns to be implemented as aspects.
- It provides transaction management, DAO support, and metadata support to further simplify programming tasks.
QA Lab: тестирование ПО. Станислав Шмидт: "Self-testing REST APIs with API Fi...GeeksLab Odessa
5.12.15 QA Lab: тестирование программного обеспечения.
Upcoming events: goo.gl/I2gJ4H
Доклад о Play-Swagger, проекте с открытым исходным кодом, разрабатываемом в Zalando с использованием Scala и Play Framework. О том, как использование API First и Swagger позволяет ускорить процесс разработки, упростить взаимодействие команд и повысить качество продукта.
The document describes Eugene Fedorenko's blog about dynamically generating view objects, view definitions, and entity definitions in ADF. It provides code snippets for creating dynamic view objects and view definitions based on an agile entity name. It also shows how to dynamically define entity definitions and add agile attributes by extending the appropriate classes and calling necessary registration methods.
5.12.15 QA Lab: тестирование ПО.
Upcoming events: goo.gl/I2gJ4H
Доклад о популярных и/или лучших практиках в веб-автоматизации с точки зрения принципа KISS. Мы быстро пробежимся и оставим след в следующих темах и технологиях: Selenium, обертки вокруг Selenium, xUnit, BDD, длинные и не очень - End to End сценарии, маленькие независимые тесты Unit стиля, простые или красивые репорты, Allure репортинг, PageObject, виджеты-элементы, парадигмы программирования для автоматизации - ООП, процедурное и модульное.
The document provides an overview of new features, changes, deprecations, and removals in PHP 7, as well as how to install PHP 7. Key points covered include:
1. New features such as scalar type hints, return type declarations, the spaceship operator, null coalesce operator, and anonymous classes.
2. Changes like improved performance, uniform variable syntax, semi-reserved keywords, and exceptions being thrown for fatal errors.
3. Deprecated features such as PHP 4 constructors and the salt option for password_hash.
4. Removed features like alternative PHP tags and the date.timezone warning.
5. Installing PHP 7 via packages, compiling from source, or
Java Annotation is quite a handy tool and has the ample potential to make developer's life a lot easier(and exciting!). Learning and using custom Java Annotation Processor takes the power of Annotation even a class higher. This slide goes over a few fundamental things of an Annotation Processor to get someone started to write his/her own Annotation Processor in Java.
Key topics are,
- Java Annotation
- Usage of Annotation
- Custom Java Annotation
- Java Annotation Processor
- Usefulness of Annotation Processor
- Dive into the core of Annotation Processor
- Solve a validation problem with Custom Annotation Processor
- Get to know some exciting Annotation Processing tools that already exist
- Legacy Perl code is code that uses outdated practices, has no tests or documentation, and is difficult to understand and modify. It often results from organic growth over many years and developers.
- Unit testing legacy code provides safety during refactoring, speeds up development by replacing debugging, and creates regression tests. However, the code's dependencies make it difficult to isolate and test.
- Techniques like dependency injection, sprouting, monkey patching, and temporary object reblessing can help break dependencies and make legacy code more testable. Instrumentation with profilers also aids understanding the code.
Mastering Mock Objects - Advanced Unit Testing for JavaDenilson Nastacio
A high-level description of mock testing techniques and their implementation for the Java programming language.
This presentation specifically focus on the JMockit and JMock frameworks.
This document provides tips and best practices for using the Eclipse Modeling Framework (EMF). It discusses designing a model provider API, using item providers, working with the common command framework, reloading working models, finding EMF references, why notifications are called adapters, resource proxies, on-demand loading, useful commands, the role of the editing domain, optimizing Ecore models, defining custom data types, maintaining in-memory lists, creating unique lists, suppressing object creation, controlling command appearance, using custom adapter factories, refreshing viewers and selections, using item providers for labels and content, registering custom resource factories, encrypting/decrypting streams, querying XML data using EMF, serializing QNames, loading resources
The document discusses dynamically generating view objects (VOs) and their definitions in Oracle Application Development Framework (ADF). It describes retrieving an entity definition, creating a VO definition by extending the ViewDefImpl class and setting properties. If a VO does not exist, the definition is used to create a new VO instance. Attribute definitions are added by retrieving attributes from the entity definition.
- Java is a platform independent programming language that is similar to C++ in syntax but similar to Smalltalk in its object-oriented approach. It provides features like automatic memory management, security, and multi-threading capabilities.
- Java code is compiled to bytecode that can run on any Java Virtual Machine (JVM). Only depending on the JVM allows Java code to run on any hardware or operating system with a JVM.
- Java supports object-oriented programming concepts like inheritance, polymorphism, and encapsulation. Classes can contain methods and instance variables to define objects.
Practical tips for dealing with projects involving legacy code. Covers investigating past projects, static analysis of existing code, and methods for changing legacy code.
Presented at PHP Benelux '10
Everyone talks about raising the bar on quality of code, but it's always hard to start implementing it when you have no clue where to start. With this talk I'm shooing that there are many levels developers can improve themselves by using the right tools. In this talk I'll go over each tool with examples how to use them against your codebase. A must attend talk for every developer that wants to scale up their quality. Most PHP developers deploy code that does what the customer requested but they don't have a clue about the quality of the product they deliver. Without this knowledge, maintenance can be a hell and very expensive. In this workshop I cover unit testing, code measuring, performance testing, debugging and profiling and give tips and tricks how to continue after this workshop.
Dapper caches query information like SQL statements and parameters to improve performance when materializing objects from query results. The cache is stored in a ConcurrentDictionary that is never flushed, so it could cause memory issues with dynamically-generated SQL. Queries using parameters are preferred since the cache key depends on the SQL and parameters, allowing caching of the execution plan. Buffering determines if all rows are loaded into memory before iterating. QueryMultiple is used for queries returning multiple result sets. Dirty tracking with interfaces allows Dapper to detect whether updates actually changed data to skip unnecessary SQL generation.
Difference between wcf and asp.net web apiUmar Ali
WCF is Microsoft's unified programming model for building service-oriented applications that supports multiple transport protocols and message exchange patterns. It enables building secure and reliable services that can integrate across platforms. ASP.NET Web API is a framework for building HTTP services and is optimized for browser and mobile access. It only supports HTTP protocol but provides MVC features like routing and controllers. WCF supports advanced protocols like reliable messaging while ASP.NET Web API is best for resource-oriented HTTP services that need to support a broad range of clients. The document compares key differences between WCF and ASP.NET Web API across areas like protocols, hosting, description, and when to choose each technology.
Real World Asp.Net WebApi ApplicationsEffie Arditi
This document provides guidance on building real world single page applications using various technologies including Git, AppHarbor PaaS, MongoDB integration, IoC/Dependency Injection, testing with nUnit and Moq, CI/CD, the Repository Pattern, and exception management. It discusses using Bootstrap.MVC for responsive design, Backbone.js as a client MVC library, and client-side session and authentication management. The document also covers building and deploying an app in the cloud using WebAPI which is self-hosted and flexible with content negotiation, and separating website concerns from the API.
This document discusses dependency injection and its real world applications. It begins by defining what dependencies are in software applications. It then discusses that dependencies themselves are not bad, but rather fixed dependencies can be problematic. The document advocates for using dependency injection and abstraction rather than directly instantiating dependencies. It provides examples of implementing constructor, setter, and interface injection. It also discusses using annotations, external configuration files, and internal configuration for dependency injection. The benefits of dependency injection for unit testing and allowing one class to have multiple implementations are covered.
Real World Dependency Injection - IPC11 Spring EditionStephan Hochdörfer
This document discusses dependency injection and provides examples of how to implement it in PHP code. It defines dependencies as classes or modules that other classes rely on. While dependencies are useful, hard-coded dependencies are considered bad practice because they result in tightly coupled code that is difficult to test and reuse. The document recommends using dependency injection to decouple classes by injecting dependencies via constructors or setters rather than instantiating them directly. It provides examples of annotation-based and configuration-based dependency injection using XML, YAML or PHP files. Benefits discussed include easier unit testing, ability to configure one class for multiple uses, and improved code organization and reusability through separation of concerns.
This document discusses dependency injection (DI) and its benefits when applied in real world projects. It defines DI as a pattern that allows removal of hard-coded dependencies and makes dependencies changeable. The document explains that DI improves code reuse, testability, and maintainability by reducing tight coupling between classes. It presents different DI techniques like constructor injection and describes how to configure dependencies using annotations or XML configuration. The benefits of DI mentioned include easy unit testing, supporting multiple configurations of a class, and mocking external services.
The document discusses dependency injection, including what it is, why it is useful, and how it can be implemented. It defines dependency injection as objects receiving their dependencies from external sources rather than creating them internally. This allows for looser coupling, easier testing, and flexibility to use different implementations. The document covers different injection techniques like constructor injection and using a dependency injection container to manage object wiring.
The document provides an overview of the Yii PHP framework, including its core components and features such as MVC architecture, database access, caching, authentication, theming, logging, error handling, and web services. Key sections summarize the entry script, application, controller, model, view, and component classes that make up the framework. Other sections cover basics like creating an application, working with databases and displaying data, as well as more advanced topics such as caching, URL management, and performance tuning.
Apache Wicket is a Java web application framework that uses a component-based programming model to build web UIs, allowing developers to treat page elements like buttons and labels as objects and handle events like clicks. It aims to bridge the gap between desktop and web development by enabling an event-driven programming style and component hierarchy similar to Swing. Wicket pages are composed of reusable Java components that correspond to HTML elements, avoiding the impedance mismatch between Java and HTTP programming models.
Reviews the basis of using JavaScript within WordPress. How to load in scripts correctly and move PHP data into JavaScripts for later use. Presented at WordCamp LA 2012
Writing code is cool, but see it generating automatically is even cooler! This talk will be a case study about possibilities of Annotation Preprocessing in Java development. Let's look into popular libraries and frameworks that are using Annotation Preprocessing (like Lombok, Dagger 2, Retrofit, MapStruct), talk about it pros and cons compared with Reflection / Runtime Code Generation and discuss how you can create your own library that will generate boilerplate code at compile time.
Dropwizard is a Java framework for building RESTful web services. It supports microservices architecture and includes modules for common functions like authentication, database access, metrics collection, and health checks. Developers define resources, configure the application via YAML, integrate with databases via JDBI, and build representations with Jackson. It aims to provide a productive full-stack framework for building microservices.
The document discusses hexagonal architecture and its advantages for building maintainable software. It explains that hexagonal architecture divides a system into loosely coupled components like the application core and interfaces. This decouples the code and allows changes in one part to affect few other places. Ports act as contracts between components, with input and output ports. Adapters provide implementations for the ports. Benefits include increased testability, ability to update frameworks without impacting the domain, and postponing technical decisions. The document provides an example of applying hexagonal architecture with Symfony. It recommends starting with decoupling legacy code using interfaces, dependency injection, and other best practices when refactoring.
Software architecture has a lot to do with making sure the dependency graph is well structured. But in practice, maintaining a clean dependency graph while injecting dependencies in a type safe and runtime safe manner is a lot of repetitive code to write. This problem often leads developers to overuse the singleton pattern, making their code less modular at best, almost untestable at worst. Weaver is a code generation tool which makes it easy to inject dependencies where they are needed while maintaining a safe and clean dependency graph at the same time.
Talk: https://www.youtube.com/watch?v=h3CMMbgozG0
Github: https://github.com/scribd/Weaver
This document summarizes the Guice dependency injection framework. It provides an overview of key Guice concepts like dependency injection, modules, and bindings. It also discusses Guice extensions like Warp Persist for persistence and transaction management and Google GIN which compiles Guice configuration at compile time for improved performance.
The document provides instructions for installing and testing a WebGUI developer workshop that demonstrates how to create macros, content handlers, and utilize other WebGUI plugins like URL handlers and assets, allowing developers to extend WebGUI's functionality and build custom applications. It outlines steps for installing the workshop files, accessing the virtual machine, and includes examples of simple "Hello World" macros and content handlers to get started with WebGUI development.
Jenkins User Conference 2012
Only by the third plugin do you get the hang of writing a plugin. I thought as a developer coming to the build side of things it'd be easy to jump in and write some plugins. I was wrong. Don't be fooled by the extremely friendly Jenkins community, writing a plugin from scratch is harder than they let on. This talk will explain the hurdles that I had to cross to make writing plugins easy.
Presentation for meetup Submit PHP by Anatoliy Sieryi (Full-Stack developer at Binary Studio)
Video: https://www.youtube.com/edit?video_id=tzQRcMcO1-I&video_referrer=watch
This talk represents the combined experience from several web development teams who have been using Symfony2 since months already to create high profile production applications. The aim is to give the audience real world advice on how to best leverage Symfony2, the current rough spots and how to work around them. Aside from covering how to implement functionality in Symfony2, this talk will also cover topics such as how to best integrate 3rd party bundles and where to find them as well as how to deploy the code and integrate into the entire server setup.
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)arcware
The document outlines 10 things that every WordPress plugin developer should know, including enabling debugging, prefixing functions, enqueuing scripts and styles properly, only including JS/CSS on admin pages, using AJAX in the admin, adding extensibility hooks, supporting multisite, internationalization, security, and using helpful functions and constants. It provides examples and explanations for each topic to help plugin developers write more effective and secure code.
Kicking off with Zend Expressive and Doctrine ORM (PHP UK 2017)James Titcumb
You've heard of Zend's new framework, Expressive, and you've heard it's the new hotness. In this talk, I will introduce the concepts of Expressive, how to bootstrap a simple application with the framework using best practices, and finally how to integrate a third party tool like Doctrine ORM.
Similar to Real World Dependency Injection - phpday (20)
This document discusses Phing, an open source build tool for PHP projects that is based on Apache Ant. It provides instructions on how to install Phing globally using PEAR or with Composer. It also covers Phing basics like projects, targets, tasks and properties. Additionally, it demonstrates how to write custom tasks in PHP and use property files to customize builds.
Offline strategies for HTML5 web applications - frOSCon8Stephan Hochdörfer
The document discusses various strategies for enabling offline functionality in HTML5 web applications. It begins by introducing the speaker and defining what is meant by "offline" in this context. It then covers application caching using the cache manifest to store static resources locally. Other techniques discussed include storing dynamic data locally using Web Storage, Web SQL Database, IndexedDB, and the File API. For each approach, examples are provided of how to perform common operations like adding, modifying and retrieving data items. The techniques are also compared in terms of advantages and disadvantages.
Offline Strategies for HTML5 Web Applications - oscon13Stephan Hochdörfer
This document discusses various strategies for enabling offline functionality in HTML5 web applications. It begins by explaining the differences between application caching and offline storage. It then covers using the application cache, web storage, web SQL database, IndexedDB, and file API for caching static resources and storing dynamic data locally. It notes pros and cons of each approach as well as browser support limitations. The document aims to help developers choose the best offline solutions for HTML5 applications.
This document discusses domain-specific languages (DSLs) and provides examples of internal and external DSLs. It explains that internal DSLs are implemented within a general-purpose language using techniques like fluent APIs, expression builders, functions, closures, and annotations. External DSLs have greater syntactic freedom but require developing a new language. Both types of DSLs aim to increase productivity by focusing on the domain rather than implementation details. The document also covers code generation from a DSL to executable code.
This document discusses various ways to install and configure Phing, the PHP build tool. It recommends installing Phing globally via PEAR or with Composer. It also covers best practices like using imports to structure targets, defining internal targets, creating custom tasks, prompting for input, and integrating Phing with Jenkins. The document emphasizes following conventions like naming the main build file build.xml and properties file build.properties.
The document discusses various strategies for enabling offline functionality in HTML5 web applications. It begins by describing past approaches like cookies, Flash cookies, and Google Gears. It then introduces the App Cache, which allows caching of static resources, and discusses some limitations. Other approaches covered include storing data locally using the Data URI scheme, Web Storage, and the Web SQL Database for structured storage. Code examples are provided for basic CRUD operations using Web Storage.
This document provides an overview of the Phing build tool. It discusses what Phing is, how to install Phing using PEAR or Composer, Phing basics like projects, targets, tasks and properties. It provides examples of build files that demonstrate defining multiple targets, target dependencies, calling targets programmatically, using filesets and filters. Finally, it discusses some of the things Phing can be used for, like automating permission changes.
Offline strategies for HTML5 web applications - ConFoo13Stephan Hochdörfer
The document discusses various offline strategies for HTML5 web applications, including application caching, storing data locally using web storage, web SQL databases, and IndexedDB. It provides code examples and explanations of how to cache static resources, add, modify, and remove items from local storage using these different technologies. It also highlights some advantages and disadvantages of each approach.
This document discusses strategies for testing code that is difficult or seemingly impossible to test, known as "untestable code". It provides examples of how to address issues like object construction that relies on external resources, dependencies, private methods, and language limitations. Specific techniques include using autoloading, custom stream wrappers, mocking databases/web services, reflection, and generative programming with frames to dynamically generate test and production code. The overall message is that with the right approaches, even legacy or "untestable" code can be made testable.
The document discusses various strategies for building offline capabilities in HTML5 web applications. It covers using the Application Cache manifest to cache static resources, storing data locally using Web Storage or the Web SQL Database API, and an introduction to the IndexedDB API. It also highlights some gotchas with the Application Cache, such as files always being served from the cache and the need to reload the page to see new resources.
Offline strategies for HTML5 web applications - pfCongres2012Stephan Hochdörfer
The document discusses various strategies for building offline capabilities in HTML5 web applications, including:
1) The Application Cache API allows caching static resources to load pages offline but has limitations.
2) Data URIs and Web Storage allow storing limited amounts of dynamic data locally in a simple key-value format.
3) Web SQL Database provided an offline SQL database but is no longer part of HTML5; IndexedDB provides similar functionality with better performance.
This document discusses a software generator framework for generative programming. Generative programming aims to deal with software system families by utilizing a generator, implementation components, and a domain-specific configuration language. The presented framework uses Java, Maven and Spring and allows defining features, frames, and content providers to generate customized software products based on an input configuration. It demonstrates how custom logic can be added through a content provider that replaces markers in frame files at generation time.
Part 2 Deep Dive: Navigating the 2024 Slowdownjeffkluth1
Introduction
The global retail industry has weathered numerous storms, with the financial crisis of 2008 serving as a poignant reminder of the sector's resilience and adaptability. However, as we navigate the complex landscape of 2024, retailers face a unique set of challenges that demand innovative strategies and a fundamental shift in mindset. This white paper contrasts the impact of the 2008 recession on the retail sector with the current headwinds retailers are grappling with, while offering a comprehensive roadmap for success in this new paradigm.
HOW TO START UP A COMPANY A STEP-BY-STEP GUIDE.pdf46adnanshahzad
How to Start Up a Company: A Step-by-Step Guide Starting a company is an exciting adventure that combines creativity, strategy, and hard work. It can seem overwhelming at first, but with the right guidance, anyone can transform a great idea into a successful business. Let's dive into how to start up a company, from the initial spark of an idea to securing funding and launching your startup.
Introduction
Have you ever dreamed of turning your innovative idea into a thriving business? Starting a company involves numerous steps and decisions, but don't worry—we're here to help. Whether you're exploring how to start a startup company or wondering how to start up a small business, this guide will walk you through the process, step by step.
[To download this presentation, visit:
https://www.oeconsulting.com.sg/training-presentations]
This PowerPoint compilation offers a comprehensive overview of 20 leading innovation management frameworks and methodologies, selected for their broad applicability across various industries and organizational contexts. These frameworks are valuable resources for a wide range of users, including business professionals, educators, and consultants.
Each framework is presented with visually engaging diagrams and templates, ensuring the content is both informative and appealing. While this compilation is thorough, please note that the slides are intended as supplementary resources and may not be sufficient for standalone instructional purposes.
This compilation is ideal for anyone looking to enhance their understanding of innovation management and drive meaningful change within their organization. Whether you aim to improve product development processes, enhance customer experiences, or drive digital transformation, these frameworks offer valuable insights and tools to help you achieve your goals.
INCLUDED FRAMEWORKS/MODELS:
1. Stanford’s Design Thinking
2. IDEO’s Human-Centered Design
3. Strategyzer’s Business Model Innovation
4. Lean Startup Methodology
5. Agile Innovation Framework
6. Doblin’s Ten Types of Innovation
7. McKinsey’s Three Horizons of Growth
8. Customer Journey Map
9. Christensen’s Disruptive Innovation Theory
10. Blue Ocean Strategy
11. Strategyn’s Jobs-To-Be-Done (JTBD) Framework with Job Map
12. Design Sprint Framework
13. The Double Diamond
14. Lean Six Sigma DMAIC
15. TRIZ Problem-Solving Framework
16. Edward de Bono’s Six Thinking Hats
17. Stage-Gate Model
18. Toyota’s Six Steps of Kaizen
19. Microsoft’s Digital Transformation Framework
20. Design for Six Sigma (DFSS)
To download this presentation, visit:
https://www.oeconsulting.com.sg/training-presentations
Structural Design Process: Step-by-Step Guide for BuildingsChandresh Chudasama
The structural design process is explained: Follow our step-by-step guide to understand building design intricacies and ensure structural integrity. Learn how to build wonderful buildings with the help of our detailed information. Learn how to create structures with durability and reliability and also gain insights on ways of managing structures.
How to Implement a Strategy: Transform Your Strategy with BSC Designer's Comp...Aleksey Savkin
The Strategy Implementation System offers a structured approach to translating stakeholder needs into actionable strategies using high-level and low-level scorecards. It involves stakeholder analysis, strategy decomposition, adoption of strategic frameworks like Balanced Scorecard or OKR, and alignment of goals, initiatives, and KPIs.
Key Components:
- Stakeholder Analysis
- Strategy Decomposition
- Adoption of Business Frameworks
- Goal Setting
- Initiatives and Action Plans
- KPIs and Performance Metrics
- Learning and Adaptation
- Alignment and Cascading of Scorecards
Benefits:
- Systematic strategy formulation and execution.
- Framework flexibility and automation.
- Enhanced alignment and strategic focus across the organization.
The APCO Geopolitical Radar - Q3 2024 The Global Operating Environment for Bu...APCO
The Radar reflects input from APCO’s teams located around the world. It distils a host of interconnected events and trends into insights to inform operational and strategic decisions. Issues covered in this edition include:
How to Implement a Real Estate CRM SoftwareSalesTown
To implement a CRM for real estate, set clear goals, choose a CRM with key real estate features, and customize it to your needs. Migrate your data, train your team, and use automation to save time. Monitor performance, ensure data security, and use the CRM to enhance marketing. Regularly check its effectiveness to improve your business.
Taurus Zodiac Sign: Unveiling the Traits, Dates, and Horoscope Insights of th...my Pandit
Dive into the steadfast world of the Taurus Zodiac Sign. Discover the grounded, stable, and logical nature of Taurus individuals, and explore their key personality traits, important dates, and horoscope insights. Learn how the determination and patience of the Taurus sign make them the rock-steady achievers and anchors of the zodiac.
SATTA MATKA SATTA FAST RESULT KALYAN TOP MATKA RESULT KALYAN SATTA MATKA FAST RESULT MILAN RATAN RAJDHANI MAIN BAZAR MATKA FAST TIPS RESULT MATKA CHART JODI CHART PANEL CHART FREE FIX GAME SATTAMATKA ! MATKA MOBI SATTA 143 spboss.in TOP NO1 RESULT FULL RATE MATKA ONLINE GAME PLAY BY APP SPBOSS
Best practices for project execution and deliveryCLIVE MINCHIN
A select set of project management best practices to keep your project on-track, on-cost and aligned to scope. Many firms have don't have the necessary skills, diligence, methods and oversight of their projects; this leads to slippage, higher costs and longer timeframes. Often firms have a history of projects that simply failed to move the needle. These best practices will help your firm avoid these pitfalls but they require fortitude to apply.
At Techbox Square, in Singapore, we're not just creative web designers and developers, we're the driving force behind your brand identity. Contact us today.
Unveiling the Dynamic Personalities, Key Dates, and Horoscope Insights: Gemin...my Pandit
Explore the fascinating world of the Gemini Zodiac Sign. Discover the unique personality traits, key dates, and horoscope insights of Gemini individuals. Learn how their sociable, communicative nature and boundless curiosity make them the dynamic explorers of the zodiac. Dive into the duality of the Gemini sign and understand their intellectual and adventurous spirit.
Zodiac Signs and Food Preferences_ What Your Sign Says About Your Tastemy Pandit
Know what your zodiac sign says about your taste in food! Explore how the 12 zodiac signs influence your culinary preferences with insights from MyPandit. Dive into astrology and flavors!
[To download this presentation, visit:
https://www.oeconsulting.com.sg/training-presentations]
This presentation is a curated compilation of PowerPoint diagrams and templates designed to illustrate 20 different digital transformation frameworks and models. These frameworks are based on recent industry trends and best practices, ensuring that the content remains relevant and up-to-date.
Key highlights include Microsoft's Digital Transformation Framework, which focuses on driving innovation and efficiency, and McKinsey's Ten Guiding Principles, which provide strategic insights for successful digital transformation. Additionally, Forrester's framework emphasizes enhancing customer experiences and modernizing IT infrastructure, while IDC's MaturityScape helps assess and develop organizational digital maturity. MIT's framework explores cutting-edge strategies for achieving digital success.
These materials are perfect for enhancing your business or classroom presentations, offering visual aids to supplement your insights. Please note that while comprehensive, these slides are intended as supplementary resources and may not be complete for standalone instructional purposes.
Frameworks/Models included:
Microsoft’s Digital Transformation Framework
McKinsey’s Ten Guiding Principles of Digital Transformation
Forrester’s Digital Transformation Framework
IDC’s Digital Transformation MaturityScape
MIT’s Digital Transformation Framework
Gartner’s Digital Transformation Framework
Accenture’s Digital Strategy & Enterprise Frameworks
Deloitte’s Digital Industrial Transformation Framework
Capgemini’s Digital Transformation Framework
PwC’s Digital Transformation Framework
Cisco’s Digital Transformation Framework
Cognizant’s Digital Transformation Framework
DXC Technology’s Digital Transformation Framework
The BCG Strategy Palette
McKinsey’s Digital Transformation Framework
Digital Transformation Compass
Four Levels of Digital Maturity
Design Thinking Framework
Business Model Canvas
Customer Journey Map
The Genesis of BriansClub.cm Famous Dark WEb PlatformSabaaSudozai
BriansClub.cm, a famous platform on the dark web, has become one of the most infamous carding marketplaces, specializing in the sale of stolen credit card data.
Anny Serafina Love - Letter of Recommendation by Kellen Harkins, MS.AnnySerafinaLove
This letter, written by Kellen Harkins, Course Director at Full Sail University, commends Anny Love's exemplary performance in the Video Sharing Platforms class. It highlights her dedication, willingness to challenge herself, and exceptional skills in production, editing, and marketing across various video platforms like YouTube, TikTok, and Instagram.
2. Real World Dependency Injection
About me
Stephan Hochdörfer, bitExpert AG
Department Manager Research Labs
enjoying PHP since 1999
S.Hochdoerfer@bitExpert.de
@shochdoerfer
14. Real World Dependency Injection
„new“ is evil!
<?php
class DeletePage extends Mvc_Action_AAction {
private $pageManager;
public function __construct() {
$this->pageManager = new PageManager();
}
protected function execute(Mvc_Request $request) {
$this->pageManager->delete(
(int) $request->get('pageId')
);
}
}
15. Real World Dependency Injection
„new“ is evil!
<?php
class DeletePage extends Mvc_Action_AAction {
private $pageManager;
public function __construct(PageManager $pm) {
$this->pageManager = $pm;
}
protected function execute(Mvc_Request $request) {
$this->pageManager->delete(
(int) $request->get('pageId')
);
}
}
16. Real World Dependency Injection
"High-level modules should not
depend on low-level modules.
Both should depend on
abstractions."
Robert C. Martin
33. Real World Dependency Injection
Annotation based wiring
<?php
class MySampleService implements IMySampleService {
private $sampleDao;
/**
* @Inject
*/
public function __construct(ISampleDao $sampleDao)
{
$this->sampleDao = $sampleDao;
}
}
34. Real World Dependency Injection
Annotation based wiring
<?php
class MySampleService implements IMySampleService {
private $sampleDao;
/**
* @Inject
* @Named('TheSampleDao')
*/
public function __construct(ISampleDao $sampleDao)
{
$this->sampleDao = $sampleDao;
}
}
40. Real World Dependency Injection
Unittesting made easy
<?php
require_once 'PHPUnit/Framework.php';
class ServiceTest extends PHPUnit_Framework_TestCase {
public function testSampleService() {
// set up dependencies
$sampleDao = $this->getMock('ISampleDao');
$service = new MySampleService($sampleDao);
// run test case
$return = $service->doWork();
// check assertions
$this->assertTrue($return);
}
}
42. Real World Dependency Injection
One class, multiple configurations
Page Exporter
Page Exporter
Released / /Published
Released Published Workingcopy
Workingcopy
Pages
Pages Pages
Pages
43. Real World Dependency Injection
One class, multiple configurations
<?php
abstract class PageExporter {
protected function setPageDao(IPageDao $pageDao) {
$this->pageDao = $pageDao;
}
}
44. Real World Dependency Injection
One class, multiple configurations
<?php
abstract class PageExporter {
protected function setPageDao(IPageDao $pageDao) {
$this->pageDao = $pageDao;
}
}
Remember:
The contract!
45. Real World Dependency Injection
One class, multiple configurations
<?php
class PublishedPageExporter extends PageExporter {
public function __construct() {
$this->setPageDao(new PublishedPageDao());
}
}
class WorkingCopyPageExporter extends PageExporter {
public function __construct() {
$this->setPageDao(new WorkingCopyPageDao());
}
}
46. Real World Dependency Injection
One class, multiple configurations
"Only deleted code is good code!"
Oliver Gierke
47. Real World Dependency Injection
One class, multiple configurations
<?php
class PageExporter {
public function __construct(IPageDao $pageDao) {
$this->pageDao = $pageDao;
}
}
48. Real World Dependency Injection
One class, multiple configurations
<?xml version="1.0" encoding="UTF-8" ?>
<beans>
<bean id="ExportLive" class="PageExporter">
<constructor-arg ref="PublishedPageDao" />
</bean>
<bean id="ExportWorking" class="PageExporter">
<constructor-arg ref="WorkingCopyPageDao" />
</bean>
</beans>
49. Real World Dependency Injection
One class, multiple configurations
<?php
// create ApplicationContext instance
$ctx = new ApplicationContext();
// retrieve live exporter
$exporter = $ctx->getBean('ExportLive');
// retrieve working copy exporter
$exporter = $ctx->getBean('ExportWorking');
51. Real World Dependency Injection
One class, multiple configurations II
http://editor.loc/page/[id]/headline/
http://editor.loc/page/[id]/content/
http://editor.loc/page/[id]/teaser/
52. Real World Dependency Injection
One class, multiple configurations II
<?php
class EditPart extends Mvc_Action_AFormAction {
private $pagePartsManager;
private $type;
public function __construct(IPagePartsManager $pm) {
$this->pagePartsManager = $pm;
}
public function setType($ptype) {
$this->type = (int) $type;
}
protected function process(Bo_ABo $formBackObj) {
}
}
53. Real World Dependency Injection
One class, multiple configurations II
<?xml version="1.0" encoding="UTF-8" ?>
<beans>
<bean id="EditHeadline" class="EditPart">
<constructor-arg ref="PagePartDao" />
<property name="Type" const="PType::Headline" />
</bean>
<bean id="EditContent" class="EditPart">
<constructor-arg ref="PagePartDao" />
<property name="Type" const="PType::Content" />
</bean>
</beans>
55. Real World Dependency Injection
Mocking external service access
WS-
WS-
Booking service
Booking service Webservice
Webservice
Connector
Connector
56. Real World Dependency Injection
Mocking external service access
WS-
WS-
Booking service
Booking service Webservice
Webservice
Connector
Connector
Remember:
The contract!
57. Real World Dependency Injection
Mocking external service access
FS-
FS-
Booking service
Booking service Filesystem
Filesystem
Connector
Connector
58. Real World Dependency Injection
Mocking external service access
FS-
FS-
Booking service
Booking service Filesystem
Filesystem
Connector
Connector
fullfills the
contract!
62. Real World Dependency Injection
No framework dependency
<?php
class MySampleService implements IMySampleService {
private $sampleDao;
public function __construct(ISampleDao $sampleDao) {
$this->sampleDao = $sampleDao;
}
public function getSample($sampleId) {
try {
return $this->sampleDao->readById($sampleId);
}
catch(DaoException $exception) {}
}
}