web technologien – model view controller pattern (mvc) · pdf fileuniv.-prof. dr.-ing....

Download Web Technologien – Model View Controller Pattern (MVC) · PDF fileUniv.-Prof. Dr.-Ing. Wolfgang Maass 17.11.11 Slide 2 Wrap-Up • Der Linux, Apache, MySQL, PHP Stack (= LAMP) ist

If you can't read please download the document

Upload: lykien

Post on 06-Feb-2018

218 views

Category:

Documents


1 download

TRANSCRIPT

  • Web Technologien Model View Controller Pattern (MVC) Univ.-Prof. Dr.-Ing. Wolfgang Maass Chair in Information and Service Systems Department of Law and Economics WS 2011/2012 Wednesdays, 8:00 10:00 a.m. Room HS 021, B4 1

  • Univ.-Prof. Dr.-Ing. Wolfgang Maass

    17.11.11 Slide 2

    Wrap-Up

    Der Linux, Apache, MySQL, PHP Stack (= LAMP) ist eine Sammlung von Open Source Standardsoftware zur Realisierung serverseitiger dynamischer Websites

    Das Datenbanksystem MySQL ermglicht die strukturierte und persistente Speicherung von Daten

    Die Skriptsprache PHP ermglicht die Erstellung komplexer Serverskripte, z.B. mit Zugriff auf das MySQL DBMS zur Datenhaltung

    Browser

    Clie

    nt

    Linux

    Apache MySQL

    PHP , (Python, Perl)

    Ser

    ver

  • Univ.-Prof. Dr.-Ing. Wolfgang Maass

    17.11.11 Slide 3

    Komplexe Softwaresysteme

    Probleme bei der Entwicklung komplexer Softwaresysteme: In Teams vom mehreren Personen geht der Gesamtberblick schnell

    verloren, jeder einzelne Entwickler kennt sich nur in seinem Quellcode aus

    Funktionalitt wird doppelt entwickelt und Insellsungen entstehen Fehler im System knnen nur schwer gefunden werden Eine Anpassung und Erweiterung der Funktionalitt durch andere ist

    kaum mglich Angestrebte Ziele aus dem Softwareengineering: Kapselung von Einzelaufgaben Wiederverwendbarkeit von Quellcode Stabilitt und berprfbarkeit Klar verstndliche und einfache Strukturierung

  • Univ.-Prof. Dr.-Ing. Wolfgang Maass

    17.11.11 Slide 4

    Entwurfsmuster

    Entwurfsmuster (engl. design patterns) sind Lsungsanstze fr wiederkehrende Probleme bei der Softwareentwicklung

    Sie untersttzen Softwarearchitekten und Programmierer bei der Strukturierung von Softwarearchitekturen in Komponenten

    Die Wiederverwendung von Komponenten stellt die Wiederverwendung von ausgereiftem Quellcode sicher

    Beispiel: Asynchrone Methodenaufrufe Angewendet bei AJAX um die Website nicht zu blockieren, whrend im Hintergrund komplexe Anfragen auf Serverskripte laufen knnen

  • Univ.-Prof. Dr.-Ing. Wolfgang Maass

    17.11.11 Slide 5

    Model View Controller (MVC)

    Klassisches Entwurfsmuster zur Strukturierung von Softwarearchitekturen in drei Einheiten:

    Datenmodell (engl. model) Prsentation (engl. view) Steuerung (engl. controller)

    Vorteile:

    Auf jeder Ebene wird muss nur ein Aufgabenbereich der Anwendung im Detail bearbeitet werden

    Jede Ebene kann unabhngig von den beiden anderen getestet werden Jede Ebene kann unabhngig von den beiden anderen ausgetauscht

    werden

  • Univ.-Prof. Dr.-Ing. Wolfgang Maass

    17.11.11 Slide 6

    Einheiten des MVC Pattern

    Datenmodell: Enthlt die fr die jeweilige Anwendung notwendigen Datenmodelle zur Speicherung der Anwendungsdaten, sowie die zur Speicherung gehrige Geschftslogik

    Prsentation: Enthlt die Funktionalitt zur Darstellung der Daten auf dem Benutzerinterface, sowie zur Weiterleitung der Benutzerinteraktionen an die Steuerung

    Steuerung: Enthlt die Funktionalitt zur Ausfhrung der Benutzerinterakationen auf das Datenmodell, sowie zur Anpassung der Prsentation gem der Benutzerinteraktion

  • Univ.-Prof. Dr.-Ing. Wolfgang Maass

    17.11.11 Slide 7

    Exemplarischer Ablauf

    Exemplarischer Ablauf des MVC Pattern im LAMP Stack bei der Erstellung eines Kommentar-Eintrages:

    1. Ein Besucher sendet einen

    Kommentar-Eintrag mittels Web-

    Formular an den Server

    2. Die Anfrage wird an das passende Steuerungsmodul

    bergeben

    3. Mittels der Geschftslogik im Modell wird der neue Eintrag

    gespeichert

    4a. Sofern es sich um eine AJAX-Anwendung handelt informiert das Modell die Prsentation ber eine

    Datennderung

    4b. Bei einer klassischen

    Webanwendung lsst der Controller die neue, passende

    Website mit dem integrierten

    Kommentareintrag erzeugen

  • Univ.-Prof. Dr.-Ing. Wolfgang Maass

    17.11.11 Slide 8

    LAMP/PHP MVC Frameworks

    LAMP/PHP MVC Frameworks liefern einen umfangreichen Baukasten zum Einsatz von MVC und anderen Entwurfsmustern fr Rich Internet Applications (RIA)

    Nachteile: Der Entwickler muss den Konventionen des Frameworks folgen Der Entwickler muss die untersttzenden Ablufe des MVC Frameworks

    verstehen und einzusetzen wissen Vorteile:

    Schnellere, robustere und sicherere Entwicklung von RIAs Wenig Programmieraufwand und schnelle Erfolge Einfachere Erweiterbarkeit um neue Funktionen

    Convention over configuration bzw. coding by convention

  • Univ.-Prof. Dr.-Ing. Wolfgang Maass

    17.11.11 Slide 9

    CakePHP enables PHP users at all levels torapidly develop robust web applications.

    Extra Hot: Release 2.0.3 Stable & 1.3.13

    CakePHP is a rapid developmentframework for PHP that provides anextensible architecture for developing,maintaining, and deployingapplications. Using commonly knowndesign patterns like MVC and ORMwithin the convention overconfiguration paradigm, CakePHP

    Get it now!

    2.0.3 Stable

    read the announcementview the changelogdownload: 1.3.13 Stabledownload: 1.2.11 Stable

    Get it now! Hot Features Learn Interact ReadHot Features Learn Interact Read

    CakePHP Downloads Documentation Community Services

    LAMP/PHP MVC Frameworks

    Search the entire site

    Zend Framework 2.0.0beta1 Released!

    Zend Framework 1.11.11 Released

    Why ZF?You've got questions, we've gotsolutions

    Case StudiesFrom Fortune 500s to startups

    Zend Framework 2.0.0beta1 Released!

    Announcing September's ZendFramework Bug Hunt Days

    QuickStartTake our 30-minute tour

    MultimediaYour topics on your time

    Reference GuideMore than 500 examples in 6languages

    TrainingLet us help you perfect your ZFskills

    Zend Framework 2.0.0beta1 Released!

    Announcing September's ZendFramework Bug Hunt Days

    Contributors GuideContributing is easier than youthink

    Issue TrackerHelp us deal with our issues

    Community WikiThe ultimate communalknowledge base

    2006 - 2011 by Zend Technologies Ltd. All rights reserved.FAQ | Sitemap | Wiki | Issue Tracker | Code Browser | License | Changelog |Roadmap | CLA | Security | Contact Us

    ABOUT DOWNLOADS DOCUMENTATION COMMUNITY SERVICES

    1.4 branch: 1.4.152.0 branch: 2.0.0

    Master symfonyBe trained by SensioLabs experts (2to 6 day sessions -- French orEnglish).trainings.sensiolabs.com

    Books on symfonyLearn more about symfony with theofficial guides.books.sensiolabs.com

    L'audit Qualit parSensioLabs200 points de contrle de votreapplicatif web.audit.sensiolabs.com

    Search search

    powered by google

    Be trained by symfony experts

    Nov 14: Paris (Getting Started withSymfony2 - Franais)

    Nov 21: Paris (Extending & HackingSymfony2 - Franais)

    Nov 21: Kln (Mastering Symfony2 -Deutsch)

    Nov 24: Kln (Getting Started withSymfony2 - Deutsch)

    You are browsing the website for symfony 1. Click here to visit the new website for Symfony2Click here to visit the new website for Symfony2

    About Installation Documentation Plugins Community Blog Development

    Open-Source PHP Web Framework

    Symfony is a full-stack framework, a library of cohesiveclasses written in PHP.

    It provides an architecture, components and tools for developers tobuild complex web applications faster. Choosing symfony allows youto release your applications earlier, host and scale them withoutproblem, and maintain them over time with no surprise.

    Symfony is based on experience. It does not reinvent the wheel: ituses most of the best practices of web development and integratessome great third-party libraries.

    Thousands of developers already trust symfony for theirapplications!

    New users join the community every day, and that makes ofsymfony the most popular PHP framework around. A largecommunity means easy-to-find support, user-contributeddocumentation, plugins, and free applications.

    Getting Started

    Discover symfony withthe Get Started tutorial.

    Learn the frameworkwith the Practicalsymfony book.

    Discuss on our mailing-lists, and join us in the#symfony IRC channel.

    Watch the tenminutes screencast ofthe ajax tutorial ortest it online

    This screencast showsthe best PHP codegeneration engine foryour backendinterfaces.

    The Jobeet website isa real-world web app,developed entirely insymfony. Step bystep, this is how.

    In addition to tutorialsand showcase apps,symfony has anextensivedocumentation. Divein.

    The Fast, Secure and ProfessionalPHP Framework 1.3k

    Yii is a high-performance PHP framework best fordeveloping Web 2.0 applications.

    Yii comes with rich features: MVC, DAO/ActiveRecord, I18N/L10N,caching, authentication and role-based access control, scaffolding,testing, etc. It can reduce your development time significantly.

    Or dive directly into Yii withscreencasts or guide

    v1.1.8 released on Jun 26, 2011Release notes License (BSD)

    Three steps to build your application rapidly:1. You create the database;2. Yii generates the base PHP code;3. You customize the code to fit your exact needs.

    Take the Tour Download Yii

    Fast

    Yii only loads the features that you need. It haspowerful caching support. It is explicitly designed towork efficiently with AJAX.

    Secure

    Security comes as standard with Yii. It includesinput validation, output filtering, SQL injection andCross-site scripting prevention.

    Professional

    Yii helps you develop clean and reusable code. Itfollows the MVC pattern,