Accelerating PHP development Data-tier programming Brian Rosenthal Zvi Boshernitzan Robocommerce.

Slides:



Advertisements
Similar presentations
Database Systems: Design, Implementation, and Management Tenth Edition
Advertisements

1 The Database Application Development Process The Database Application Development Process.
An Integrated Approach to Enterprise Architecture LIACS, Martijn Wiering 23 juni ‘04.
Data (What) Function (How) Network (Where) People (Who) Time (When) Motivation (Why) Objectives/ Scope List of things important to the enterprise List.
All Rights Reserved: JusticeExperts.com Enterprise? What Enterprise? Enterprise Development.
9/6/2001Database Management – Fall 2000 – R. Larson Information Systems Planning and the Database Design Process University of California, Berkeley School.
1 Agenda 01/13/05 Announcement Database Development Process (Chapter 2)
SLIDE 1IS Fall 2010 Information Systems Planning and the Database Design Process Ray R. Larson University of California, Berkeley School.
Introduction to Databases Transparencies
Irwin/McGraw-Hill Copyright © 2004 The McGraw-Hill Companies. All Rights reserved Whitten Bentley DittmanSYSTEMS ANALYSIS AND DESIGN METHODS6th Edition.
1 IS 4420 Database Fundamentals Chapter 2: Database Development Process Leon Chen.
The Use of Zachman Framework Primitives for Enterprise Modeling
Irwin/McGraw-Hill Copyright © 2000 The McGraw-Hill Companies. All Rights reserved Whitten Bentley DittmanSYSTEMS ANALYSIS AND DESIGN METHODS5th Edition.
Chapter 2: IS Building Blocks Objectives
Databases and Database Management Systems
The database development process
SQL, Data Storage Technologies, and Web-Data Integration Week 1.
1 CONCENTRXSept 2000 Our Perspective “Integration without an architecture is like doing a jigsaw puzzle on your lap “ – R Tessier We look at the big picture.
Example of architecture framework. Enterprise Architectural frameworks An architectural framework provides the structure and methods for organising the.
PHASE 3: SYSTEMS DESIGN Chapter 7 Data Design.
Irwin/McGraw-Hill Copyright © 2004 The McGraw-Hill Companies. All Rights reserved Whitten Bentley DittmanSYSTEMS ANALYSIS AND DESIGN METHODS6th Edition.
Bina Nusantara 2 C H A P T E R INFORMATION SYSTEM BUILDING BLOCKS.
Databases From A to Boyce Codd. What is a database? It depends on your point of view. For Manovich, a database is a means of structuring information in.
Information storage: Introduction of database 10/7/2004 Xiangming Mu.
Introduction. » How the course works ˃Homework ˃Project ˃Exams ˃Grades » prerequisite ˃CSCI 6441: Mandatory prerequisite ˃Take the prereq or get permission.
Copyright © 2013 Curt Hill The Zachman Framework What is it all about?
Database System Concepts and Architecture
Copyright © 2004 The McGraw-Hill Companies. All Rights reserved Whitten Bentley DittmanSYSTEMS ANALYSIS AND DESIGN METHODS6th Edition Irwin/McGraw-Hill.
9/14/2012ISC329 Isabelle Bichindaritz1 Database System Life Cycle.
Entity Framework Overview. Entity Framework A set of technologies in ADO.NET that support the development of data-oriented software applications A component.
Databases From A to Boyce Codd. What is a database? It depends on your point of view. For Manovich, a database is a means of structuring information in.
Chapter 2 Data Models Database Systems: Design, Implementation, and Management, Rob and Coronel Adapted for INFS-3200.
_______________________________________________________________________________________________________________ PHP Bible, 2 nd Edition1  Wiley and the.
Dr. Mohamed Osman Hegazi 1 Database Systems Concepts Database Systems Concepts Course Outlines: Introduction to Databases and DBMS. Database System Concepts.
1-1 System Development Process System development process – a set of activities, methods, best practices, deliverables, and automated tools that stakeholders.
CSC 480 Software Engineering OOAD Process. Topics Overview: OOAD Process The object model Identifying classes Responsibilities and collaborations Hierarchy:
Modeling Shari L. Pfleeger and Joanne M. Atlee, Software Engineering: Theory and Practice, 4 th edition, Prentice Hall, Hans Van Vliet, Software.
Copyright © 2004 The McGraw-Hill Companies. All Rights reserved Whitten Bentley DittmanSYSTEMS ANALYSIS AND DESIGN METHODS6th Edition Irwin/McGraw-Hill.
Enterprise Systems Architectures EGN 5621 Enterprise Systems Collaboration (Professional MSEM) Fall, 2012.
Information Systems Engineering. Lecture Outline Information Systems Architecture Information System Architecture components Information Engineering Phases.
Lecture # 3 & 4 Chapter # 2 Database System Concepts and Architecture Muhammad Emran Database Systems 1.
CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University.
McGraw-Hill/Irwin Copyright © 2007 by The McGraw-Hill Companies, Inc. All rights reserved. Chapter 2 Information System Building Blocks.
2-1 A Federation of Information Systems. 2-2 Information System Applications.
BY: Alex Quigley Andrew Monaghan Daniel Ozac Eoin McCrann Philip Hamilton.
Lecture 4: Enterprise Architecture
ESG-CET Meeting, Boulder, CO, April 2008 Gateway Implementation 4/30/2008.
Class11 Introduction to relational databases and MySQL MIS 3501, Fall 2015 Brad Greenwood, PhD MBA Department of MIS Fox School of Business Temple University.
Modeling Shari L. Pfleeger and Joanne M. Atlee, Software Engineering: Theory and Practice, 4 th edition, Prentice Hall, Hans Van Vliet, Software.
Information System Applications
CS 325 Spring ‘09 Chapter 1 Goals:
Introduction to DBMS Purpose of Database Systems View of Data
Database Development Lifecycle
The Components of Information Systems
CGS 2545: Database Concepts Fall 2010
Translation of ER-diagram into Relational Schema
A view of information technology
The Components of Information Systems
A Tutorial on the Zachman Framework for Enterprise Architecture
Accelerating PHP development
Cse 344 May 11th – Entities.
Modeling Shari L. Pfleeger and Joanne M. Atlee, Software Engineering: Theory and Practice, 4th edition, Prentice Hall, Hans Van Vliet, Software Engineering:
Introduction to relational databases and MySQL
INFO/CSE 100, Spring 2006 Fluency in Information Technology
Introduction to DBMS Purpose of Database Systems View of Data
Database Design Hacettepe University
Class11 Introduction to relational databases and MySQL
MIS2502: Data Analytics Relational Data Modeling
Information System Building Blocks
System architecture, Def.
Presentation transcript:

