Learning & Development Mobile apps for iPhone & iPad.

Slides:



Advertisements
Similar presentations
Windows Basic and Dynamic Disk Borislav Varadinov Telerik Software Academy academy.telerik.com System Administrator Marian Marinov CEO of 1H Ltd.
Advertisements

HTML Forms, GET, POST Methods Tran Anh Tuan Edit from Telerik Academy
Make swiftly iOS development Telerik Academy Telerik Academy Plus.
Amazon S 3, App Engine Blobstore, Google Cloud Storage, Azure Blobs Svetlin Nakov Telerik Software Academy academy.telerik.com.
RPN and Shunting-yard algorithm Ivaylo Kenov Telerik Software Academy academy.telerik.com Technical Assistant
Telerik School Academy ASP.NET MVC.
Shortest paths in edge-weighted digraph Krasin Georgiev Technical University of Sofia g.krasin at gmail com Assistant Professor.
Telerik Software Academy Telerik School Academy.
Coding JavaScript the expressive way Learning & Development Telerik Software Academy.
Asynchronous Programming with C# and WinRT
Unleash the Power of JavaScript Tooling Telerik Software Academy End-to-end JavaScript Applications.
Touch and Gestures with Xamarin Forms
Character sequences, C-strings and the C++ String class, Working with Strings Learning & Development Team Telerik Software Academy.
Hybrid or Native?! Doncho Minkov Telerik Software Academy Senior Technical Trainer
Done already for your convenience! Telerik School Academy Unity 2D Game Development.
Processing Sequences of Elements Telerik School Academy C# Fundamentals – Part 1.
With Mocha and Karma Telerik Academy Telerik Software Academy.
Welcome to the JSON-stores world Telerik Software Academy Databases.
The Business Plan and the Business Model Margarita Antonova Volunteer Telerik Academy academy.telerik.com Business System Analyst Telerik Corporation.
What are ADTs, STL Intro, vector, list, queue, stack Learning & Development Team Telerik Software Academy.
Making JavaScript code by template! Learning & Development Team Telerik Software Academy.
Svetlin Nakov Telerik Software Academy academy.telerik.com Manager Technical Training Who, What, Why?
Access to known folders, using pickers, writing to and reading from files, caching files for future access George Georgiev Telerik Software Academy academy.telerik.com.
Processing Matrices and Multidimensional Tables Svetlin Nakov Telerik Software Academy academy.telerik.com Technical Trainer
Learning & Development Telerik Software Academy.
Reading and Writing Text Files Svetlin Nakov Telerik Software Academy academy.telerik.com Technical Trainer
Telerik Software Academy ASP.NET Web Forms.
Classical OOP in JavaScript Classes and stuff Telerik Software Academy
Optimization problems, Greedy Algorithms, Optimal Substructure and Greedy choice Learning & Development Team Telerik Software.
Using Selenium for Mobile Web Testing Powered by KendoUI Telerik QA Academy Atanas Georgiev Senior QA Engineer KendoUI Team.
New features: classes, generators, iterators, etc. Telerik Academy Plus JavaScript.Next.
Using the Standard.NET Framework Classes Svetlin Nakov Telerik Software Academy academy.telerik.com Manager Technical Training
Throwing and Catching Exceptions Tran Anh Tuan Edit from Telerik Software Academy
When and How to Refactor? Refactoring Patterns Telerik Software Academy High-Quality Code.
Loops, Conditional Statements, Functions Tran Anh Tuan Edit from Telerik Academy
Private/Public fields, Module, Revealing Module Learning & Development Team Telerik Software Academy.
Building Data-Driven ASP.NET Web Forms Apps Telerik Software Academy ASP.NET Web Forms.
Telerik Software Academy End-to-end JavaScript Applications.
General and reusable solutions to common problems in software design Vasil Dininski Telerik Software Academy academy.telerik.com Intern at Telerik Academy.
Planning and Tracking Software Quality Yordan Dimitrov Telerik Corporation Team Leader, Team Pulse, Team Leader, Team Pulse, Telerik Corporation,
What you need to know Ivaylo Kenov Telerik Corporation Telerik Academy Student.
Data binding concepts, Bindings in WinJS George Georgiev Telerik Software Academy academy.telerik.com Technical Trainer itgeorge.net.
Objects, Properties, Primitive and Reference Types Learning & Development Team Telerik Software Academy.
When and How to Refactor? Refactoring Patterns Alexander Vakrilov Telerik Corporation Senior Developer and Team Leader.
Free Training and Job for Software Engineers Svetlin Nakov, PhD Manager Technical Training Telerik Corp. Telerik Software Academy.
Access to known folders, using pickers, writing to and reading from files, caching files for future access George Georgiev Telerik Software Academy academy.telerik.com.
Doing the Canvas the "easy way"! Learning & Development Telerik Software Academy.
Creating and Running Your First C# Program Svetlin Nakov Telerik Software Academy academy.telerik.com Manager Technical Training
Subroutines in Computer Programming Telerik School Academy C# Fundamentals – Part 1.
Correctly Formatting the Source Code Nikolay Kostov Telerik Software Academy academy.telerik.com Senior Software Developer and Technical Trainer
Data Types, Primitive Types in C++, Variables – Declaration, Initialization, Scope Telerik Software Academy academy.telerik.com Learning and Development.
The past, the present, the future Learning & Development Team Telerik Software Academy.
Using the Standard.NET Framework Classes Telerik Software Academy C# Fundamentals – Part 2.
Learn to Design Error Steady Code Svetlin Nakov Telerik Software Academy academy.telerik.com Technical Trainer
Connecting, Queries, Best Practices Tran Anh Tuan Edit from Telerik Software Academy
Processing Sequences of Elements Telerik Software Academy C# Fundamentals – Part 2.
Telerik JavaScript Framework Telerik Software Academy Hybrid Mobile Applications.
Telerik Software Academy Databases.
Integer, Floating-Point, Text Data, Variables, Literals Telerik Corporation
Things start to get serious Telerik Software Academy JavaScript OOP.
Processing Matrices and Multidimensional Tables Telerik Software Academy C# Fundamentals – Part 2.
Nikolay Kostov Telerik Software Academy academy.telerik.com Team Lead, Senior Developer and Trainer
Functions and Function Expressions Closures, Function Scope, Nested Functions Telerik Software Academy
Implementing Control Logic in C# Svetlin Nakov Telerik Software Academy academy.telerik.com Manager Technical trainer
Inheritance, Abstraction, Encapsulation, Polymorphism Telerik Software Academy Mobile apps for iPhone & iPad.
Mocking tools for easier unit testing Telerik Software Academy High Quality Code.
Creating and Initializing Arrays, Accessing Elements, Multiple Dimensions Learning & Development Team Telerik Software Academy.
What why and how? Telerik School Academy Unity 2D Game Development.
Windows Security Model Borislav Varadinov Telerik Software Academy academy.telerik.com System Administrator
Definition, Constructors, Methods, Access Modifiers, Static/Instance members, Learning & Development Team Telerik Software Academy.
Presentation transcript:

