This document discusses metaprogramming in Ruby, including object models, method dispatching, evaluation using class_eval, instance_eval, and eval, hooks for intercepting events, and building domain-specific languages. It provides examples of extending classes and objects at runtime through techniques like singleton classes, evaluation contexts, and method missing to add new behaviors dynamically. It also covers fluent interfaces and chaining methods to build internal domain-specific languages.
The document discusses how PHP 5.3 changes the implementation of common design patterns like the Singleton pattern and Observer pattern through the use of anonymous functions. It provides code examples of implementing these patterns in PHP 4/5.0-5.2 versus PHP 5.3 using features like closures, late static binding, and __invoke(). The document also proposes building a dependency injection container in PHP 5.3 using anonymous functions to describe object creation without instantiating objects. This approach results in a simple yet fully-featured dependency injector implementation in around 40 lines of code.
Performance optimization is a crucial aspect of building ‘snappy’ client-side applications and something which all developers using jQuery should bear in mind. In this talk, we're going to take a look at some of the best practices, tips and tricks for improving the performance of your jQuery code in 2011 with some quick wins and a few new surprises along the way.
Building maintainable javascript applicationsequisodie
In this presentation I share some tips about how to improve the quality and readability of JavaScript code, more specifically:
- Object Oriented JavaScript (comparing JS with Java)
- Bad practices
- Good practices
- Guidelines
- Recommended books
The discovery of unit testing and test-driven development was one of the most important parts of my growth as a developer. The ability to write simple, small pieces of code that could verify the behavior of my application was in itself quite useful. And the ability to refactor without fear, just by running the test suite, changed how I program. But the real benefits come in how unit tests shape your application code: more testable code is often more well thought-out, more decoupled, and more extensible.
In this talk, I'll give a whirlwind introduction to unit testing as a concept and as a practice. I want you fully convinced it's the best thing to happen to software development, if you aren't already. Once we're on the same page there, I'll take a deep dive into what makes a good unit test. This involves testing tools such as spies, stubs, and mocks, concepts like code coverage, and practices like dependency injection that shape your application code. The most important lesson will be on how to focus on singular, isolated units of code in your testing, as this guides you toward building modular, flexible, and comprehensible applications.
The document discusses various techniques for automated testing, particularly acceptance testing. It recommends that manual testing is time-consuming and error-prone, so automated testing is preferable. It describes different types of automated tests like unit tests and acceptance tests. It also discusses challenges with acceptance testing, such as getting product owners involved. Finally, it provides examples of implementing automated testing with frameworks like SimpleTest and PHPUnit.
The document provides guidance on writing clean automated tests with three key points:
1. Tests should be focused, testing a single functionality and failing clearly when that functionality is broken.
2. Tests should be robust, not failing when unrelated code changes.
3. Tests should be maintainable, with the purpose and expectations clear even after time has passed.
This document discusses metaprogramming in Ruby, including object models, method dispatching, evaluation using class_eval, instance_eval, and eval, hooks for intercepting events, and building domain-specific languages. It provides examples of extending classes and objects at runtime through techniques like singleton classes, evaluation contexts, and method missing to add new behaviors dynamically. It also covers fluent interfaces and chaining methods to build internal domain-specific languages.
The document discusses how PHP 5.3 changes the implementation of common design patterns like the Singleton pattern and Observer pattern through the use of anonymous functions. It provides code examples of implementing these patterns in PHP 4/5.0-5.2 versus PHP 5.3 using features like closures, late static binding, and __invoke(). The document also proposes building a dependency injection container in PHP 5.3 using anonymous functions to describe object creation without instantiating objects. This approach results in a simple yet fully-featured dependency injector implementation in around 40 lines of code.
Performance optimization is a crucial aspect of building ‘snappy’ client-side applications and something which all developers using jQuery should bear in mind. In this talk, we're going to take a look at some of the best practices, tips and tricks for improving the performance of your jQuery code in 2011 with some quick wins and a few new surprises along the way.
Building maintainable javascript applicationsequisodie
In this presentation I share some tips about how to improve the quality and readability of JavaScript code, more specifically:
- Object Oriented JavaScript (comparing JS with Java)
- Bad practices
- Good practices
- Guidelines
- Recommended books
The discovery of unit testing and test-driven development was one of the most important parts of my growth as a developer. The ability to write simple, small pieces of code that could verify the behavior of my application was in itself quite useful. And the ability to refactor without fear, just by running the test suite, changed how I program. But the real benefits come in how unit tests shape your application code: more testable code is often more well thought-out, more decoupled, and more extensible.
In this talk, I'll give a whirlwind introduction to unit testing as a concept and as a practice. I want you fully convinced it's the best thing to happen to software development, if you aren't already. Once we're on the same page there, I'll take a deep dive into what makes a good unit test. This involves testing tools such as spies, stubs, and mocks, concepts like code coverage, and practices like dependency injection that shape your application code. The most important lesson will be on how to focus on singular, isolated units of code in your testing, as this guides you toward building modular, flexible, and comprehensible applications.
The document discusses various techniques for automated testing, particularly acceptance testing. It recommends that manual testing is time-consuming and error-prone, so automated testing is preferable. It describes different types of automated tests like unit tests and acceptance tests. It also discusses challenges with acceptance testing, such as getting product owners involved. Finally, it provides examples of implementing automated testing with frameworks like SimpleTest and PHPUnit.
The document provides guidance on writing clean automated tests with three key points:
1. Tests should be focused, testing a single functionality and failing clearly when that functionality is broken.
2. Tests should be robust, not failing when unrelated code changes.
3. Tests should be maintainable, with the purpose and expectations clear even after time has passed.
This document provides an introduction and overview of Apache Ant, a Java-based build tool. Some key points:
- Ant is a build tool similar to Make but uses XML configuration files rather than Make's syntax. It is cross-platform.
- Ant build files define targets containing tasks. Common tasks include compiling Java code, creating JAR files, copying/deleting files.
- The document explains how to set up Ant, write a basic Ant build file with targets and tasks, and run Ant from the command line.
- An example Ant build file is provided to demonstrate a simple "Hello World" Java project build using Ant tasks like compile, jar, and clean.
(RubyFools 2008)
"Plugins are more than just shiny nuggets of code which rain down from the higher echelons of the Rails pantheon; they are loyal and useful servants that anyone can employ to help reuse code between applications. Without a little guidance, however, the process of figuring out just how to tame these beasts can be overwhelming.
"This presentation will help give developers the boost that's often required to get up to speed developing plugins. We'll cover the hooks that Rails' plugin mechanism makes available, and how to put them to best use in practice.
"Once we've covered the groundwork, we'll start to look at more advanced programming techniques for sharing code (and other files) between Rails applications. With a few key programming techniques under our belt, we can use plugins to alter and enhance the Rails framework itself, and become masters of Ruby's object model along the way."
PHPSpec & Behat: Two Testing Tools That Write Code For You (#phptek edition)Joshua Warren
PHPSpec and Behat are two amazing PHP tools that empower specification-driven development and behavior-driven development. These two tools combined can help you build test coverage, but many people don't realize they can also write much of your code for you. In this talk, we'll see what PHPSpec and Behat can do, through a series of examples and use cases. In other words, I heard you like to code, so I wrote code that writes code while you code.
Presented at #phptek - http://tek.phparch.com
Ant is a Java-based build tool that uses XML configuration files called build files to compile, test, and package Java applications. It provides a standard way to build Java projects independent of the operating system by using tasks that execute specific actions like compilation and packaging. The document discusses what Ant is, why it was created, how to install it, how to write a basic build file, and provides an example of using Ant to compile, package, and run a simple "Hello World" Java application.
This document provides an overview and agenda for a PowerShell crash course presentation. It introduces PowerShell concepts like cmdlets, aliases, snap-ins, objects, and the pipeline. It also covers PowerShell security features and using alternate credentials. The agenda includes a PowerShell backgrounder, accomplishing admin tasks with PowerShell, and available resources.
Intro To JavaScript Unit Testing - Ran MizrahiRan Mizrahi
The document introduces JavaScript testing and test-driven development (TDD). It discusses why software projects fail, challenges of testing JavaScript code, and how to use the Mocha and ChaiJS frameworks for TDD and behavior-driven development (BDD). It provides an example of writing unit tests for a user service function using TDD principles, implementing the code to pass the tests, and running the tests with Mocha. Benefits of testing code include short feedback cycles, high test coverage, documentation of specifications, and less time spent debugging.
Don't RTFM, WTFM - Open Source Documentation - German Perl Workshop 2010singingfish
The document discusses improving documentation for Perl modules like Moose and Catalyst by focusing on providing working code examples and minimizing extraneous information. It advocates for an incremental, "git-based" approach to introducing concepts one by one and advertising examples. Key points made include assuming readers have minimal knowledge, reducing cognitive load, and crowdsourcing documentation improvements through a standard Pod format. Contributors are tasked with improving specific documentation areas by these principles.
This document provides an overview of Selenium, an open source tool for automating web application testing. It describes Selenium IDE for recording and debugging tests in Firefox, Selenium RC for controlling browsers, and how to install and use Selenium IDE. The document also covers creating and running tests in Selenium IDE, locating elements, and introduces object-oriented programming concepts in Java. It presents TestNG as a testing framework for Java and outlines how to set up TestNG in Eclipse.
This document provides an overview of Apache Ant, including its evolution from Make, its advantages over Make, basic concepts like targets and tasks, and examples of how to write a build file using Ant. It discusses common tasks like javac for compiling Java code and recommends steps to include in a typical Ant build file, such as getting the source code, preparing a build area, compiling, building libraries, deploying, and validating. It also demonstrates compiling a sample application using Ant tasks.
This document discusses using overlays, accordions, and tabs with jQuery and jQuery Tools in Plone. It provides an overview of the technology stack including jQuery, jQuery Tools, and Plone-specific helpers. Examples are given for setting up tabs and accordions, as well as for AJAX forms. The plone.app.jquerytools package and Products.pipbox module are described as ways to incorporate jQuery Tools into Plone. Potential applications discussed include accordion portlets, image overlays, and popup forms.
SPCA2013 - Test-driven Development with SharePoint 2013 and Visual StudioNCCOMMS
This document discusses test-driven development (TDD) approaches for SharePoint projects using Visual Studio. It begins with an introduction to TDD and the benefits it provides. It then covers different types of tests like unit, integration, and acceptance tests. It demonstrates how to write server-side and client-side tests for SharePoint. Finally, it discusses test automation tools and concludes that while SharePoint presents challenges for testing, TDD is still very valuable when developing for the platform.
The document introduces Codeception, an automated testing framework for PHP. It discusses different types of tests like unit tests, functional tests, and acceptance tests. It provides examples of writing tests using Codeception and describes challenges like handling JavaScript and browser inconsistencies. The document recommends prioritizing acceptance and functional tests that validate integration over unit tests.
This document provides instructions for building a RESTful API with Flask that allows users to be created, viewed, updated, and deleted. It discusses installing Python, Flask, Flask-SQLAlchemy, and Flask-Marshmallow. It then demonstrates how to create a user model and schema, and build API endpoints to add a new user, retrieve all users, get a single user by ID, update a user, and delete a user. Finally, it provides instructions for running the application and testing the API with Postman.
The document summarizes key points from a WordPress meetup discussion on plugin development:
- Mostafa Soufi discussed why developers make plugins and what plugins are comprised of. He suggested starting a new plugin by creating directories and files and adding a readme file.
- Navid Kashani recommended focusing on support from the beginning by improving support processes, solving issues proactively, setting metrics, and using a central support channel like Slack. Hiring a support person is not necessary initially.
- The discussion covered plugin best practices like internationalization, shortcodes, activation hooks, caching with transients, security techniques, and answering questions from attendees.
The document discusses code quality and its importance. It defines code quality as code that works functionally, is testable, and is easy to maintain. It identifies good practices such as writing testable code, avoiding complexity, and following principles like DRY. Tools like test frameworks, code coverage tools, static analysis tools, and integrated tools like Sonar can help ensure code quality and catch issues early.
This document provides an introduction to Apache Ant, a build tool for Java projects. It begins by explaining why Ant is important to learn despite IDEs having their own build systems. The document then outlines what Ant is and how it can be used for automation beyond just building. It provides a basic example of creating an "Hello World" project in Ant and comparing it to doing so manually in Java. The document dives deeper into Ant programming concepts like targets, properties, tasks and extending Ant functionality. It aims to give an overview of Ant and how it can be used for Java project builds.
ANT is a Java-based build tool that uses XML configuration files to compile code, package artifacts, and deploy applications. It provides a structured way to automate complex build processes through targets and tasks. Targets contain tasks that execute sequentially, and targets can depend on each other to ensure prerequisites are met. Common tasks include compiling code, generating JAR files, running tests, and deploying applications. ANT is cross-platform, extensible through Java classes, and provides a standardized way to build Java projects through an XML configuration file.
What is BDD? Is it the same as TDD, or something quite different? This talk will answer these questions, and show how PhpSpec can be integrated into your development workflow to drive your Object Oriented design. Plus: a sneak peak at some of the new features in the forthcoming 2.1 release.
This document discusses emergent design and test-driven development using PHP and PHPSpec. It emphasizes designing software through describing how objects interact to solve problems, focusing on messaging between objects. Simple design rules like removing duplication and complexity are recommended to make code more testable, modular, and change-friendly. Designing for delegation using mocks is presented as a way to extract collaborators and move behavior definitions.
This document discusses PHPSpec, a behavior-driven development (BDD) framework for PHP. It begins by explaining what PHPSpec is and how it implements BDD through a domain-specific language (DSL) based on RSpec. The document then covers how PHPSpec specifies tests using contexts, examples, expectations, matchers, mocks, and stubs. It provides examples of writing PHPSpec tests and using various PHPSpec features. The document concludes by mentioning upcoming PHPSpec features and linking to resources for learning more.
PhpSpec is a SpecBDD tool that enables you to use a TDD workflow that can transform the way you write PHP. In this session we will look at the TDD workflow and see how PhpSpec can be used to speed up your development; add regression safety, and improve your object-oriented design.
This document provides an introduction and overview of Apache Ant, a Java-based build tool. Some key points:
- Ant is a build tool similar to Make but uses XML configuration files rather than Make's syntax. It is cross-platform.
- Ant build files define targets containing tasks. Common tasks include compiling Java code, creating JAR files, copying/deleting files.
- The document explains how to set up Ant, write a basic Ant build file with targets and tasks, and run Ant from the command line.
- An example Ant build file is provided to demonstrate a simple "Hello World" Java project build using Ant tasks like compile, jar, and clean.
(RubyFools 2008)
"Plugins are more than just shiny nuggets of code which rain down from the higher echelons of the Rails pantheon; they are loyal and useful servants that anyone can employ to help reuse code between applications. Without a little guidance, however, the process of figuring out just how to tame these beasts can be overwhelming.
"This presentation will help give developers the boost that's often required to get up to speed developing plugins. We'll cover the hooks that Rails' plugin mechanism makes available, and how to put them to best use in practice.
"Once we've covered the groundwork, we'll start to look at more advanced programming techniques for sharing code (and other files) between Rails applications. With a few key programming techniques under our belt, we can use plugins to alter and enhance the Rails framework itself, and become masters of Ruby's object model along the way."
PHPSpec & Behat: Two Testing Tools That Write Code For You (#phptek edition)Joshua Warren
PHPSpec and Behat are two amazing PHP tools that empower specification-driven development and behavior-driven development. These two tools combined can help you build test coverage, but many people don't realize they can also write much of your code for you. In this talk, we'll see what PHPSpec and Behat can do, through a series of examples and use cases. In other words, I heard you like to code, so I wrote code that writes code while you code.
Presented at #phptek - http://tek.phparch.com
Ant is a Java-based build tool that uses XML configuration files called build files to compile, test, and package Java applications. It provides a standard way to build Java projects independent of the operating system by using tasks that execute specific actions like compilation and packaging. The document discusses what Ant is, why it was created, how to install it, how to write a basic build file, and provides an example of using Ant to compile, package, and run a simple "Hello World" Java application.
This document provides an overview and agenda for a PowerShell crash course presentation. It introduces PowerShell concepts like cmdlets, aliases, snap-ins, objects, and the pipeline. It also covers PowerShell security features and using alternate credentials. The agenda includes a PowerShell backgrounder, accomplishing admin tasks with PowerShell, and available resources.
Intro To JavaScript Unit Testing - Ran MizrahiRan Mizrahi
The document introduces JavaScript testing and test-driven development (TDD). It discusses why software projects fail, challenges of testing JavaScript code, and how to use the Mocha and ChaiJS frameworks for TDD and behavior-driven development (BDD). It provides an example of writing unit tests for a user service function using TDD principles, implementing the code to pass the tests, and running the tests with Mocha. Benefits of testing code include short feedback cycles, high test coverage, documentation of specifications, and less time spent debugging.
Don't RTFM, WTFM - Open Source Documentation - German Perl Workshop 2010singingfish
The document discusses improving documentation for Perl modules like Moose and Catalyst by focusing on providing working code examples and minimizing extraneous information. It advocates for an incremental, "git-based" approach to introducing concepts one by one and advertising examples. Key points made include assuming readers have minimal knowledge, reducing cognitive load, and crowdsourcing documentation improvements through a standard Pod format. Contributors are tasked with improving specific documentation areas by these principles.
This document provides an overview of Selenium, an open source tool for automating web application testing. It describes Selenium IDE for recording and debugging tests in Firefox, Selenium RC for controlling browsers, and how to install and use Selenium IDE. The document also covers creating and running tests in Selenium IDE, locating elements, and introduces object-oriented programming concepts in Java. It presents TestNG as a testing framework for Java and outlines how to set up TestNG in Eclipse.
This document provides an overview of Apache Ant, including its evolution from Make, its advantages over Make, basic concepts like targets and tasks, and examples of how to write a build file using Ant. It discusses common tasks like javac for compiling Java code and recommends steps to include in a typical Ant build file, such as getting the source code, preparing a build area, compiling, building libraries, deploying, and validating. It also demonstrates compiling a sample application using Ant tasks.
This document discusses using overlays, accordions, and tabs with jQuery and jQuery Tools in Plone. It provides an overview of the technology stack including jQuery, jQuery Tools, and Plone-specific helpers. Examples are given for setting up tabs and accordions, as well as for AJAX forms. The plone.app.jquerytools package and Products.pipbox module are described as ways to incorporate jQuery Tools into Plone. Potential applications discussed include accordion portlets, image overlays, and popup forms.
SPCA2013 - Test-driven Development with SharePoint 2013 and Visual StudioNCCOMMS
This document discusses test-driven development (TDD) approaches for SharePoint projects using Visual Studio. It begins with an introduction to TDD and the benefits it provides. It then covers different types of tests like unit, integration, and acceptance tests. It demonstrates how to write server-side and client-side tests for SharePoint. Finally, it discusses test automation tools and concludes that while SharePoint presents challenges for testing, TDD is still very valuable when developing for the platform.
The document introduces Codeception, an automated testing framework for PHP. It discusses different types of tests like unit tests, functional tests, and acceptance tests. It provides examples of writing tests using Codeception and describes challenges like handling JavaScript and browser inconsistencies. The document recommends prioritizing acceptance and functional tests that validate integration over unit tests.
This document provides instructions for building a RESTful API with Flask that allows users to be created, viewed, updated, and deleted. It discusses installing Python, Flask, Flask-SQLAlchemy, and Flask-Marshmallow. It then demonstrates how to create a user model and schema, and build API endpoints to add a new user, retrieve all users, get a single user by ID, update a user, and delete a user. Finally, it provides instructions for running the application and testing the API with Postman.
The document summarizes key points from a WordPress meetup discussion on plugin development:
- Mostafa Soufi discussed why developers make plugins and what plugins are comprised of. He suggested starting a new plugin by creating directories and files and adding a readme file.
- Navid Kashani recommended focusing on support from the beginning by improving support processes, solving issues proactively, setting metrics, and using a central support channel like Slack. Hiring a support person is not necessary initially.
- The discussion covered plugin best practices like internationalization, shortcodes, activation hooks, caching with transients, security techniques, and answering questions from attendees.
The document discusses code quality and its importance. It defines code quality as code that works functionally, is testable, and is easy to maintain. It identifies good practices such as writing testable code, avoiding complexity, and following principles like DRY. Tools like test frameworks, code coverage tools, static analysis tools, and integrated tools like Sonar can help ensure code quality and catch issues early.
This document provides an introduction to Apache Ant, a build tool for Java projects. It begins by explaining why Ant is important to learn despite IDEs having their own build systems. The document then outlines what Ant is and how it can be used for automation beyond just building. It provides a basic example of creating an "Hello World" project in Ant and comparing it to doing so manually in Java. The document dives deeper into Ant programming concepts like targets, properties, tasks and extending Ant functionality. It aims to give an overview of Ant and how it can be used for Java project builds.
ANT is a Java-based build tool that uses XML configuration files to compile code, package artifacts, and deploy applications. It provides a structured way to automate complex build processes through targets and tasks. Targets contain tasks that execute sequentially, and targets can depend on each other to ensure prerequisites are met. Common tasks include compiling code, generating JAR files, running tests, and deploying applications. ANT is cross-platform, extensible through Java classes, and provides a standardized way to build Java projects through an XML configuration file.
What is BDD? Is it the same as TDD, or something quite different? This talk will answer these questions, and show how PhpSpec can be integrated into your development workflow to drive your Object Oriented design. Plus: a sneak peak at some of the new features in the forthcoming 2.1 release.
This document discusses emergent design and test-driven development using PHP and PHPSpec. It emphasizes designing software through describing how objects interact to solve problems, focusing on messaging between objects. Simple design rules like removing duplication and complexity are recommended to make code more testable, modular, and change-friendly. Designing for delegation using mocks is presented as a way to extract collaborators and move behavior definitions.
This document discusses PHPSpec, a behavior-driven development (BDD) framework for PHP. It begins by explaining what PHPSpec is and how it implements BDD through a domain-specific language (DSL) based on RSpec. The document then covers how PHPSpec specifies tests using contexts, examples, expectations, matchers, mocks, and stubs. It provides examples of writing PHPSpec tests and using various PHPSpec features. The document concludes by mentioning upcoming PHPSpec features and linking to resources for learning more.
PhpSpec is a SpecBDD tool that enables you to use a TDD workflow that can transform the way you write PHP. In this session we will look at the TDD workflow and see how PhpSpec can be used to speed up your development; add regression safety, and improve your object-oriented design.
This document provides an overview and introduction to phpspec, an open source BDD framework for PHP. It covers installing phpspec, generating and editing specs, running specs, different types of matchers for specs including identity, comparison, throw, type and object state matchers. It also briefly mentions formatters, progress reporting, stubbing, mocking and points to additional resources.
The document provides guidelines for testing Rails applications. It recommends that any code change should be driven by a failed test. Tests should be close to the code being tested and focus on functionality rather than specific code. It discusses testing models, associations, named scopes, validations, controllers, views, helpers, emails, user interactions, Ajax requests, external sites, Rake tasks, file uploads, legacy applications, and more. The goal is to have tests that result in high-quality code through a test-first approach.
Comparison of different access controlsRashmi Nair
This document compares different access control options in Rails - CanCan and Pundit. CanCan takes a simple approach, isolating all authorization logic in a single Ability class. Pundit provides helpers to build a custom authorization system using plain Ruby classes, supporting complex applications with multiple roles. While CanCan evaluates all abilities for every request, Pundit only evaluates the ability for the requested action. The document recommends Pundit for Rails 4 support and flexibility to meet different authorization needs.
This document provides an introduction and overview of unit testing in PHP. It discusses what unit testing is, the benefits of unit testing, and some key aspects of unit testing like test isolation, automation, and speed. It also introduces the PHPUnit testing framework as the de facto standard for PHP unit testing. Examples are provided of unit testing a multiplication function with PHPUnit by creating test cases to assert expected outcomes. The document also discusses differences between unit testing and integration testing and refactoring code to be more testable through techniques like dependency injection.
The document discusses building testable PHP applications. It covers topics like testing code, testable architecture, dependency injection, and static code analysis tools like PHP Code Sniffer, PHP Mess Detector, and PHP Copy Paster Detector. The document emphasizes that writing tests and designing for testability leads to fewer bugs and more maintainable code. It provides examples of unit testing and recommends test-driven development practices.
This document provides an overview of quality assurance for PHP projects. It discusses the importance of revision control, documentation, testing, and automation in QA. Revision control systems like SVN and Git are recommended for team development and tracking code versions. PHP Lint is introduced for syntax checking files from the command line. Documenting code with PHPDoc is suggested. Unit testing forms and models is demonstrated using PHPUnit. Validation, filtering, and sanitizing user input is important for protection against exploits. Overall the document promotes establishing strong quality practices like testing, revision control, and documentation for PHP projects.
This workshop is a hands-on training where a real Zend Framework application is used as an example to start improving QA using tools to test, document and perform software metric calculations to indicate where the software can be improved. I also explain the reports produced by a CI system.
2011-02-03 LA RubyConf Rails3 TDD WorkshopWolfram Arnold
This document provides an overview of test-driven development (TDD) using Rails 3. It discusses why TDD is important, how to structure tests in different layers (model, controller, etc.), and what to test for models, controllers and views. It also covers RSpec 2 and useful tools like RVM. The presentation includes live coding demos and in-class exercises on TDD.
- Ruby is an interactive, object-oriented programming language created by Yukihiro Matsumoto in 1995.
- Ruby on Rails is a web application framework built on Ruby that emphasizes convention over configuration and is optimized for programmer happiness.
- The document discusses Ruby and Ruby on Rails, providing an overview of their history, key principles like MVC, REST, and conventions used in Rails. It also provides examples of modeling data with classes and ActiveRecord in Rails.
Abstraction, Encapsulation, Polymorphism, and Interfaces: whether you’ve been programming in PHP for years or are just starting your journey, these terms can be overwhelming even on a good day. Variables, conditionals, those all make sense. But this whole Object-Oriented thing is WAY more complicated. Not only that, people that already understand it act like it’s so easy and they talk right over the simple questions and never explain the basic concepts in a way that actually makes sense. In this session we’ll take you through real life examples of Object-Oriented terminology in a way that will make sense of all the mumbo jumbo and allow you to utilizing OOP immediately.
The document discusses testing strategies for migrating from Drupal 7 to Drupal 8. It introduces various testing tools that are well-suited for Drupal 8 like PHPUnit, Behat, and PhantomJS. It emphasizes the importance of acceptance testing and behavior driven development to test business value. The document also recommends writing modular object-oriented code, using autoloaders and Composer to more easily migrate code and testing between versions.
This document provides best practices for writing PHPUnit tests, including: do not write tests that do not test anything or test too much; exploit dependencies between tests; use the most specific assertion; decouple test code from test data; organize tests by class; run tests via XML configuration; disable unnecessary PHPUnit features; use code coverage whitelisting; annotate tests to make coverage more meaningful; and avoid unnecessary patterns like singletons.
The document discusses RSpec, a behavior-driven development framework for Ruby. It provides two frameworks: a story framework for describing application-level behavior and a spec framework for describing object-level behavior. The document then discusses testing Rails applications, including testing models and controllers. It provides an example of generating a model, migration, and test for a Book model.
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.
Save time by applying clean code principlesEdorian
This document discusses applying clean code principles to save time. It motivates clean code by noting that developers spend most of their time reading and understanding code. It recommends techniques like testing, coding standards, dependency injection and small focused classes to make code easier to read and maintain. Examples show how naming conventions, short functions, avoiding comments and value objects can clarify code's intent and purpose.
modern module development - Ken Barber 2012 Edinburgh Puppet CampPuppet
The document provides information on modern Puppet module development best practices. It discusses what modules are and common patterns like package, config, service that address 80% of module needs. It also covers validation of module parameters using Kwalify schemas, testing modules with rspec-puppet, and packaging modules for release on the Puppet Forge using the puppet-module tool. The document emphasizes the importance of coding style, linting with puppet-lint, and following patterns and best practices to create high quality, reusable modules.
How to? Drupal developer toolkit. Dennis Povshedny.DrupalCampDN
This document provides recommendations for the technical tools and development environment for a Drupal developer. It discusses setting up a local LAMP stack with Linux, Apache, MySQL, and PHP configured for development. It also recommends version control with Git, debugging with XDebug, and using IDEs like NetBeans or Eclipse. Additional tips include installing browser plugins, following Drupal coding standards, and contributing code back to the community.
Efficient Rails Test Driven Development (class 4) by Wolfram ArnoldMarakana Inc.
Learn how to apply the test-first approach to all of your Rails projects. In this six class series, experienced Rails engineer and consultant, Wolfram Arnold applies his real-world perspective to teaching you effective patterns for testing.
In this fourth of six classes, Wolf covers:
- Refactoring code & tests, custom matchers
- API Testing
- Remote data setup
- Cucumber for API testing & documentation
** You can get the video and source code from this presentation at: http://marakana.com/f/204 **
All six classes will be available online, so stay tuned! And be sure to check out marakana.com/techtv for more videos on open source training.
Presented by: Wolfram Arnold, in collaboration with Sarah Allen, BlazingCloud.net
Produced by: Marakana
Preparing Non - Technical Founders for Engaging a Tech AgencyISH Technologies
Preparing non-technical founders before engaging a tech agency is crucial for the success of their projects. It starts with clearly defining their vision and goals, conducting thorough market research, and gaining a basic understanding of relevant technologies. Setting realistic expectations and preparing a detailed project brief are essential steps. Founders should select a tech agency with a proven track record and establish clear communication channels. Additionally, addressing legal and contractual considerations and planning for post-launch support are vital to ensure a smooth and successful collaboration. This preparation empowers non-technical founders to effectively communicate their needs and work seamlessly with their chosen tech agency.Visit our site to get more details about this. Contact us today www.ishtechnologies.com.au
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdfVALiNTRY360
Salesforce Healthcare CRM, implemented by VALiNTRY360, revolutionizes patient management by enhancing patient engagement, streamlining administrative processes, and improving care coordination. Its advanced analytics, robust security, and seamless integration with telehealth services ensure that healthcare providers can deliver personalized, efficient, and secure patient care. By automating routine tasks and providing actionable insights, Salesforce Healthcare CRM enables healthcare providers to focus on delivering high-quality care, leading to better patient outcomes and higher satisfaction. VALiNTRY360's expertise ensures a tailored solution that meets the unique needs of any healthcare practice, from small clinics to large hospital systems.
For more info visit us https://valintry360.com/solutions/health-life-sciences
Unveiling the Advantages of Agile Software Development.pdfbrainerhub1
Learn about Agile Software Development's advantages. Simplify your workflow to spur quicker innovation. Jump right in! We have also discussed the advantages.
INTRODUCTION TO AI CLASSICAL THEORY TARGETED EXAMPLESanfaltahir1010
Image: Include an image that represents the concept of precision, such as a AI helix or a futuristic healthcare
setting.
Objective: Provide a foundational understanding of precision medicine and its departure from traditional
approaches
Role of theory: Discuss how genomics, the study of an organism's complete set of AI ,
plays a crucial role in precision medicine.
Customizing treatment plans: Highlight how genetic information is used to customize
treatment plans based on an individual's genetic makeup.
Examples: Provide real-world examples of successful application of AI such as genetic
therapies or targeted treatments.
Importance of molecular diagnostics: Explain the role of molecular diagnostics in identifying
molecular and genetic markers associated with diseases.
Biomarker testing: Showcase how biomarker testing aids in creating personalized treatment plans.
Content:
• Ethical issues: Examine ethical concerns related to precision medicine, such as privacy, consent, and
potential misuse of genetic information.
• Regulations and guidelines: Present examples of ethical guidelines and regulations in place to safeguard
patient rights.
• Visuals: Include images or icons representing ethical considerations.
Content:
• Ethical issues: Examine ethical concerns related to precision medicine, such as privacy, consent, and
potential misuse of genetic information.
• Regulations and guidelines: Present examples of ethical guidelines and regulations in place to safeguard
patient rights.
• Visuals: Include images or icons representing ethical considerations.
Content:
• Ethical issues: Examine ethical concerns related to precision medicine, such as privacy, consent, and
potential misuse of genetic information.
• Regulations and guidelines: Present examples of ethical guidelines and regulations in place to safeguard
patient rights.
• Visuals: Include images or icons representing ethical considerations.
Real-world case study: Present a detailed case study showcasing the success of precision
medicine in a specific medical scenario.
Patient's journey: Discuss the patient's journey, treatment plan, and outcomes.
Impact: Emphasize the transformative effect of precision medicine on the individual's
health.
Objective: Ground the presentation in a real-world example, highlighting the practical
application and success of precision medicine.
Data challenges: Address the challenges associated with managing large sets of patient data in precision
medicine.
Technological solutions: Discuss technological innovations and solutions for handling and analyzing vast
datasets.
Visuals: Include graphics representing data management challenges and technological solutions.
Objective: Acknowledge the data-related challenges in precision medicine and highlight innovative solutions.
Data challenges: Address the challenges associated with managing large sets of patient data in precision
medicine.
Technological solutions: Discuss technological innovations and solutions
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSISTier1 app
Are you ready to unlock the secrets hidden within Java thread dumps? Join us for a hands-on session where we'll delve into effective troubleshooting patterns to swiftly identify the root causes of production problems. Discover the right tools, techniques, and best practices while exploring *real-world case studies of major outages* in Fortune 500 enterprises. Engage in interactive lab exercises where you'll have the opportunity to troubleshoot thread dumps and uncover performance issues firsthand. Join us and become a master of Java thread dump analysis!
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesQuickdice ERP
Explore the seamless transition to e-invoicing with this comprehensive guide tailored for Saudi Arabian businesses. Navigate the process effortlessly with step-by-step instructions designed to streamline implementation and enhance efficiency.
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...XfilesPro
Wondering how X-Sign gained popularity in a quick time span? This eSign functionality of XfilesPro DocuPrime has many advancements to offer for Salesforce users. Explore them now!
Using Query Store in Azure PostgreSQL to Understand Query PerformanceGrant Fritchey
Microsoft has added an excellent new extension in PostgreSQL on their Azure Platform. This session, presented at Posette 2024, covers what Query Store is and the types of information you can get out of it.
Measures in SQL (SIGMOD 2024, Santiago, Chile)Julian Hyde
SQL has attained widespread adoption, but Business Intelligence tools still use their own higher level languages based upon a multidimensional paradigm. Composable calculations are what is missing from SQL, and we propose a new kind of column, called a measure, that attaches a calculation to a table. Like regular tables, tables with measures are composable and closed when used in queries.
SQL-with-measures has the power, conciseness and reusability of multidimensional languages but retains SQL semantics. Measure invocations can be expanded in place to simple, clear SQL.
To define the evaluation semantics for measures, we introduce context-sensitive expressions (a way to evaluate multidimensional expressions that is consistent with existing SQL semantics), a concept called evaluation context, and several operations for setting and modifying the evaluation context.
A talk at SIGMOD, June 9–15, 2024, Santiago, Chile
Authors: Julian Hyde (Google) and John Fremlin (Google)
https://doi.org/10.1145/3626246.3653374
UI5con 2024 - Keynote: Latest News about UI5 and it’s EcosystemPeter Muessig
Learn about the latest innovations in and around OpenUI5/SAPUI5: UI5 Tooling, UI5 linter, UI5 Web Components, Web Components Integration, UI5 2.x, UI5 GenAI.
Recording:
https://www.youtube.com/live/MSdGLG2zLy8?si=INxBHTqkwHhxV5Ta&t=0
Mobile App Development Company In Noida | Drona InfotechDrona Infotech
Drona Infotech is a premier mobile app development company in Noida, providing cutting-edge solutions for businesses.
Visit Us For : https://www.dronainfotech.com/mobile-application-development/
E-commerce Development Services- Hornet DynamicsHornet Dynamics
For any business hoping to succeed in the digital age, having a strong online presence is crucial. We offer Ecommerce Development Services that are customized according to your business requirements and client preferences, enabling you to create a dynamic, safe, and user-friendly online store.
UI5con 2024 - Bring Your Own Design SystemPeter Muessig
How do you combine the OpenUI5/SAPUI5 programming model with a design system that makes its controls available as Web Components? Since OpenUI5/SAPUI5 1.120, the framework supports the integration of any Web Components. This makes it possible, for example, to natively embed own Web Components of your design system which are created with Stencil. The integration embeds the Web Components in a way that they can be used naturally in XMLViews, like with standard UI5 controls, and can be bound with data binding. Learn how you can also make use of the Web Components base class in OpenUI5/SAPUI5 to also integrate your Web Components and get inspired by the solution to generate a custom UI5 library providing the Web Components control wrappers for the native ones.
Odoo releases a new update every year. The latest version, Odoo 17, came out in October 2023. It brought many improvements to the user interface and user experience, along with new features in modules like accounting, marketing, manufacturing, websites, and more.
The Odoo 17 update has been a hot topic among startups, mid-sized businesses, large enterprises, and Odoo developers aiming to grow their businesses. Since it is now already the first quarter of 2024, you must have a clear idea of what Odoo 17 entails and what it can offer your business if you are still not aware of it.
This blog covers the features and functionalities. Explore the entire blog and get in touch with expert Odoo ERP consultants to leverage Odoo 17 and its features for your business too.
An Overview of Odoo ERP
Odoo ERP was first released as OpenERP software in February 2005. It is a suite of business applications used for ERP, CRM, eCommerce, websites, and project management. Ten years ago, the Odoo Enterprise edition was launched to help fund the Odoo Community version.
When you compare Odoo Community and Enterprise, the Enterprise edition offers exclusive features like mobile app access, Odoo Studio customisation, Odoo hosting, and unlimited functional support.
Today, Odoo is a well-known name used by companies of all sizes across various industries, including manufacturing, retail, accounting, marketing, healthcare, IT consulting, and R&D.
The latest version, Odoo 17, has been available since October 2023. Key highlights of this update include:
Enhanced user experience with improvements to the command bar, faster backend page loading, and multiple dashboard views.
Instant report generation, credit limit alerts for sales and invoices, separate OCR settings for invoice creation, and an auto-complete feature for forms in the accounting module.
Improved image handling and global attribute changes for mailing lists in email marketing.
A default auto-signature option and a refuse-to-sign option in HR modules.
Options to divide and merge manufacturing orders, track the status of manufacturing orders, and more in the MRP module.
Dark mode in Odoo 17.
Now that the Odoo 17 announcement is official, let’s look at what’s new in Odoo 17!
What is Odoo ERP 17?
Odoo 17 is the latest version of one of the world’s leading open-source enterprise ERPs. This version has come up with significant improvements explained here in this blog. Also, this new version aims to introduce features that enhance time-saving, efficiency, and productivity for users across various organisations.
Odoo 17, released at the Odoo Experience 2023, brought notable improvements to the user interface and added new functionalities with enhancements in performance, accessibility, data analysis, and management, further expanding its reach in the market.
2. “Always code as if the guy who ends up maintaining
your code will be a violent psychopath
and knows where you live.”
- John F. Woods
THE OBLIGATORY QUOTE
4. LEARNING HOW TO TEST
Started looking at unit testing about 2010
Very confusing
So many new concepts, language & ideas
Difficult to implement
Documentation, help and examples were scarce
5.
6. Since then, there are many new tools available
Behat
PHPSpec
Codeception
Documentation has improved, as have help & examples
Frameworks are introducing better standards/practices
BIGGER, BETTER TOOLS
7. GETTING MY HEAD AROUND IT
Started reading about Domain Driven Design
Started using CQRS
Experimented with Datamapper tools, like Doctrine
Started playing with other testing tools, like PHPSpec, Behat & Codeception
And I discovered:
The architecture of my code was a massive issue
I was thinking in terms of the frameworks I was using
“Fat Controllers, Thin Models” - No. (Anaemic Domain Model)
Public attributes on models ($user->name = $blah) weren’t helping
8. THINGS THAT HELPED
I started restructuring my code based on DDD, CQRS and SOLID principles
Made loads of mistakes
… and even more mistakes
Started removing the database structure from my thinking (tough!!!)
Discovered that some mistakes aren’t mistakes
Spoke to a bunch of people on IRC
10. SOFTWARE TESTING
Been around since the late 70s
Checks if a component of a system satisfies the requirements
Usually separated into:
Unit Testing
Integration Testing
Acceptance Testing
11. UNIT TESTING
Tests individual parts - or a unit - of your code
Eg. Does the add() method work properly?
One function/method may have multiple tests
PHPUnit, PHPSpec
12. INTEGRATION TESTING
Tests several parts of your system are working
correctly together
Eg. When a user registers, are their details
saved to the Database?
Behat
13. ACCEPTANCE TESTING
Tests the system is working correctly from a
user’s perspective
E.g. if I go to /register - is the correct form
displayed?
E.g. If I input an invalid email address, do I get
an error?
Behat, Codeception, Selenium
14. TEST DRIVEN DEVELOPMENT (TDD)
Write tests first, then the code that’s being tested
Red-Green-Refactor
Red: Write a test - make it fail
Green: Make the test pass
Refactor: Tidy it up. It should still pass.
16. WHAT IS PHPSPEC?
A PHP Library
Similar to PHPUnit (but with a nicer API!)
Available through Composer (phpspec/phpspec)
Helps design your PHP Classes through
specifications
Describes the behaviour of the class before you
write it
No real difference between SpecBDD and TDD
21. “Users should be able to Register on the system.
They need a name, email and password to do so.”
- The Client
22. LET’S CODE THAT…
$input = Input::all();
$user = new User();
$user->name = $input['name'];
$user->email = $input['email'];
$user->password = Hash::make($input['password']);
$userRepository->save($user);
What’s going on here?
Is this testable?
Is it maintainable?
23. LET’S USE PHPSPEC TO HELP
vendor/bin/phpspec describe Acme/User
Specification for AcmeUser created in [dir]/spec/UserSpec.php.
namespace specAcme;
use PhpSpecObjectBehavior;
use ProphecyArgument;
class UserSpec extends ObjectBehavior
{
function it_is_initializable()
{
$this->shouldHaveType('AcmeUser');
}
}
24. RUN THE TEST!
$ vendor/bin/phpspec run
Acme/User
10 - it is initializable
class AcmeUser does not exist.
100%
1
1 specs
1 example (1 broken)
6ms
Do you want me to create `AcmeUser` for you?
[Y/n]
26. - The Client
WHAT THE CLIENT SAID
“Users should be able to Register on the system.
They need a name, email and password to do so.”
27. USE A CONSTRUCTOR
class UserSpec extends ObjectBehavior
{
function let()
{
$this->beConstructedWith('Darren Craig', 'darren@minus40.co', 'abc123');
}
function it_tests_a_users_can_be_registered()
{
$this->shouldHaveType('AcmeUser');
}
}
28. RUN THE TEST
$ vendor/bin/phpspec run
Acme/User
15 - it tests a users can be registered
method AcmeUser::__construct not found.
100% 1
1 specs
1 example (1 broken)
9ms
Do you want me to create `AcmeUser::__construct()` for you?
[Y/n]
Y
Method AcmeUser::__construct() has been created.
100% 1
1 specs
1 example (1 passed)
8ms
29. THE USER CLASS
class User
{
public function __construct($name, $email, $password)
{
// TODO: write logic here
}
}
30. RETURNING USER DETAILS
class UserSpec extends ObjectBehavior
{
// other tests…
function it_tests_that_it_can_return_a_name()
{
$this->getName()->shouldReturn('Darren Craig');
}
}
31. RUN THE TEST
$ vendor/bin/phpspec run
Acme/User
21 - it tests that it can return a name
method AcmeUser::getName not found.
50% 50% 2
1 specs
2 examples (1 passed, 1 broken)
11ms
Do you want me to create `AcmeUser::getName()` for you?
[Y/n]
Y
Method AcmeUser::getName() has been created.
Acme/User
21 - it tests that it can return a name
expected "Darren Craig", but got null.
50% 50% 2
1 specs
2 examples (1 passed, 1 failed)
12ms
32. MAKING IT PASS
class User
{
private $name;
public function __construct($name, $email, $password)
{
$this->name = $name;
}
public function getName()
{
return $this->name;
}
}
33. RUN THE TEST
$ vendor/bin/phpspec run
100% 2
1 specs
2 examples (2 passed)
7ms
34.
35. THE OTHER USER DETAILS…
function it_tests_that_it_can_return_a_name()
{
$this->getName()->shouldReturn('Darren Craig');
}
function it_tests_that_it_can_return_the_email_address()
{
$this->getEmail()->shouldReturn('darren@minus40.co');
}
function it_tests_that_it_can_return_the_password()
{
$this->getPassword()->shouldReturn('abc123');
}
36. REGISTERING A USER
$input = Input::all();
$user = new User($input['name'], $input['email'], $input['password']);
$userRepository->save($user);
But, our code should represent the behaviour
it’s carrying out…
Are we creating a new User? What are we doing?
37. - The Client
WHAT THE CLIENT SAID
“Users should be able to Register on the system.
They need a name, email and password to do so.”
38. REGISTERING USERS
$input = Input::all();
$user = User::register($input['name'], $input['email'], $input['password']);
$userRepository->save($user);
private function __construct($name, $email, $password) {}
public static function register($name, $email, $password)
{
return new static($name, $email, $password);
}
function let()
{
$this->beConstructedThrough(‘register',
['Darren Craig', 'darren@minus40.co', 'abc123']);
}
41. THE QUALIFICATION CLASS
$ vendor/bin/phpspec describe Acme/Qualification
Specification for AcmeQualification created in [dir]/spec/Acme/QualificationSpec.php.
$ vendor/bin/phpspec run
Acme/Qualification
10 - it is initializable
class AcmeQualification does not exist.
80% 20% 5
2 specs
5 examples (4 passed, 1 broken)
24ms
Do you want me to create `AcmeQualification` for you?
[Y/n]
Y
Class AcmeQualification created in [dir]/src/Acme/Qualification.php.
100% 5
2 specs
5 examples (5 passed)
9ms
42. MORE USER TESTS…
use AcmeQualification;
class UserSpec extends ObjectBehavior
{
function it_adds_a_qualification(Qualification $qualification)
{
$this->addQualification($qualification);
$this->getQualifications()->shouldHaveCount(1);
}
}
43. RUN AND CREATE THE METHODS
$ vendor/bin/phpspec run
Acme/User
36 - it adds a qualification
method AcmeUser::addQualification not found.
80% 20% 5
2 specs
5 examples (4 passed, 1 broken)
24ms
Do you want me to create `AcmeUser::addQualification()` for you?
[Y/n]
Y
Method AcmeUser::addQualification() has been created.
Acme/User
31 - it adds a qualification
method AcmeUser::getQualifications not found.
80% 20% 5
2 specs
5 examples (4 passed, 1 broken)
15ms
Do you want me to create `AcmeUser::getQualifications()` for you?
[Y/n]
Y
Method AcmeUser::getQualifications() has been created.
Acme/User
31 - it adds a qualification
no haveCount([array:1]) matcher found for null.
80% 20% 5
2 specs
5 examples (4 passed, 1 broken)
20ms
44. AND MAKE IT PASS…
class User
{
private $qualifications = [];
public function addQualification(Qualification $qualification)
{
$this->qualifications[] = $qualification;
}
public function getQualifications()
{
return $this->qualifications;
}
}
45. CHECK IF IT PASSED
$ vendor/bin/phpspec run
100% 5
2 specs
5 examples (5 passed)
14ms
47. NO PROBLEM - ANOTHER TEST
function it_prevents_more_than_3_qualifications_being_added(Qualification
$qualification)
{
$this->addQualification($qualification);
$this->addQualification($qualification);
$this->addQualification($qualification);
$this->shouldThrow(Exception::class)->duringAddQualification($qualification);
}
48. RUN IT
$ vendor/bin/phpspec run
Acme/User
37 - it prevents more than 3 qualifications being added
expected to get exception, none got.
83% 16% 6
2 specs
6 examples (5 passed, 1 failed)
21ms
49. AND MAKE IT PASS…
class User
{
private $qualifications = [];
public function addQualification(Qualification $qualification)
{
if(count($this->qualifications) === 3) {
throw new Exception("You can't add more than 3 qualifications");
}
$this->qualifications[] = $qualification;
}
}
56. OBJECT STATE MATCHERS
// calls $user->isOver18();
$this->shouldBeOver18();
// call $user->hasDOB();
$this->shouldHaveDOB();
A nice way of calling is* or has* methods on your object
60. MORE WORK… LESS TEARS
TDD encourages you to think first
Smaller, single-responsibility classes
More maintainable code
More robust systems
As your skill improves, so will your speed
Less likely to spend hours debugging