Accelerating PHP development Data-tier programming Brian Rosenthal Zvi Boshernitzan Robocommerce

Overview: Data modeling High-level approach to database design. We will describe  Basic principles of data modeling  PHP Programming techniques Database abstractions Stack-based database programming Inference-based database programming

Basic principles of data modeling Normalization: “Don’t repeat yourself.” Entity Relation “ER” diagrams

Normalization “Don’t Repeat Yourself” First approach: store the author information within the book. Problem: what if there is more than one author. Where do we store the second author?

Normalization “Don’t Repeat Yourself” Second approach: store up to three authors Problems: what if there are more, and what about all of the information about the authors (address, etc.)

Normalization “Don’t Repeat Yourself” Third approach: have two tables: books and authors. Authors have a book id. “Each book may be written by 0 or more authors.” Each author must be the writer of a book.

Normalization “Don’t Repeat Yourself” Books idtitle 1Da Vinci Code 2Angels and Demons Authors idbook_idfirst_namelast_namephone_number 11DanBrown DanBrown Problem: We still have redundancy

Normalization “Don’t Repeat Yourself” Fourth approach: have three tables: books, people, authorship. Each entry in the “authorship” table is a fact. That a particular person participated in an authorship of a book No information is repeated!

ER Diagrams This is an ER diagram. You read it: “Each product must be sold under a brand” “Each brand may be the origin of 0 or more products”

PHP Database Infrastructure Zvi: database abstractions. Brian: stack-based SQL programming Brian: inference-based SQL programming

