Day-3 Flashcards
Instruments
- Allocations - captures and displaying information about memory allocations in your app. Allocations can help you identify what the hell in your app is taking up all that memory
- Leaks - The Leaks instrument measures your general memory usage, and marks any leaked memory
- Zombies - instrument will help you detect overreleased objects, aka zombies aka dangling pointers. It works by replacing any object that has its retain count set to 0 with an NSZombie object, and then detects whenever these zombie objects are executed on. Pretty clever. For use with pre-arc code
- Time Profiler - helps you provide a great user experience. Use it anytime your app is acting ‘choppy’ or sluggish and you aren’t sure why. It’s goal is to tell you how much time is spent in each method
- Printing a Stack Trace - If you your execution is ever paused, like for a breakpoint, you can simply type in bt in the console to print out a back trace
1) Is Swift built app still based on the objective-C runtime ?
2) Two Objective-C runtime Versions
1) YES!
2) 64bit (modern) and 32bit
[receiver message]; Objective C message sent
The compiler converts this message expression into a call of the function objc_msgSend. This function takes the receiver and the name of the method mentioned in the message,aka the selector, as its two principle parameters: objc_msgSend(receiver,selector)
Run loops
Run loops are what actually make your code run
Concurrency
In computer science, concurrency is the execution of several instruction sequences at the same time. In an operating system, this happens when there are several process threads running in parallel. These threads may communicate with each other through either shared memory or message passing.
@property
@synthesize
@property generates prototypes for getter and setter methods. You usually place it in an @interface block which is itself in a .h file. The @interface block is where you declare a object’s methods and attributes.
@synthesize generates getter and setter methods. You usually place it in an @implementation block which is itself in a .m file. The @implementation block is where you write the code of the object’s methods.
Preprocessor
Provides the tools that enable you to develop programs that are easier to develop, read, modify, and port to different systems.
Preprocessor saves a little bit of memory because it will always be reserved in the application and can be used everywhere.
There's no difference between the following two: #import @import ;
Preprocessor have our code defined and replaced with Define (type aliases alternative) if found before we compile our application.
Polymorphism, Dynamic Typing, and Dynamic Binding
Polymorphism enables programs to be developed so that objects from different classes can define methods that share the same name.
Each class will have their own version of the same property or method using the Dispatch and Ploymorphism concepts.
Dynamic Typing
isKindOfClass - Is the object a member of class-objector a descendant? isMemberOfClass - Is the object a member of class-object? respondsToSelector - Can instance of the specific class responds to selector? isSubclassOfClass - Is the object a subclass of the specific class?
Dynamic Binding
It depends on the ‘id’
Dynamic binding defers the determination of the actual method to invoke on an object until program execution time
It does this by relying on determining the object type from the object at Runtime.
Once it knows the type, it can find the appropriate method located in that type’s dispatch table.
Dispatch Tables
Dispatch Tables are used by the Objective-C Runtime to lookup selectors on different classes.
A dispatch table looks like a hash table. It is created after we compile our app and have everything ready to execute, then pass it in to the Run process.
vTable
Cache that act like the dispatch table and it holds the methods that we need to execute. It helps making our app faster.
True or False?
The Objective-C runtime is open source.
True
When creating a new OperationQueue, you must manually allocate and initialize an instance of NSRunLoop.
False
The NSCoding protocol
It provides methods to use when working with NSKeyedArchiver and NSKeyedUnarchiver.