Learning & Development Mobile apps for iPhone & iPad

 Classes and Objects  What are Objects?  What are Classes?  Object Pointers  Classes in Objective-C  Declaring Class  Properties and methods  Init methods  Dynamic Binding

Modeling Real-world Entities with Objects

 Software objects model real-world objects or abstract concepts  Examples:  bank, account, customer, dog, bicycle, queue  Real-world objects have states and behaviors  Account' states:  holder, balance, type  Account' behaviors:  withdraw, deposit, suspend

 How do software objects implement real-world objects?  Use variables/data to implement states  Use methods/functions to implement behaviors  An object is a software bundle of variables and related methods

6  checks  people  shopping list …  numbers  characters  queues  arrays Things from the real world Things from the computer world

 The formal definition of class: Definition by Google Classes act as templates from which an instance of an object is created at run time. Classes define the properties of the object and the methods used to control the object's behavior.

 Classes provide the structure for objects  Define their prototype, act as template  Classes define:  Set of attributes  Represented by variables and properties  Hold their state  Set of actions (behavior)  Represented by methods  A class defines the methods and types of data associated with an object

Account +owner: Person +ammount: double +suspend +deposit: (double) sum +withdraw: (double) sum Class Name Attributes (Properties and Fields) Operations(Methods)

 An object is a concrete instance of a particular class  Creating an object from a class is called instantiation  Objects have state  Set of values associated to their attributes  Example:  Class: Account  Objects: Ivan's account, Peter's account

Account +owner: Person +ammount: double +suspend +deposit: (double) sum +withdraw: (double) sum Class clarkAccount +Owner="Clark Kent" +Ammount=200.0 bruceAccount +Owner="Bruce Wayne" +Ammount= tonyAccount +Owner="Tony Stark" +Ammount= Object Object Object

 Every MAC OS X/iOS application has two places to hold the values of the app (variables and stuff)  The Stack and the Heap  The stack is a fixed-sized stack data structure that holds primitive types and object pointers  Only the address, not the object itself  The heap is the place where all objects live  Their addresses are stored on the stack

 Some objects in Obj-C are passed by value  They live on the stack and are destroyed when out of scope  Their value is copied when passed as a parameter to a method, or when assigned to another object  NSInteger, NSUInteger, CGFloat, etc…  char, int, float, double, etc…

 Other objects are passed by reference  They live in the Heap, and only their address in the Heap is passed  Not copied, only their addresses (references)  NSObject, NSArray, NSString, etc…  Instances of custom classes are also stored on the heap

Live Demo

Using Classes and their Class Members

 Classes – basic units that compose programs  Implementation is encapsulated (hidden)  Classes in Objective-C can contain:  Fields (member variables)  Properties  Methods  Every class in Objective-C has two files  Public interface file (the.h file)  Implementation file (the.m file)

 Fields are data members of a class  Can be variables and constants (read-only)  All fields are private (they can be accessed only from the implementation of the class)  Accessing a field doesn’t invoke any actions of the object  Just accesses its value  Most of the cases they are hidden from the world  They live only in the implementation part

 Constant fields can be only read  Variable fields can be read and modified  Usually properties are used instead of directly accessing variable fields

 Classes in Objective-C consists of two separate files - ClassName.h and ClassName.m  ClassName.h contains the public interface of the class  Members that are accessible from other objects  ClassName.m contains the implementations of the public interface and private members

Live Demo

 Properties look like fields  Have name and type  Can contain code, executed when accessed  Declared using directive

 Usually used for encapsulation  They control the access to the data fields  They validate the given input values  Can contain more complex logic  Like parsing or converting data

 Every property has two components called accessors  Getter  Called when the property is requested double x = shape.x;  Setter  Called when the property value is changing shape.x = 4.5;

 Properties can be either:  Read-only  Write-only  Read-write  By default they (readonly) int int

Live Demo

 Properties provide a getter and a setter methods  Used to execute some code when assigning a value or getting the value of the property  By default:  The setter method is called setPropertyName  The getter method is with the name of the int capacity; -(int) capacity{ … } -(void) setCapacity { … }

Live demo

 Objective-C provides two ways of instantiating objects  Using init methods  Using factory methods Person *p = [[Person alloc] init]; Person *p = [Person person]; Person *p = [[Person alloc] Person *p = [Person

 Objective-C provides two ways of instantiating objects  Using init methods  Using factory methods Person *p = [[Person alloc] init]; Person *p = [Person person]; Person *p = [[Person alloc] Person *p = [Person Both are equally used and in best case both should be present

 Init methods are used to create objects  They are regular methods that have a special meaning in modern MAC/iOS apps  ARC checks for methods with prefix "init" and treat their result differently

 Init methods have a special template to follow: -(id) init { self = [super init]; self = [super init]; if (self) if (self) { //the parent is instantiated properly and can //the parent is instantiated properly and can //continue instance specific stuff.. //continue instance specific stuff.. } return self; return self;}

 ARC checks for methods with prefix "init"  All of the following are valid init Person:

 ARC checks for methods with prefix "init"  All of the following are valid init Person: -(id) init; The default init method Produces objects without parameters

 ARC checks for methods with prefix "init"  All of the following are valid init Person: -(id) init; -(id) initWithFullname: (NSString *) fullname; init method that takes a single parameter Handles the role of "method overloading"

 ARC checks for methods with prefix "init"  All of the following are valid init Person: -(id) init; -(id) initWithFullname: (NSString *) fullname; -(id) initWithFirstname: (NSString *) fname andLastName: (NSString *) lname; andLastName: (NSString *) lname; init method that takes two parameters The same as the others

Live Demo

 Factory methods are no more than hidden init methods  They are class methods (the message is sent to the class, instead of to a concrete object)

 By concept, factory methods' identifiers start with the name of the class, Person: NSObject +(id) person; +(id) personWithFirstname: (NSString +(id) personWithFirstname: (NSString *) fname { Person *p = [[Person alloc] init]; Person *p = [[Person alloc] init]; p.firstname = fname; p.firstname = fname; return p; return

Live Demo

форум програмиране, форум уеб дизайн курсове и уроци по програмиране, уеб дизайн – безплатно програмиране за деца – безплатни курсове и уроци безплатен SEO курс - оптимизация за търсачки уроци по уеб дизайн, HTML, CSS, JavaScript, Photoshop уроци по програмиране и уеб дизайн за ученици ASP.NET MVC курс – HTML, SQL, C#,.NET, ASP.NET MVC безплатен курс "Разработка на софтуер в cloud среда" BG Coder - онлайн състезателна система - online judge курсове и уроци по програмиране, книги – безплатно от Наков безплатен курс "Качествен програмен код" алго академия – състезателно програмиране, състезания ASP.NET курс - уеб програмиране, бази данни, C#,.NET, ASP.NET курсове и уроци по програмиране – Телерик академия курс мобилни приложения с iPhone, Android, WP7, PhoneGap free C# book, безплатна книга C#, книга Java, книга C# Николай Костов - блог за програмиране

1. Create classes for an event manager app:  Each event has title, category, description, date and list of guests (strings)  Event manager can:  Create event  List all events  List events by category  Sort events by either date or title

2. Create an iPhone application using the event manager. Create two views:  One for listing events  One for creating events  Use the class from the previous exercise  Research about creating iPhone apps  Research about Seques and transitions between different views