Database “stack” programming SQL as a big string versus SQL as a “stack” SQL is, after all structured. {‘select’:’firstname,lastname’, ‘from’:’customers c’, ‘ijoin’:{‘s’:{‘table’:’sites’, ‘on’:’s.id = c.site_id’}}, ‘where’:[“c.name like ‘%brian%’”, “c.id > 10”], ‘limit’:10, ‘offset’:5 } $q->add_where(…) $q->add_select(…), $q->set_select(…) $q->add_lojoin(…) $q->load_dict({‘select’:’c.address_id’, ‘where’:…}) $q->to_sql() $q->to_dict()

SPEC DRIVEN DATABASE PROGRAMMING db::objects($q->to_sql()) db::assocs($q->to_sql()) db::string($q->to_sql()) db::object($q->to_sql())

INFERENCE-BASED DATABASE PROGRAMMING A lot of information is stored in the database schema The idea here is to use it where it is possible to do so

Inferences from ER diagrams … if you were writing classes to manage these database entities, you might include: products::mget_by_category(…) products::mget_by_brand(…) products::map_keyword(…) products::mget_by_keyword(…) keywords::mget_by_product(…)

Enter: PHP 5 Call handler override “function __call($m, $args)” Mysql reflection Singleton / factory semantics Autoloads

You should really get all of these functions for free: mg(‘products’)->get($product_id) mg(‘products’)->create(‘name’, ‘lawnmower’) mg(‘products’)->mget_by_keyword($keyword_id) mg(‘products’)->mget_by_category($category_id) mg(‘products’)->mget_by_brand($brand_id) mg(‘products’)->get_by_sku($sku) mg(‘products’)->get_title($product_id) mg(‘products’)->get_title(‘sku’, $sku) mg(‘products’)->map_keyword($keyword_id) mg(‘products’)->colnames() mg(‘categories’)->get_products($category_id)

So, here’s the class: class products extends dbentity { function references() { return array('brand_id' => 'brands‘, 'category_id' => 'categories'); } function mappings() { return array( ‘keywords' => array(‘product_keywords', 'product_id', ‘keyword_id', ‘keywords‘), ‘related_products' => array('product_relations', 'from_product_id', 'to_product_id', 'products'), 'suppliers' => array('supplier_prices', 'product_id', 'supplier_id', 'suppliers‘, array('wholesale_price' => 'price', 'sku' => 'sku')) ); }

Customizing the sql: $q = new dbquery(array( ‘select’ => ‘p.name’, ‘from’ => ‘products p’, ‘ijoin’ => array(‘c’ => rba::_(‘table’, ‘categories’, ‘on’, ‘c.id = p.category_id’)), ‘where’ => “name like ‘%lemon%’ ”, ‘order_by’ => ‘p.name’ )); $q->add_select(‘p.subname’) $q->add_ijoin(…) $q->set_limit(…) $q->load($q_spec)

Customizing the SQL $dbquery = array( ‘select’ => ‘c.name as category_name’, ‘ijoin’ => array(‘c’ => rba::_(‘table’, ‘categories’, ‘on’, ‘c.id = p.category_id’))) mg(‘products’)->get(product_id, compact(‘dbquery’))

Objectives/ Scope Business Owner’s View Architect’s View* Designer’s** View Builder’s View*** Functioning System List of Important Things Terms, Definitions Entity/ Relationship Diagram Tables, Classes Data, physical storage design List of Processes Business Process Model Essential Functions System Design Detailed Program Design Business Locations Operations by Business Location Data Links, Processing Locations Network Architecture (h/w, s/w types) Network Construction Organi- zational Units Org. Chart, Roles Roles+Data (Use Cases) User Interface, Security Screens, Security Design Business Events, Cycles Master Business Schedule State/ transactions, ELH “Control Flow” diagrams Timing Definitions Business Vision and Mission Business Policies and Rules Business Rule Model Rule Design Rule Specification Working System Network (Where) Data (What) Activities (How) People (Who) Timing (When) Motiva- tion (Why) *John Z calls this the “information designer’s” perspective. **He calls this the “builder’s” view. ***This is John Z’s “sub-contractor’s” view. Zachman Framework