This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
history / grep cat | |
cat /usr/share/dict/words | grep -o '\ba\w*' | wc -l | |
cat /usr/share/dict/words | grep -o '\ba\w*s$' | |
curl -o index.html "https://www.lighthouselabs.ca/index.html" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Question 1 | |
Some steps could be done to avoid conflicts, like: short-living branches, create small modules, | |
strong communication and mob programming (Reference: https://github.com/hli30/git-mania) | |
Question 2 | |
Other than the recommendation above, merge conflict will always be something to look out for when working in a team. | |
Conflicts must be manually resolved prior to pushing. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Question 1 | |
Object oriented programming have several advantages over procedural programming. Because it separate code logic inside objects, | |
it makes the code more readable, reusable and extensible. This also make the code less error prone. | |
Question 2 | |
A: Structures groups related information to create a meaningful type. They are like class/objects, but without methods. | |
Using structs make it easy to manipulate these information, making code more readable. | |
Question 3 | |
A: Class methods are methods that don't depend of the class properties, tney're stateless and basically uses the arguments |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
question 1 | |
answer: Instance variables are local variables acessible only inside the class itself, | |
through getter and setter methods and also using the _ sign. Instance variables use the concept | |
of encapsulation to expose only the property methods to outside classes, not the ivar. | |
question 2 | |
answer: Abstraction: group related infomation about an object: data (attributes) | |
and behavior (methods) to create a blueprint of this object. The relation between this classes | |
makes simpler to design clean, extensible and reusable code. Encapsulation - hide everything | |
that is not required from external classes, making visible only what is necessary. Inheritance - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Activity completed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Question 1 | |
Answer: MVC - Model holds all the information (data, state) and logic the store this information. View is the presentation for those | |
Models. Any changes in their state are informed to the View so it can change and update their presentation. Controller is | |
responsible to intermediate Model and View communication, when for example, a View needs to update a information stored in | |
the Model or when the Model needs to inform the View that an information is changed and needs to be updated in the View. | |
Question 2 | |
Answer: An NSObject protocol allows multiple root classes to all have the same basic methods, and also makes it easy to | |
declare a protocol which also includes basic functionality expected of any object. The NSObject class conforms to the | |
NSObject protocol, bringing everything together. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Question 1: | |
A view should not reference directly the controller. Instead, the controller that is responsible to manage which view will be displayed. | |
Question 2: | |
a) "Nonatomic" is used for multi threading purposes. If we have set the nonatomic attribute at the time of declaration, | |
then any other thread wanting access to that object can access it and give results in respect to multi-threading. "Strong" | |
is a replacement for the retain attribute, as part of Objective-C Automated Reference Counting (ARC). "Weak" is similar | |
to strong except that it won't increase the reference count by 1. It does not become an owner of that object but just | |
holds a reference to it. If the object's reference count drops to 0, even though you may still be pointing to it here, | |
it will be deallocated from memory. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Question 1: | |
Part 1 Answer: d | |
Part 2 Answer: a | |
Question 2: | |
Answer: Inside the responder chain: | |
First Responder: Can i handle a "tap" input? | |
If (YES), handle the event | |
Else (NO), pass to the next responder | |
If no object can respond to that event, discard the input. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Question 1: | |
A) Programmer needs to set up the Observee (Subject) object adding a new notification to NSNotificationCenter defaultCenter. | |
After doing this, each Observer who needs to be notified needs to subscribe to that notification. To do that, each Observer | |
object needs to be added as a Observer in NotificationCenter and define a method that will be called each time that it receives | |
a new notification. | |
B) Notification Center uses two different design patterns: the Observer and the Singleton pattern. The observer defines that | |
any object that wants to subscribe to receive notifications (that could be also considered delegates for that observer, because | |
they can execute a specific task when receive a notification) can do that. In the delegation pattern, only one object can | |
receive a "notification" by the delegator. Notification Center uses a Singleton Pattern to define that only one instance | |
of this class will be created during the execution of the application. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Question 1 | |
a) MVC - Model View Controller, where Model represents the data, the View represents the interface to display that data and/or | |
send user inputs to the Controller, and the Controller is responsible to provide Model data for the view and interpret user | |
actions from the view. | |
b) i. doctor can have many patients. - MODEL, where a Doctor object can have a property with a collection of Patients objects. | |
ii. A doctor should be able to see a list of all his/her patients. - VIEW, a system feature to capture these data from the | |
model. | |
iii. When looking at a patient's file, we should have the patient's picture in the top left hand corner. - VIEW, an image | |
representing patient's picture is the interface for the user. |
OlderNewer