1 / 46

Yii – How Power Comes

Presented at: Nextbridge Multan Center Aug 25, 2011. Yii – How Power Comes. Introduction, OOP & Design Patterns. Today’s. AGENDA. Topics we will cover in this presentation. Introd uction to Yii Core features Patterns that make it Yii. Yii Framework. Topic 1. Yii - Definition.

saad
Download Presentation

Yii – How Power Comes

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  2. Today’s AGENDA

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

  4. YiiFramework Topic 1

  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. Yii - Features TOPIC 2

  18. Yii Features 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 • 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

  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. Patterns that make it Yii TOPIC 3

  23. What do you think? ?

  24. What makes it Yii - 1 Borrowing Ideas

  25. Borrowing Ideas 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 What makes it Yii - 1 CComponent is the base class for all components. CComponent implements the protocol of defining, using properties and events.

  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. The Lazy Load Pattern • 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. The Registry Pattern • 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. The Singleton Pattern • 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. The Factory Method Pattern

  44. The Factory Method Pattern • 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. Presented at: Nextbridge Multan Center Aug 25, 2011 Introduction, OOP & Design Patterns Yii– How Power Comes Designed & delivered by: NazarHussain Training Manager

More Related