This document provides an introduction to ReactJS including what it is, its key features, and how it works. Some main points:
- ReactJS is a UI library built by Facebook that uses a virtual DOM to selectively update the browser DOM and improve performance.
- It allows building of interactive and reusable UI components in a declarative way.
- React uses a one-way data flow and unidirectional data binding which keeps complexity low.
- Components are the core building blocks and can be composed to build UIs in a modular way.
- The virtual DOM enables fast re-renders by only updating parts of the real DOM that changed.
This document provides an introduction to threads, events, and mutexes in C# classes. It begins with a basic example of creating a thread to call a method. Subsequent examples demonstrate passing delegate methods to threads, using the Sleep method to simulate multithreading, and accessing the CurrentThread property. The document also notes that the Thread class is sealed and cannot be inherited from.
This document discusses strategies for streamlining application architecture. It defines a large application as one requiring significant effort to maintain. Examples given include Gmail, Yahoo homepage, and MobileMe. Current architectures are described as having custom widgets, modules, MVC patterns and libraries coupled together. Problems identified include lack of reusability and tight coupling. The document proposes using a module pattern with loose coupling, a facade abstraction layer, and mediator pattern to improve maintainability. Modules would communicate through publishing events to the facade/mediator core rather than directly accessing each other.
There are several key differences between Silverlight and Flex:
- Silverlight uses XAML and .NET languages while Flex uses MXML and ActionScript. Silverlight code is compiled into .NET assemblies while Flex code is compiled into SWF files.
- Silverlight provides better performance through native execution on the CLR, while Flex has slower execution through the Flash virtual machine.
- Expression Blend is a more powerful editor than Flex Builder.
- Silverlight supports additional languages like C# and generics, while Flex only supports ActionScript.
- Silverlight provides better threading and asynchronous task support compared to Flex.
- Binding and layout are more complex in Silverlight compared to the easier
Have an upcoming technical interview for a junior front-end developer position at a company that uses AngularJS? Here are 29 AngularJS interview questions for you to practice with!
Building Large Scale Javascript ApplicationAnis Ahmad
In recent years a number of libraries for building large JavaScript applications has appeared. As we no longer need to battle DOM differences between browsers we can finally focus on building highly interactive front-end applications instead. But before we can do a good job with these new libraries we need unlearn our previous DOM-centric approach and need to be aware of good practices and patterns of developing modern javascript app.
It will start with jQuery based old style practices and try to discuss on how can we approach to a modular, decoupled, scalable application architecture. This slide was prepared in very short time for technical session series of Digital World 2014 (http://www.digitalworld.org.bd/technical-session). The event video is here - https://www.youtube.com/watch?v=Gpw7l27MUUc (slide was not properly covered in video).
It has taken inspiration, ideas (, even some contents) from the following sources -
* http://addyosmani.com/largescalejavascript/
* http://addyosmani.com/resources/essentialjsdesignpatterns/book/
* https://www.youtube.com/watch?v=vXjVFPosQHw
* https://www.youtube.com/watch?v=qWr7x9wk6_c
* https://speakerdeck.com/kimjoar/patterns-of-large-scale-javascript-applications-1
jQquerysummit - Large-scale JavaScript Application Architecture Jiby John
The document discusses organizing jQuery and JavaScript applications using different patterns and frameworks. It begins by explaining design patterns and their benefits. It then covers using the Model-View-Controller (MVC) pattern with jQuery, providing examples of MVC frameworks. Finally, it discusses other JavaScript patterns for organizing code into reusable modules.
Dependency injection is a technique where object dependencies are passed into the constructor rather than being created within the class. This removes distractions, allows dependencies to be configured externally, and decouples classes by removing hard-coded dependencies. A dependency injection container handles the complex wiring of dependencies to further simplify object creation code and improve testability.
This document provides an introduction to ReactJS including what it is, its key features, and how it works. Some main points:
- ReactJS is a UI library built by Facebook that uses a virtual DOM to selectively update the browser DOM and improve performance.
- It allows building of interactive and reusable UI components in a declarative way.
- React uses a one-way data flow and unidirectional data binding which keeps complexity low.
- Components are the core building blocks and can be composed to build UIs in a modular way.
- The virtual DOM enables fast re-renders by only updating parts of the real DOM that changed.
This document provides an introduction to threads, events, and mutexes in C# classes. It begins with a basic example of creating a thread to call a method. Subsequent examples demonstrate passing delegate methods to threads, using the Sleep method to simulate multithreading, and accessing the CurrentThread property. The document also notes that the Thread class is sealed and cannot be inherited from.
This document discusses strategies for streamlining application architecture. It defines a large application as one requiring significant effort to maintain. Examples given include Gmail, Yahoo homepage, and MobileMe. Current architectures are described as having custom widgets, modules, MVC patterns and libraries coupled together. Problems identified include lack of reusability and tight coupling. The document proposes using a module pattern with loose coupling, a facade abstraction layer, and mediator pattern to improve maintainability. Modules would communicate through publishing events to the facade/mediator core rather than directly accessing each other.
There are several key differences between Silverlight and Flex:
- Silverlight uses XAML and .NET languages while Flex uses MXML and ActionScript. Silverlight code is compiled into .NET assemblies while Flex code is compiled into SWF files.
- Silverlight provides better performance through native execution on the CLR, while Flex has slower execution through the Flash virtual machine.
- Expression Blend is a more powerful editor than Flex Builder.
- Silverlight supports additional languages like C# and generics, while Flex only supports ActionScript.
- Silverlight provides better threading and asynchronous task support compared to Flex.
- Binding and layout are more complex in Silverlight compared to the easier
Have an upcoming technical interview for a junior front-end developer position at a company that uses AngularJS? Here are 29 AngularJS interview questions for you to practice with!
Building Large Scale Javascript ApplicationAnis Ahmad
In recent years a number of libraries for building large JavaScript applications has appeared. As we no longer need to battle DOM differences between browsers we can finally focus on building highly interactive front-end applications instead. But before we can do a good job with these new libraries we need unlearn our previous DOM-centric approach and need to be aware of good practices and patterns of developing modern javascript app.
It will start with jQuery based old style practices and try to discuss on how can we approach to a modular, decoupled, scalable application architecture. This slide was prepared in very short time for technical session series of Digital World 2014 (http://www.digitalworld.org.bd/technical-session). The event video is here - https://www.youtube.com/watch?v=Gpw7l27MUUc (slide was not properly covered in video).
It has taken inspiration, ideas (, even some contents) from the following sources -
* http://addyosmani.com/largescalejavascript/
* http://addyosmani.com/resources/essentialjsdesignpatterns/book/
* https://www.youtube.com/watch?v=vXjVFPosQHw
* https://www.youtube.com/watch?v=qWr7x9wk6_c
* https://speakerdeck.com/kimjoar/patterns-of-large-scale-javascript-applications-1
jQquerysummit - Large-scale JavaScript Application Architecture Jiby John
The document discusses organizing jQuery and JavaScript applications using different patterns and frameworks. It begins by explaining design patterns and their benefits. It then covers using the Model-View-Controller (MVC) pattern with jQuery, providing examples of MVC frameworks. Finally, it discusses other JavaScript patterns for organizing code into reusable modules.
Dependency injection is a technique where object dependencies are passed into the constructor rather than being created within the class. This removes distractions, allows dependencies to be configured externally, and decouples classes by removing hard-coded dependencies. A dependency injection container handles the complex wiring of dependencies to further simplify object creation code and improve testability.
Introduction to Docker and Containers- Learning SimpleSandeep Hijam
Docker is an application that generates container images which allow microservices applications to be developed and run. A container image contains all the dependencies of an application. Microservices break applications into small, independent services that communicate via APIs. Docker is like a web server that runs container code. Containers are the actual application code, while Docker generates the container images and hosts the running containers. Microservices improve scalability and maintainability by separating functions into independently deployable services.
Presentation I gave at the Houston TechFest Sept 2009. This presentation goes over Extension Methods, Lambdas, Expression Trees, and Fluent Interfaces. I also show examples from popular frameworks using these techniques.
This presentation talks about the Dependency Injection design principle, providing an overview of the pattern and its benefits while showing examples on how to apply it using Autofac, a specific dependency injection tool for .NET development.
Autofac: http://code.google.com/p/autofac/
A book on DI: http://www.manning.com/seemann/
This document discusses the existing and proposed systems for a purchasing and correctional system. The existing system lacks secure user registration and profile management. It also does not provide intranet email between users or online data processing. The proposed system aims to automate processes, maintain user details securely, and provide a user-friendly interface. It utilizes various classes and database integration to make project management easier and more flexible overall.
Introduction to dependency injection in Scala (Play)Knoldus Inc.
In this session we will learn about what is Dependency injection in general, different types of dependency injection, what problem does it solve and why is it important and along with that we will see how Play framework allows us to implement dependency injection
This document provides summaries of key .NET concepts and technologies:
1. StringBuilder is more efficient than String for text manipulation as Strings are immutable and new instances are created with each operation, while StringBuilder allows in-place editing.
2. The main .NET types for data storage are arrays, which can only hold one data type, and hash tables like HashTable and SortedList which allow retrieval by key.
3. Exception handling in C# uses try-catch blocks, with catch optionally specifying the exception type. Finally blocks are always executed whether an exception occurs or not.
4. Namespaces and assemblies allow .NET applications to be modular and reference external libraries. Key namespaces include System and
The document summarizes principles of software development presented in three acts. Act I discusses the goal of balancing building the right thing with building it well. Act II outlines design guidelines like DRY, separation of concerns, and SOLID principles. Act III discusses verifying requirements through tests and practicing continuous improvement. The overarching message is that software should become more maintainable over time through managing technical debt and following best practices.
The document discusses the Swiz framework, an inversion of control (IoC) and dependency injection framework for Flex applications. It introduces concepts like IoC, dependency injection, view patterns like MVP, and how Swiz implements these patterns through annotations and metadata to simplify wiring of application components. The document also provides an overview of key Swiz features and how to get started using the framework in Flex applications.
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...Bill Buchan
Co-presented with Jens Augustini
Object Oriented Programming (OOP) may drastically reduce your coding time in projects that reach a higher degree of complexity, as it brings re-usable and consistent logic in the form of your own objects to your fingertips. This session will show how to create and use your own classes and how they can relate to the LotusScript Object Model. If you are familiar with LotusScript but don't know how to create your own classes, this session is for you!
Building Rich User Experiences Without JavaScript SpaghettiJared Faris
Jared Faris discusses how to build rich user experiences without messy JavaScript code. He advocates for decoupling JavaScript objects, writing small discrete chunks of code, and pushing events rather than state between objects. This avoids JavaScript spaghetti and promotes loose coupling between components. Design patterns like Mediator and Observer are useful, as are tools like Knockout and Backbone that help manage state, routing, and views. Testing discrete layers without HTML elements also helps produce clean, modular code.
This document discusses unit testing databases to minimize risks from changes. It explains how to set up unit testing projects in SQL Server Management Studio to test functions and stored procedures. It provides an example of a unit test for a function that checks username and password validity. The document emphasizes writing multiple tests to cover different scenarios and edge cases.
Lightening Talk I gave at Inaka in May 2014.
This is sort of the continuation of my previous iOS TDD talk.
Since TDD and DI go quite hand in hand and they are both extend concepts to learn in one shot, I had to prepare a completely separated talk for spreading to my fellows the DI knowledge I had acquired.
Elements of DDD with ASP.NET MVC & Entity Framework Code FirstEnea Gabriel
The document discusses elements of Domain-Driven Design (DDD) when building applications with ASP.NET MVC and Entity Framework Code First. It emphasizes modeling the application around the business domain, using tools like EF Code First and dependency injection frameworks to decouple layers and enable unit testing. The presentation provides an overview of DDD concepts and techniques for applying them with ASP.NET MVC and EF Code First to build loosely coupled, testable architectures focused on the business domain.
The document provides an introduction to the Spring Framework, which is an Inversion of Control container and utilities that provide a consistent API for technologies like JDBC, ORM, AOP, and transactions. It discusses what dependency injection and inversion of control are, how Spring implements them through a configuration file and application context, and some of the other technologies Spring supports like JDBC, Hibernate, transactions, AOP, and web services. It also provides some resources for more information on Spring.
The document provides an overview of unit testing and dependency injection using Entity Framework. It discusses how to achieve true unit testing through dependency injection and mocking dependencies. It provides examples of how to set up interfaces, manager classes, context classes and writing unit tests using Rhino Mocks and MSTest. Code coverage is also discussed as an important part of unit testing.
Once upon a time, choosing a framework for your Flash or Flex project was easy. You either used Cairngorm or you didn't. Then along came PureMVC, followed by Mate, Parsley, Robotlegs, Swiz, Sping Actionscript and many more. Getting to know all these frameworks takes a long time. Making a choice of which to use may take even longer.
In this session Richard will use his experience developing with and recommending frameworks to help you make that choice. Richard will talk about the features that you need to consider when choosing a framework, he'll discuss the key differences between the various frameworks available, and he'll tell you how to know when you've made the right choice.
And, he will try to answer the question of which framework is best.
Introduction to Docker and Containers- Learning SimpleSandeep Hijam
Docker is an application that generates container images which allow microservices applications to be developed and run. A container image contains all the dependencies of an application. Microservices break applications into small, independent services that communicate via APIs. Docker is like a web server that runs container code. Containers are the actual application code, while Docker generates the container images and hosts the running containers. Microservices improve scalability and maintainability by separating functions into independently deployable services.
Presentation I gave at the Houston TechFest Sept 2009. This presentation goes over Extension Methods, Lambdas, Expression Trees, and Fluent Interfaces. I also show examples from popular frameworks using these techniques.
This presentation talks about the Dependency Injection design principle, providing an overview of the pattern and its benefits while showing examples on how to apply it using Autofac, a specific dependency injection tool for .NET development.
Autofac: http://code.google.com/p/autofac/
A book on DI: http://www.manning.com/seemann/
This document discusses the existing and proposed systems for a purchasing and correctional system. The existing system lacks secure user registration and profile management. It also does not provide intranet email between users or online data processing. The proposed system aims to automate processes, maintain user details securely, and provide a user-friendly interface. It utilizes various classes and database integration to make project management easier and more flexible overall.
Introduction to dependency injection in Scala (Play)Knoldus Inc.
In this session we will learn about what is Dependency injection in general, different types of dependency injection, what problem does it solve and why is it important and along with that we will see how Play framework allows us to implement dependency injection
This document provides summaries of key .NET concepts and technologies:
1. StringBuilder is more efficient than String for text manipulation as Strings are immutable and new instances are created with each operation, while StringBuilder allows in-place editing.
2. The main .NET types for data storage are arrays, which can only hold one data type, and hash tables like HashTable and SortedList which allow retrieval by key.
3. Exception handling in C# uses try-catch blocks, with catch optionally specifying the exception type. Finally blocks are always executed whether an exception occurs or not.
4. Namespaces and assemblies allow .NET applications to be modular and reference external libraries. Key namespaces include System and
The document summarizes principles of software development presented in three acts. Act I discusses the goal of balancing building the right thing with building it well. Act II outlines design guidelines like DRY, separation of concerns, and SOLID principles. Act III discusses verifying requirements through tests and practicing continuous improvement. The overarching message is that software should become more maintainable over time through managing technical debt and following best practices.
The document discusses the Swiz framework, an inversion of control (IoC) and dependency injection framework for Flex applications. It introduces concepts like IoC, dependency injection, view patterns like MVP, and how Swiz implements these patterns through annotations and metadata to simplify wiring of application components. The document also provides an overview of key Swiz features and how to get started using the framework in Flex applications.
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...Bill Buchan
Co-presented with Jens Augustini
Object Oriented Programming (OOP) may drastically reduce your coding time in projects that reach a higher degree of complexity, as it brings re-usable and consistent logic in the form of your own objects to your fingertips. This session will show how to create and use your own classes and how they can relate to the LotusScript Object Model. If you are familiar with LotusScript but don't know how to create your own classes, this session is for you!
Building Rich User Experiences Without JavaScript SpaghettiJared Faris
Jared Faris discusses how to build rich user experiences without messy JavaScript code. He advocates for decoupling JavaScript objects, writing small discrete chunks of code, and pushing events rather than state between objects. This avoids JavaScript spaghetti and promotes loose coupling between components. Design patterns like Mediator and Observer are useful, as are tools like Knockout and Backbone that help manage state, routing, and views. Testing discrete layers without HTML elements also helps produce clean, modular code.
This document discusses unit testing databases to minimize risks from changes. It explains how to set up unit testing projects in SQL Server Management Studio to test functions and stored procedures. It provides an example of a unit test for a function that checks username and password validity. The document emphasizes writing multiple tests to cover different scenarios and edge cases.
Lightening Talk I gave at Inaka in May 2014.
This is sort of the continuation of my previous iOS TDD talk.
Since TDD and DI go quite hand in hand and they are both extend concepts to learn in one shot, I had to prepare a completely separated talk for spreading to my fellows the DI knowledge I had acquired.
Elements of DDD with ASP.NET MVC & Entity Framework Code FirstEnea Gabriel
The document discusses elements of Domain-Driven Design (DDD) when building applications with ASP.NET MVC and Entity Framework Code First. It emphasizes modeling the application around the business domain, using tools like EF Code First and dependency injection frameworks to decouple layers and enable unit testing. The presentation provides an overview of DDD concepts and techniques for applying them with ASP.NET MVC and EF Code First to build loosely coupled, testable architectures focused on the business domain.
The document provides an introduction to the Spring Framework, which is an Inversion of Control container and utilities that provide a consistent API for technologies like JDBC, ORM, AOP, and transactions. It discusses what dependency injection and inversion of control are, how Spring implements them through a configuration file and application context, and some of the other technologies Spring supports like JDBC, Hibernate, transactions, AOP, and web services. It also provides some resources for more information on Spring.
The document provides an overview of unit testing and dependency injection using Entity Framework. It discusses how to achieve true unit testing through dependency injection and mocking dependencies. It provides examples of how to set up interfaces, manager classes, context classes and writing unit tests using Rhino Mocks and MSTest. Code coverage is also discussed as an important part of unit testing.
Once upon a time, choosing a framework for your Flash or Flex project was easy. You either used Cairngorm or you didn't. Then along came PureMVC, followed by Mate, Parsley, Robotlegs, Swiz, Sping Actionscript and many more. Getting to know all these frameworks takes a long time. Making a choice of which to use may take even longer.
In this session Richard will use his experience developing with and recommending frameworks to help you make that choice. Richard will talk about the features that you need to consider when choosing a framework, he'll discuss the key differences between the various frameworks available, and he'll tell you how to know when you've made the right choice.
And, he will try to answer the question of which framework is best.
Similar to Dependency Injection Lightning Talk (20)
Artificia Intellicence and XPath Extension FunctionsOctavian Nadolu
The purpose of this presentation is to provide an overview of how you can use AI from XSLT, XQuery, Schematron, or XML Refactoring operations, the potential benefits of using AI, and some of the challenges we face.
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...kalichargn70th171
A dynamic process unfolds in the intricate realm of software development, dedicated to crafting and sustaining products that effortlessly address user needs. Amidst vital stages like market analysis and requirement assessments, the heart of software development lies in the meticulous creation and upkeep of source code. Code alterations are inherent, challenging code quality, particularly under stringent deadlines.
What is Augmented Reality Image Trackingpavan998932
Augmented Reality (AR) Image Tracking is a technology that enables AR applications to recognize and track images in the real world, overlaying digital content onto them. This enhances the user's interaction with their environment by providing additional information and interactive elements directly tied to physical images.
Microservice Teams - How the cloud changes the way we workSven Peters
A lot of technical challenges and complexity come with building a cloud-native and distributed architecture. The way we develop backend software has fundamentally changed in the last ten years. Managing a microservices architecture demands a lot of us to ensure observability and operational resiliency. But did you also change the way you run your development teams?
Sven will talk about Atlassian’s journey from a monolith to a multi-tenanted architecture and how it affected the way the engineering teams work. You will learn how we shifted to service ownership, moved to more autonomous teams (and its challenges), and established platform and enablement teams.
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsPeter Muessig
The UI5 tooling is the development and build tooling of UI5. It is built in a modular and extensible way so that it can be easily extended by your needs. This session will showcase various tooling extensions which can boost your development experience by far so that you can really work offline, transpile your code in your project to use even newer versions of EcmaScript (than 2022 which is supported right now by the UI5 tooling), consume any npm package of your choice in your project, using different kind of proxies, and even stitching UI5 projects during development together to mimic your target environment.
Odoo ERP software
Odoo ERP software, a leading open-source software for Enterprise Resource Planning (ERP) and business management, has recently launched its latest version, Odoo 17 Community Edition. This update introduces a range of new features and enhancements designed to streamline business operations and support growth.
The Odoo Community serves as a cost-free edition within the Odoo suite of ERP systems. Tailored to accommodate the standard needs of business operations, it provides a robust platform suitable for organisations of different sizes and business sectors. Within the Odoo Community Edition, users can access a variety of essential features and services essential for managing day-to-day tasks efficiently.
This blog presents a detailed overview of the features available within the Odoo 17 Community edition, and the differences between Odoo 17 community and enterprise editions, aiming to equip you with the necessary information to make an informed decision about its suitability for your business.
May Marketo Masterclass, London MUG May 22 2024.pdfAdele Miller
Can't make Adobe Summit in Vegas? No sweat because the EMEA Marketo Engage Champions are coming to London to share their Summit sessions, insights and more!
This is a MUG with a twist you don't want to miss.
DDS Security Version 1.2 was adopted in 2024. This revision strengthens support for long runnings systems adding new cryptographic algorithms, certificate revocation, and hardness against DoS attacks.
Flutter is a popular open source, cross-platform framework developed by Google. In this webinar we'll explore Flutter and its architecture, delve into the Flutter Embedder and Flutter’s Dart language, discover how to leverage Flutter for embedded device development, learn about Automotive Grade Linux (AGL) and its consortium and understand the rationale behind AGL's choice of Flutter for next-gen IVI systems. Don’t miss this opportunity to discover whether Flutter is right for your project.
Transform Your Communication with Cloud-Based IVR SolutionsTheSMSPoint
Discover the power of Cloud-Based IVR Solutions to streamline communication processes. Embrace scalability and cost-efficiency while enhancing customer experiences with features like automated call routing and voice recognition. Accessible from anywhere, these solutions integrate seamlessly with existing systems, providing real-time analytics for continuous improvement. Revolutionize your communication strategy today with Cloud-Based IVR Solutions. Learn more at: https://thesmspoint.com/channel/cloud-telephony
Do you want Software for your Business? Visit Deuglo
Deuglo has top Software Developers in India. They are experts in software development and help design and create custom Software solutions.
Deuglo follows seven steps methods for delivering their services to their customers. They called it the Software development life cycle process (SDLC).
Requirement — Collecting the Requirements is the first Phase in the SSLC process.
Feasibility Study — after completing the requirement process they move to the design phase.
Design — in this phase, they start designing the software.
Coding — when designing is completed, the developers start coding for the software.
Testing — in this phase when the coding of the software is done the testing team will start testing.
Installation — after completion of testing, the application opens to the live server and launches!
Maintenance — after completing the software development, customers start using the software.
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j
Dr. Jesús Barrasa, Head of Solutions Architecture for EMEA, Neo4j
Découvrez les dernières innovations de Neo4j, et notamment les dernières intégrations cloud et les améliorations produits qui font de Neo4j un choix essentiel pour les développeurs qui créent des applications avec des données interconnectées et de l’IA générative.
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j
Dr. Jesús Barrasa, Head of Solutions Architecture for EMEA, Neo4j
Découvrez les dernières innovations de Neo4j, et notamment les dernières intégrations cloud et les améliorations produits qui font de Neo4j un choix essentiel pour les développeurs qui créent des applications avec des données interconnectées et de l’IA générative.
Zoom is a comprehensive platform designed to connect individuals and teams efficiently. With its user-friendly interface and powerful features, Zoom has become a go-to solution for virtual communication and collaboration. It offers a range of tools, including virtual meetings, team chat, VoIP phone systems, online whiteboards, and AI companions, to streamline workflows and enhance productivity.
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxrickgrimesss22
Discover the essential features to incorporate in your Winzo clone app to boost business growth, enhance user engagement, and drive revenue. Learn how to create a compelling gaming experience that stands out in the competitive market.
2. Here’s the absolute worst explanation ever:
”Instead of newing up objects, you just call ‘container.resolve’”
3. With the definition of, “just call container.Resolve instead of newing an
object up”, when you go to a job interview and whiteboard some pseudo-
code, they might say something like:
Pretty sure this
guy voted ‘NO’
on hiring me…
4. Merriam Webster Dictionary: “something that is dependent on something else”
For example: “A time-traveling DeLorean’s dependency on plutonium was a real
problem in 1955.”
Wikipedia’s definition relative to computer science: “[A dependency is a] coupling,
a state in which one object uses a function of another object.”
For example: My app needs to make calls to a web service to get and store data, so my
business logic has a dependency on the web service.
When you have a “coupling” of two classes, a loose coupling is the way to go in order to
make your code more testable and maintainable for the future.
5. 3 common types of dependency injection:
Setter Injection
Dependencies are injected through specific property setters. I have never seen this in the wild.
Interface Injection
Classes with dependencies implement an interface that exposes a setter method, and
dependencies use this to inject themselves into any class passed to it. I have never seen this in
the wild.
Constructor Injection
Yaaaaaaay! Winner winner!! Dependencies are injected through the class constructor. This is the
only method I’ve seen in the wild.
7. We want ALL of our dependencies to be based on an interface.
Any service code you write should have an interface. Other classes in your app
will rely only on the interface… Not the “concrete” implementation of the
interface.
You will definitely run into situations where some 3rd party code does not provide
an interface (Microsoft’s HttpClient class, as a ubiquitous for-instance).
Never give up… Never surrender! There are ways to create wrappers for such classes
which keep the vast majority of your code testable and loosely coupled. True story!
8. Before DI After DI
You’ll notice you use the “new”
keyword a WHOLE lot less when
using Dependency Injection.
9. When I finally learned how to use dependency injection, I still had no clue WHY
we were using it. All I knew was that some highly paid consultants said to do it,
and that was that.
The two most important reasons to use “DI” (Dependency Injection):
Makes it super-mega-monster-easy to unit test code without insanely complicated
setups.
Caveat: As long as you learn how to use mocks when unit testing. On Luxor, we use MOQ, which
I would absolutely recommend.
Another popular mocking framework for .NET: NSubstitute
Promotes writing code where various services (aka ‘dependencies’) your code requires
can be loosely coupled with your code.
10. The container is at the very heart of your DI implementation.
Interfaces are mapped to concrete types, so that the container can provide the
correct implementation when an interface is requested.
Containers typically allow you to specify the “lifetime” of any object it knows
about. You can have a singleton, one instance per thread, and more.
Containers map views to viewModels in the MVVM design pattern (used in UWP,
WPF, and Xamarin.Forms apps, for example).
The container is the thing that will new up all of your services, views, and
viewModels as they are needed.
11. The magic: When you need some service in a class, you just add the interface to
its constructor, and the container magically will provide it!
No… SERIOUSLY. It’s kind of amazing!!
12. How does the
container know what
concrete types to
provide for your
interfaces?
How does the
container know which
views go with which
viewModels?
Answer:
Registration!
13. Notice that ALL of the constructor parameters are interface types.
When we discover we need a new service, we can just add it to the constructor,
and our DI container takes care of injecting it (thanks to the registration).
Note: Yes, there might be a code smell of too many dependencies in this ViewModel, but
that’s not important right now.
14. The ViewModel from the previous slide has SEVEN dependencies. That would be
a TON of overhead if they were all concrete classes, and LOTS of integration
concerns to worry about when it came to testing!
Instead, we just mock, mock, mock all our problems away!
16. Infinitely easier (and possible!) unit testing of code.
Loosely coupled software.
While DI is complex, the alternative is even MORE complex!
Just ask for whatever services you want in a constructor, and your DI container
will “make it so”!
No complications about whether a class is a singleton or not… You already took
care of that when you registered the class with the container.
As long as the container knows about the interface and the concrete class you
want to implement it with, you’re all set.
Swap out implementations of interfaces (demo mode, anyone??).