The document provides an overview of the Objective-C runtime and how it can be used in practice. It begins with introductions and then covers key topics like what the runtime is, how it supports object-oriented features in Objective-C, and how Foundation provides a simpler interface to interact with the runtime. It then demonstrates various runtime capabilities like dealing with classes, protocols, messages, and dynamic messaging. It also covers more advanced techniques like lazy method resolution, forwarding, swizzling, dynamic class generation, and property generation. Code examples are provided to demonstrate many of these runtime features in practice.
The presentation helps us in understanding the different concepts associated with TypeScript. What is TypeScript? Why is TypeScript used and the different applications of TypeScript. For more information you can simply visit: http://mobile.folio3.com/
JavaScript - An Introduction is a beginner's guide to JavaScript. It starts with very basic level and goes to intermediate level. You'll be introduced with every language constructs, Event handling, Form handling and AJAX which is supported by JavaScript with XMLHttpRequest object. This XHR object is discussed in enough detail so that you can understand how the underlying AJAX functionality works in jQuery. At the end it discusses advance concepts and library build on/around JavaScript.
The presentation helps us in understanding the different concepts associated with TypeScript. What is TypeScript? Why is TypeScript used and the different applications of TypeScript. For more information you can simply visit: http://mobile.folio3.com/
JavaScript - An Introduction is a beginner's guide to JavaScript. It starts with very basic level and goes to intermediate level. You'll be introduced with every language constructs, Event handling, Form handling and AJAX which is supported by JavaScript with XMLHttpRequest object. This XHR object is discussed in enough detail so that you can understand how the underlying AJAX functionality works in jQuery. At the end it discusses advance concepts and library build on/around JavaScript.
Microsoft Typescript is a statically typed compiled language to clean and a simple plain old JavaScript code which runs on any browser, in Node.js or in any JavaScript engine that supports ECMAScript 3 (or newer).
Presentation by Dr. Cliff Click, Jr. Mention Java performance to a C hacker, or vice versa, and a flame war will surely ensue. The Web is full of broken benchmarks and crazy claims about Java and C performance. This session will aim to give a fair(er) comparison between the languages, striving to give a balanced view of each language's various strengths and weaknesses. It will also point out what's broken about many of the Java-versus-C Websites, so when you come across one, you can see the flaws and know that the Website isn't telling you what it (generally) claims to be telling you. (It's surely telling you "something," but almost just as surely is "not realistically" telling you why X is better than Y).
There are several JavaScript libraries available in the world of web programming. And, as the usage and complexity is increasing day by day, sometimes it becomes very difficult and confusing to understand and create modules using those libraries, especially for those having strong background of Object Oriented Languages.
So this one hour session will make an effort to go into the very basics of JavaScript and put a base for writing modular JavaScript code.
Not so long ago Microsoft announced a new language trageting on front-end developers. Everybody's reaction was like: Why?!! Is it just Microsoft darting back to Google?!
So, why a new language? JavaScript has its bad parts. Mostly you can avoid them or workaraund. You can emulate class-based OOP style, modules, scoping and even run-time typing. But that is doomed to be clumsy. That's not in the language design. Google has pointed out these flaws, provided a new language and failed. Will the story of TypeScript be any different?
Unit Testing in Javascript
The way to quality product isn't easy or simple but it is reachable. One of the key things to do is unit testing. What, when and how to do it --> read in the presentation.
See more details here: http://www.slideshare.net/AnnaKhabibullina/jsfwdays-2014unittesingjavascriptv4-33966202
Read about this and other techtalks @ DA-14 in our blog: http://da-14.com/our-blog/
Part I of a presentation on Advanced Concepts in JavaScript. Cover topics like: objects, functions, closures, inheritance, new platform features, and much more.
Read more: http://luisatencio.net
This is an interactive PowerPoint presentation I made for my seminar at my workplace. It talks and illustrates how the JavaScript engine works when executing code. It also contains a step-by-step animation which demonstrates the usage of the JavaScript event loop.
Feel free to use and refer content. Copyrights reserved.
A presentation discussing the benefits of VBScripting in today's even with the advent of PowerShell. This presentation also discusses building an HTA for your VBScripts and accessing WMI and AD information.
JavaScript basics
JavaScript event loop
Ajax and promises
DOM interaction
JavaScript object orientation
Web Workers
Useful Microframeworks
This presentation has been developed in the context of the Mobile Applications Development course, DISIM, University of L'Aquila (Italy), Spring 2015.
http://www.ivanomalavolta.com
Microsoft Typescript is a statically typed compiled language to clean and a simple plain old JavaScript code which runs on any browser, in Node.js or in any JavaScript engine that supports ECMAScript 3 (or newer).
Presentation by Dr. Cliff Click, Jr. Mention Java performance to a C hacker, or vice versa, and a flame war will surely ensue. The Web is full of broken benchmarks and crazy claims about Java and C performance. This session will aim to give a fair(er) comparison between the languages, striving to give a balanced view of each language's various strengths and weaknesses. It will also point out what's broken about many of the Java-versus-C Websites, so when you come across one, you can see the flaws and know that the Website isn't telling you what it (generally) claims to be telling you. (It's surely telling you "something," but almost just as surely is "not realistically" telling you why X is better than Y).
There are several JavaScript libraries available in the world of web programming. And, as the usage and complexity is increasing day by day, sometimes it becomes very difficult and confusing to understand and create modules using those libraries, especially for those having strong background of Object Oriented Languages.
So this one hour session will make an effort to go into the very basics of JavaScript and put a base for writing modular JavaScript code.
Not so long ago Microsoft announced a new language trageting on front-end developers. Everybody's reaction was like: Why?!! Is it just Microsoft darting back to Google?!
So, why a new language? JavaScript has its bad parts. Mostly you can avoid them or workaraund. You can emulate class-based OOP style, modules, scoping and even run-time typing. But that is doomed to be clumsy. That's not in the language design. Google has pointed out these flaws, provided a new language and failed. Will the story of TypeScript be any different?
Unit Testing in Javascript
The way to quality product isn't easy or simple but it is reachable. One of the key things to do is unit testing. What, when and how to do it --> read in the presentation.
See more details here: http://www.slideshare.net/AnnaKhabibullina/jsfwdays-2014unittesingjavascriptv4-33966202
Read about this and other techtalks @ DA-14 in our blog: http://da-14.com/our-blog/
Part I of a presentation on Advanced Concepts in JavaScript. Cover topics like: objects, functions, closures, inheritance, new platform features, and much more.
Read more: http://luisatencio.net
This is an interactive PowerPoint presentation I made for my seminar at my workplace. It talks and illustrates how the JavaScript engine works when executing code. It also contains a step-by-step animation which demonstrates the usage of the JavaScript event loop.
Feel free to use and refer content. Copyrights reserved.
A presentation discussing the benefits of VBScripting in today's even with the advent of PowerShell. This presentation also discusses building an HTA for your VBScripts and accessing WMI and AD information.
JavaScript basics
JavaScript event loop
Ajax and promises
DOM interaction
JavaScript object orientation
Web Workers
Useful Microframeworks
This presentation has been developed in the context of the Mobile Applications Development course, DISIM, University of L'Aquila (Italy), Spring 2015.
http://www.ivanomalavolta.com
JavaScript basics
JavaScript event loop
Ajax and promises
DOM interaction
JavaScript object orientation
Web Workers
Useful Microframeworks
This presentation has been developed in the context of the Mobile Applications Development course, DISIM, University of L'Aquila (Italy), Spring 2014.
http://www.ivanomalavolta.com
Adding a modern twist to legacy web applicationsJeff Durta
Avoid misery of working with legacy code
We will see how you can add independent and isolated components to existing pages; pages that may be difficult to change
React and Flux allow you to make self-contained additions that handle their own data access/persistence
JavaScript and popular programming paradigms (OOP, AOP, FP, DSL). Overview of the language to see what tools we can leverage to reduce complexity of our projects.
This part goes over language features and looks at OOP and AOP with JavaScript.
The presentation was delivered at ClubAJAX on 2/2/2010.
Blog post: http://lazutkin.com/blog/2010/feb/5/exciting-js-1/
Continued in Part II: http://www.slideshare.net/elazutkin/exciting-javascript-part-ii
Of complicacy of programming, or won't C# save us?PVS-Studio
Programming is hard. I hope no one would argue that. But the topic of new programming languages, or more exactly, search of a "silver bullet" is always highly popular with software developers. The most "trendy" topic currently is superiority of one programming language over the other. For instance, C# is "cooler" than C++. Although holy wars are not the reason why I'm writing this post, still it is a "sore subject" for me. Oh, come on, C#/lisp/F#/Haskell/... won't let you write a smart application that would interact with the outer world and that's all. All the elegance will disappear as soon as you decide to write some real soft and not a sample "in itself".
Every now and then, we have to write articles about how we've checked another fresh version of some compiler. That's not really much fun. However, as practice shows, if we stop doing that for a while, folks start doubting whether PVS-Studio is worth its title of a good catcher of bugs and vulnerabilities. What if the new compiler can do that too? Sure, compilers evolve, but so does PVS-Studio – and it proves, again and again, its ability to catch bugs even in high-quality projects such as compilers.
Après avoir fait ce talk à la conférence NSSpain, Simone Civetta va nous expliquer sur quelles métriques il est possible de se baser pour évaluer la qualité d’un code source. Cette question étant toujours sujette à débat, préparez vos arguments !
This presentation was part of the CocoaHeadsBE session on Nov 27th, 2014 at the iCapps offices in Antwerp, Belgium.
You can find the examples here: https://github.com/Inferis/Practical-AutoLayout
These the slides of a lighting talk I gave at NSSpain 2014.
Unfortunately, PDFs cannot contain GIFs, so this presentation is actually pretty bland. ;)
You can download the Deckset source with included GIFS here: http://cl.ly/3l2l1U0S2m2O
Elevating Tactical DDD Patterns Through Object CalisthenicsDorra BARTAGUIZ
After immersing yourself in the blue book and its red counterpart, attending DDD-focused conferences, and applying tactical patterns, you're left with a crucial question: How do I ensure my design is effective? Tactical patterns within Domain-Driven Design (DDD) serve as guiding principles for creating clear and manageable domain models. However, achieving success with these patterns requires additional guidance. Interestingly, we've observed that a set of constraints initially designed for training purposes remarkably aligns with effective pattern implementation, offering a more ‘mechanical’ approach. Let's explore together how Object Calisthenics can elevate the design of your tactical DDD patterns, offering concrete help for those venturing into DDD for the first time!
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties – USA
Expansion of bot farms – how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks – Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
PHP Frameworks: I want to break free (IPC Berlin 2024)Ralf Eggert
In this presentation, we examine the challenges and limitations of relying too heavily on PHP frameworks in web development. We discuss the history of PHP and its frameworks to understand how this dependence has evolved. The focus will be on providing concrete tips and strategies to reduce reliance on these frameworks, based on real-world examples and practical considerations. The goal is to equip developers with the skills and knowledge to create more flexible and future-proof web applications. We'll explore the importance of maintaining autonomy in a rapidly changing tech landscape and how to make informed decisions in PHP development.
This talk is aimed at encouraging a more independent approach to using PHP frameworks, moving towards a more flexible and future-proof approach to PHP development.
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfPeter Spielvogel
Building better applications for business users with SAP Fiori.
• What is SAP Fiori and why it matters to you
• How a better user experience drives measurable business benefits
• How to get started with SAP Fiori today
• How SAP Fiori elements accelerates application development
• How SAP Build Code includes SAP Fiori tools and other generative artificial intelligence capabilities
• How SAP Fiori paves the way for using AI in SAP apps
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™UiPathCommunity
In questo evento online gratuito, organizzato dalla Community Italiana di UiPath, potrai esplorare le nuove funzionalità di Autopilot, il tool che integra l'Intelligenza Artificiale nei processi di sviluppo e utilizzo delle Automazioni.
📕 Vedremo insieme alcuni esempi dell'utilizzo di Autopilot in diversi tool della Suite UiPath:
Autopilot per Studio Web
Autopilot per Studio
Autopilot per Apps
Clipboard AI
GenAI applicata alla Document Understanding
👨🏫👨💻 Speakers:
Stefano Negro, UiPath MVPx3, RPA Tech Lead @ BSP Consultant
Flavio Martinelli, UiPath MVP 2023, Technical Account Manager @UiPath
Andrei Tasca, RPA Solutions Team Lead @NTT Data
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
In today's fast-changing business world, Companies that adapt and embrace new ideas often need help to keep up with the competition. However, fostering a culture of innovation takes much work. It takes vision, leadership and willingness to take risks in the right proportion. Sachin Dev Duggal, co-founder of Builder.ai, has perfected the art of this balance, creating a company culture where creativity and growth are nurtured at each stage.
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
Securing your Kubernetes cluster_ a step-by-step guide to success !KatiaHIMEUR1
Today, after several years of existence, an extremely active community and an ultra-dynamic ecosystem, Kubernetes has established itself as the de facto standard in container orchestration. Thanks to a wide range of managed services, it has never been so easy to set up a ready-to-use Kubernetes cluster.
However, this ease of use means that the subject of security in Kubernetes is often left for later, or even neglected. This exposes companies to significant risks.
In this talk, I'll show you step-by-step how to secure your Kubernetes cluster for greater peace of mind and reliability.
Transcript: Selling digital books in 2024: Insights from industry leaders - T...BookNet Canada
The publishing industry has been selling digital audiobooks and ebooks for over a decade and has found its groove. What’s changed? What has stayed the same? Where do we go from here? Join a group of leading sales peers from across the industry for a conversation about the lessons learned since the popularization of digital books, best practices, digital book supply chain management, and more.
Link to video recording: https://bnctechforum.ca/sessions/selling-digital-books-in-2024-insights-from-industry-leaders/
Presented by BookNet Canada on May 28, 2024, with support from the Department of Canadian Heritage.
UiPath Test Automation using UiPath Test Suite series, part 3DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 3. In this session, we will cover desktop automation along with UI automation.
Topics covered:
UI automation Introduction,
UI automation Sample
Desktop automation flow
Pradeep Chinnala, Senior Consultant Automation Developer @WonderBotz and UiPath MVP
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
4. I love...
‣ ... my wife
‣ ... my 4 kids
‣ ... to code
‣ ... to play a game of squash
‣ ... good beer
5. I open sourced...
... some code:
‣ IIViewDeckController: “An
implementation of the
sliding functionality found in
the Path 2.0 or Facebook
iOS apps.”
‣ IIDateExtensions
‣ IIPopoverStatusItem
See: http://github.com/inferis
6. I made...
... some apps:
Butane
http://getbutane.com
Hi, @10to1!
Drash
http://dra.sh
10. Runtime WHUT?
‣ obj-c runtime is "always present"
‣ You can't use Objective-c without the runtime.
‣ Works behind the scenes:
‣ most developers aren't even aware it is there
and that they’r using it
‣ puts the objective in Objective-C
‣ implemented as dynamic shared library
‣ loaded by default by the OS
11. Runtime WHUT?
‣ Supports the most important features of
the language
‣ object oriented
‣ messaging
‣ protocols
‣ dynamic typing
‣ forwarding
12. Foundation
‣ is a support framework
‣ included by default
‣ The Foundation framework defines a base layer of
Objective-C classes.
‣ a set of useful primitive object classes (NSObject,
NSProxy, …)
‣ introduces several paradigms that define functionality
not covered by the Objective-C language.
‣ reflection
‣ memory management
‣ archiving
13. C + Runtime = Obj-C
‣ The runtime is what makes objective-c.
‣ The runtime is the implementation of the
syntactic "objective" sugar on top of c
‣ You can write any cocoa program
using pure C, but it's hard and
verbose.
15. In practice
‣ runtime.h overview
‣ Foundation.h, the “simple” stuff
‣ runtime.h, the “spicy” stuff
16. runtime.h
‣ #import <objc/runtime.h>
‣ a number of C functions to interact with the runtime
‣ Several “categories” of interactions
‣ objc_... interact with toplevel runtime (eg register a class)
‣ class_... interact with classes (eg make subclass)
‣ object_... interact with objects (eg get classname)
‣ method_... interact with methods (eg get the number of arguments)
‣ ivar_... interact with ivars (eg get the type of an ivar)
‣ property_... interact with properties (eg get the name of a property)
‣ protocol_... interact with protocols (eg get properties of a protocol)
‣ sel_... interact with selectors (eg register selector names)
‣ imp_... interact with method implementations (provide implementations
using blocks)
18. Foundation.h to the rescue
‣ The Foundation library provides an obj-c
interface to some of the runtime calls.
#include <Foundation/Foundation.h>
‣ Check your .pch file: it should be there
‣ iOS: directly
‣ OSX: via #include <Cocoa.h>.
19. Foundation.h to the rescue
‣ NSObject:
‣
-‐(BOOL)isKindOfClass:(Class)class;
‣
-‐(Class)class;
‣ Functions:
‣
NSString* NSStringFromClass(Class aClass);
‣
Class NSSelectorFromString(NSString* aSelectorName);
20. Dealing with classes
‣ + (Class)class;
‣ Returns self (the class object). Since this is a
class object, it returns the class itself.
‣ + (Class)superclass;
‣ Returns the class object for the receiver’s
superclass. Gets the parent class of a given
class.
‣ + (BOOL)isSubclassOfClass:(Class)aClass;
‣ Returns a Boolean value that indicates whether
the receiving class is a subclass of, or identical
to, a given class.
22. Dealing with classes
‣ -‐ (BOOL)isKindOfClass:(Class)aClass;
‣ Returns a Boolean value that indicates whether
the receiver is an instance of given class or an
instance of any class that inherits from that class.
‣ -‐ (BOOL)isMemberOfClass:(Class)aClass;
‣ Returns a Boolean value that indicates whether
the receiver is an instance of a given class.
‣ These are not the same!
‣ isKindOfClass also works on subclass instances
‣ isMemberOfClass only works on exact class
instances
24. Protocols
‣ -‐ (BOOL)conformsToProtocol:(Protocol *)aProtocol;
‣ Returns a Boolean value that indicates whether the
receiver conforms to a given protocol.
‣ A class is said to “conform to” a protocol if it
adopts the protocol or inherits from another class
that adopts it. Protocols are adopted by listing
them within angle brackets after the interface
declaration.
‣ This does not mean that the class listens to the
protocols messages explicitly!
25. Messages
‣ -‐ (BOOL)respondsToSelector:(SEL)selector
‣ Returns a Boolean value that indicates whether the receiving class
responds to a given selector.
‣ If this returns YES, you can safely send the message to the object.
‣ + (BOOL)instancesRespondToSelector:(SEL)aSelector;
‣ Returns a Boolean value that indicates whether instances of the receiver
are capable of responding to a given selector.
‣ When you have a Class handy and not an instance of that class. Saves
you creating an instance.
‣ Is smart enough to discover if the class actually implements the message!
‣ -‐ (id)performSelector:(SEL)selector
‣ Sends a specified message to the receiver and returns the result of the
message.
27. Dynamic messaging
‣ So what actually happens when you call
[foo bar]?
‣ when foo implements bar, that bar get
executed. Instant happy.
‣ but what when there's no bar
implementation?
1. try Lazy Method Resolution
2. try Fast forwarding
3. try Normal forwarding
4. *kaboom*
28. Dynamic messaging
1. Lazy method resolution
the runtime sends +resolveInstanceMethod:
(or +resolveClassMethod: for class methods)
to the class in question.
‣ If that method returns YES, the message
send is restarted under the assumption
that the appropriate method has now been
added.
2. Fast forwarding
3. Normal forwarding
4. *kaboom*
29. Dynamic messaging
1. Lazy method resolution
2. Fast forwarding
The instance receiving the message is sent forwardingTargetForSelector:, but only if it implements it.
‣ If it implements this method and it returns something
other than nil or self, the whole message sending process
is restarted with that return value as the new target.
‣ forwards the message to another object
‣ no method implementation is added
‣ target object can use whatever method implementation
as it sees fit.
3. Normal forwarding
4. *kaboom*
30. Dynamic messaging
1. Lazy method resolution
2. Fast forwarding
3. Normal forwarding
Two step process:
1. First the runtime will send
-instanceMethodSignatureForSelector: to see what kind
of argument and return types are present.
2. If a valid method signature is returned, the runtime
creates an NSInvocation describing the message being
sent
3. finally -forwardInvocation: is sent to the instance. The
instance should then use the NSInvocation on a target
object to execute the method.
4. *kaboom*
31. Dynamic messaging
1. Lazy method resolution
2. Fast forwarding
3. Normal forwarding
4. *kaboom*
The runtime calls -doesNotRecognizeSelector:
on the instance.
‣ Default behavior is to throw an
NSInvalidArgumentException, but you could
override this if you’d want to
‣ but! be careful -> errors will go
undetected!
32. Lazy method resolution
‣ Resolves/creates a method at runtime. Allows a
class to create a method when it doesn't exist.
‣ Override one (or both) of these:
‣ + (BOOL)resolveClassMethod:(SEL)sel;
‣ Dynamically provides an implementation for a
given selector for a class method.
‣ + (BOOL)resolveInstanceMethod:(SEL)sel;
‣ Dynamically provides an implementation for a
given selector for an instance method.
33. Lazy method resolution
‣ So how does this work?
‣ implement +resolveInstanceMethod:
‣ check the selector
‣ provide an implementation
‣ class_addMethod()
‣ need a method IMP:
‣ copy an existing method
‣ use a function
‣ make new method using a block
!
‣ Same applies to +resolveClassMethod:
‣ resolve happens the first time a method is not found (and only then if you return YES from the
resolver method)
‣ if you don't add an implementation but return YES anyway the you'll get an
NSInvalidArgumentException.
35. Fast forwarding
‣ You can provide an interface but have the actual
implementation be in another object.
‣ forward messages from one object to another
‣ for the user, it is as if the first object handles the call
‣ the actual handling object is "hidden" from the user
!
‣ So how does this work?
‣ implement -forwardingTargetForSelector:
‣ check the selector
‣ provide an object that can handle the selector
37. Normal forwarding
‣ have the object provide a method signature for the selector, so
the runtime knows what arguments and return type there should
be.
‣ then forward an NSInvocation on an object you choose.
‣ basically the same as fast forwarding but more low level and a
bit more verbose
‣ So how does this work?
‣ implement +instanceMethodSignatureForSelector:
‣ check the selector
‣ provide an NSMethodSignature* that describes the selector
‣ implement forwardInvocation:
39. Swizzling
‣ Swizzling is exchanging the implementation of
one factor of the runtime with another factor.
In Objective-C, you can apply this on two
levels: method swizzling and class swizzling.
‣ Method swizzling
‣ Class swizzling
‣ Dynamic class generation
40. Method swizzling
‣ You need to have two methods with an
implementation
‣ Can exchange the implementation of the
methods with each other
‣ Not only in your own code, but you can
modify framework code too! (eg UIView, …)
42. Class swizzling
‣ No real swizzling…
‣ Just change the class on an existing object
‣ best used with subclasses or classes with
the same layout/interface
‣ memory allocation is not changed when
changing classes
‣ otherwise: NUKULAR EXCEPTION
44. Dynamic class generation
‣ Generate a class at runtime
‣ Provide methods and implementations as
you see fit
‣ add new functionality
‣ change existing functionality
46. For closing…
‣ Generated properties
‣ provide property storage in your own
backing (eg plist)
‣ No implementations in code
‣ generate them at runtime
‣ only provide methods in interface
‣ no compiler warnings
48. Warning-fixing
‣ When providing dynamic implementations of selectors, the compiler will emit
warnings for the “unimplemented” messages.
‣ Fix these by placing them in a category instead of in the @interface declaration
@interface AwesomeClass
@end
!
!
@interface AwesomeClass (Dynamic)
!
!
// look ma, no warning
!
-‐ (void)withoutCodeButDynamicallyGenerated;
!
@end
!
‣ For properties
‣ declare a property as you normally would using @property syntax in your
@interface
‣ specify @dynamic <propertyName> in you @implementation to make sure
the compiler doesn’t autosynthesize the property
‣ or use the same technique as above
49. Opensourced examples
‣ You can find the example projects use to
demo each aspect in my Github account:
‣ https://github.com/Inferis/Objective-CRuntime