Day-3 Flashcards

1
Q

Instruments

A
  • 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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

1) Is Swift built app still based on the objective-C runtime ?
2) Two Objective-C runtime Versions

A

1) YES!

2) 64bit (modern) and 32bit

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

[receiver message]; Objective C message sent

A

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)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Run loops

A

Run loops are what actually make your code run

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Concurrency

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

@property

@synthesize

A

@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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Preprocessor

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Polymorphism, Dynamic Typing, and Dynamic Binding

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Dynamic Typing

A
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?
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Dynamic Binding

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Dispatch Tables

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

vTable

A

Cache that act like the dispatch table and it holds the methods that we need to execute. It helps making our app faster.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

True or False?

The Objective-C runtime is open source.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

When creating a new OperationQueue, you must manually allocate and initialize an instance of NSRunLoop.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

The NSCoding protocol

A

It provides methods to use when working with NSKeyedArchiver and NSKeyedUnarchiver.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly