Presentation is loading. Please wait.

Presentation is loading. Please wait.

Yii – How Power Comes Introduction, OOP & Design Patterns Presented at: Nextbridge Multan Center Aug 25, 2011.

Similar presentations


Presentation on theme: "Yii – How Power Comes Introduction, OOP & Design Patterns Presented at: Nextbridge Multan Center Aug 25, 2011."— Presentation transcript:

1 Yii – How Power Comes Introduction, OOP & Design Patterns Presented at: Nextbridge Multan Center Aug 25, 2011

2 AGENDA Today’s

3 Topics we will cover in this presentation Introduction to Yii Core features Patterns that make it Yii

4 TOPIC 1 Yii Framework

5 Yii - Definition Fast – Secure – Professional

6 Why it’s called like that?! Chinese Yi: Easy and simple. Flexibility, ability to change. Persistence. Core principles are always the same.

7 How it is Fast?

8 How it is Secure? Cross-site Scripting Prevention Cross-site Request Forgery Prevention Cookie Attack Prevention Built-in Authentication and Authorization – Cookie based Login – Access Control Filter – Handling Authorization Result – Role-based Access Control – Configureable Authorization Manager

9 How it is Professional? MVC Database Access Objects (DAO) Query Builder Active Record DB Migration Skinning & Theming Automatic Code generation Best parts from all Frameworks

10 How it is Professional? MVC Database Access Objects (DAO) Query Builder Active Record DB Migration Skinning & Theming Automatic Code generation Best parts from all Frameworks

11 Yii History Prado (2004) ▼ Yii 1.0 (2008) ▼ Yii 1.1 (2010) ▼ Yii2 (?)

12 Why reinventing the wheel?

13 Why reinventing the wheel ? Sometimes it’s better to invent a better wheel!

14 Why reinventing the wheel & Why MVC? When Prado was developed there were at least no competitors. Prado took ASP.NET ideas that were ―not from this world. MVC is popular and convenient. Frameworks of 2008 weren’t that good.

15 Why reinventing the wheel & Why MVC? When Prado was developed there were at least no competitors. Prado took ASP.NET ideas that were ―not from this world. MVC is popular and convenient. Frameworks of 2008 weren’t that good.

16 Yii Team 6 developers. Tech. writer. ~50 translators. Priority: – Code stability. – Code reliability. – Consistent style.

17 TOPIC 2 Yii - Features

18 Yii Features Model-View-Controller (MVC) design pattern Database Access Objects (DAO), Query Builder, Active Record, DB Migration Form input and validation AJAX-enabled widgets Authentication and authorization Skinning and theming Web services Internationalization (I18N) and localization (L10N) Layered caching schem Error handling and logging Security Unit and functionality testing Automatic code generation Compliance to XHTML Purely object-oriented Friendly with third-party code Detailed documentation Extension library

19 Yii Main Features MVC Active Record Integration with jQuery Widgets integrated with Jquery Themes and translation

20 Yii – Typical Flow

21 Flow of execution

22 TOPIC 3 Patterns that make it Yii

23 What do you think? ?

24 What makes it Yii - 1 Borrowing Ideas

25 Is it Good?

26 Borrowing Ideas Copy-paste is evil. Think. Analyze. Take the best and leave the rest.

27 What makes it Yii - 2 OOP Pattern

28 Yii - Component CComponent is the base class for all components. CComponent implements the protocol of defining, using properties and events. What makes it Yii - 1

29 What makes it Yii - 3 Design Patterns

30 What are design patterns? The words ”Object Oriented Design” repeated on wall paper An industry buzzword that gets you into meetups Recurring solutions to common software development challenges Mind bending algorithms of confusion and indigestion

31 What are design patterns? The words ”Object Oriented Design” repeated on wall paper An industry buzzword that gets you into meetups Recurring solutions to common software development challenges Mind bending algorithms of confusion and indigestion

32 The Lazy Load Pattern Lazy loading is the process of delaying the instantiation of an object until the instance is needed. We all know the mantra, lazy programmers are the best programmers.

33 The Lazy Load Pattern

34 Delays resource consumption until it is needed, which may be never Is relatively easy to understand Offers an encapsulated means of creating objects Offers an encapsulated means of storing objects for use later

35 The Registry Pattern A registry is an object that other objects can use to access data, settings, values and other objects from a sort of internal storehouse.

36 The Registry Pattern

37 Maintaining values throughout a request Setting/getting configuration values Allowing access to variables within an application without globals For Windows user, causing hours and hours of grief when corrupt

38 The Singleton Pattern The singleton patterns ensures that one and only one instance of an object exists.

39 The Singleton Pattern

40 Pro: You know you have the same instance available at all times. Con: One and only one instance is all you get. Pro: Instantiates itself for you so all you need to do is get it. Con: Autoinstantiation diminishes flexibility of argument passing. Pro: Since it is singleton it can replace global variable declaration. Con: Since it is singleton it can replace global variable declaration.

41 The Factory Method Pattern The factory method is a method whose sole purpose in life is to create objects. Most commonly (and really per definition) the factory method is an interface method that delegates object instantiation decisions to subclasses. However, it also commonly acceptable to say that a method that creates objects (both of known and unknown classes) is a factory method.

42 The Factory Method Pattern

43

44 Encapsulates object creation Allows a range of functionality for error trapping, loading, etc Does not need to know anything about what it is creating Easy to read, easy to understand Lightweight, fast and can be made into a static method

45 Now its your turn to speak

46 YII – HOW POWER COMES Introduction, OOP & Design Patterns Designed & delivered by: Nazar Hussain Training Manager Presented at: Nextbridge Multan Center Aug 25, 2011


Download ppt "Yii – How Power Comes Introduction, OOP & Design Patterns Presented at: Nextbridge Multan Center Aug 25, 2011."

Similar presentations


Ads by Google