platform agnostic information systems development

47
@the_dead_poetic fb.com/pupprogrammingguild github.com/awkwardusername [email protected] Platform Agnostic Information Systems Development

Upload: mark-jayson-fuentes

Post on 07-Aug-2015

464 views

Category:

Software


2 download

TRANSCRIPT

@the_dead_poeticfb.com/pupprogrammingguild

github.com/[email protected]

Platform Agnostic Information Systems Development

Information Systems, defined Types of IS IS Challenges APIs for Platform Agnostic

Communication

What we’ll be talking about

Information Systems, defined

a system composed of people and computers that processes information [wikipedia]

a system of functions concerning the acquisition and transfer of information, the carriers of which can be biological, personal, social or technical units [principia cybernetica]

an integrated set of components for collecting, storing, and processing data and for delivering information, knowledge, and digital products [britannica]

“A composition of people and

computers that works together to

process data to deliver

information”

Types of IS

data warehouses (OLAP) enterprise resource planning (CRM,

Inventory , Sales) expert systems search engines geographic information system office automation

Challenges

CapacityComplexityCriticalityCosts

4Cs

Capacity begets complexity which begets criticality which begets costs.

APIs for Platform Agnostic

Communication

APIs ?

a set of routines, protocols, and tools for building software applications [wikipedia]

code that allows two software programs to communicate with each other [techtarget]

defines the proper way for a developer to request services from that program [computer world]

APIs are…

00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9FA0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BFC0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DFE0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF

i386http://ref.x86asm.net/coder32.html

/* Setup cube vertex data. */v[0][0] = v[1][0] = v[2][0] = v[3][0] = -1;v[4][0] = v[5][0] = v[6][0] = v[7][0] = 1; v[0][1] = v[1][1] = v[4][1] = v[5][1] = -1; v[2][1] = v[3][1] = v[6][1] = v[7][1] = 1; v[0][2] = v[3][2] = v[4][2] = v[7][2] = 1; v[1][2] = v[2][2] = v[5][2] = v[6][2] = -1;

/* Enable a single OpenGL light. */ glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse); glLightfv(GL_LIGHT0, GL_POSITION, light_position); glEnable(GL_LIGHT0); glEnable(GL_LIGHTING);

/* Use depth buffering for hidden surface elimination. */ glEnable(GL_DEPTH_TEST);

/* Setup the view of the cube. */ glMatrixMode(GL_PROJECTION); gluPerspective( /* field of view in degree */ 40.0, /* aspect ratio */ 1.0, /* Z near */ 1.0, /* Z far */ 10.0); glMatrixMode(GL_MODELVIEW); gluLookAt(0.0, 0.0, 5.0, /* eye is at (0,0,5) */ 0.0, 0.0, 0.0, /* center is at (0,0,0) */ 0.0, 1.0, 0.); /* up is in positive Y direction */

OpenGL

#include <windows.h>

const char g_szClassName[] = "myWindowClass";

#define IDC_MAIN_EDIT 101

LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam){

switch(msg){

case WM_CREATE:{

HFONT hfDefault;HWND hEdit;

hEdit = CreateWindowEx(WS_EX_CLIENTEDGE, "EDIT", "",

WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_HSCROLL | ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL,

0, 0, 100, 100, hwnd, (HMENU)IDC_MAIN_EDIT, GetModuleHandle(NULL), NULL);

if(hEdit == NULL)MessageBox(hwnd, "Could not create

edit box.", "Error", MB_OK | MB_ICONERROR);

hfDefault = (HFONT)GetStockObject(DEFAULT_GUI_FONT);

SendMessage(hEdit, WM_SETFONT, (WPARAM)hfDefault, MAKELPARAM(FALSE, 0));

}break;

Windows API

POST https://api.stripe.com/v1/charges

curl https://api.stripe.com/v1/charges \ -u sk_test_BQokikJOvBiI2HlWgH4olfQ2: \ -d amount=400 \ -d currency=usd \ -d source=tok_15doRS2eZvKYlo2C2ENn4JQh \ -d description="Charge for [email protected]"

{ "id": "ch_15e7rU2eZvKYlo2CxWE8afA9", "object": "charge", "created": 1425834404, "livemode": false, "paid": true, "status": "succeeded", "amount": 4996, "currency": "usd", "refunded": false, "source": { "id": "card_15e7rT2eZvKYlo2CXYAxysRN", "object": "card", "last4": "4242", "brand": "Visa", "funding": "credit", "exp_month": 12, "exp_year": 2018, "fingerprint": "Xt5EWLLDS7FJjR1c", "country": "US", "name": null, "address_line1": null, "address_line2": null, "address_city": null, "address_state": null, "address_zip": null, "address_country": null, "cvc_check": "pass", "address_line1_check": null, "address_zip_check": null, "dynamic_last4": null, "metadata": { }, "customer": "cus_5pnSCVpMBNlSrj" }, "captured": true, "balance_transaction": "txn_15bjRh2eZvKYlo2Ch4I6lxJ7", "failure_message": null, "failure_code": null, "amount_refunded": 0, "customer": "cus_5pnSCVpMBNlSrj", "invoice": null, "description": "Charge for DOC-AID consultation for Camden Remington", "dispute": null, "metadata": { }, "statement_descriptor": null, "fraud_details": { }, "receipt_email": null, "receipt_number": null, "shipping": null, "refunds": { "object": "list", "total_count": 0, "has_more": false, "url": "/v1/charges/ch_15e7rU2eZvKYlo2CxWE8afA9/refunds", "data": [

] }}

Web API(this is the s**t)

Why APIs?

LinuxAndroidWindowsAliens

Web Services

Intercommunication

a software system designed to support interoperable machine-to-machine interaction over a network

has an interface described in a machine-processable format

Web Services

RESTfula software architecture style consisting

of guidelines and best practices for creating scalable web services.

Client–serverStatelessCacheableLayered system

Requirements

base URI, such as http://example.com/resources/

an Internet media type for the data. This is often JSON but can be any other valid Internet media type (e.g. XML, Atom, microformats, images, etc.)

standard HTTP methods (e.g., GET, PUT, POST, or DELETE)

hypertext links to reference state hypertext links to reference related

resources

Requirements

Resource GET PUT POST DELETE

Collection URI, such as http://api.example.com/v1/re

sources/

List the URIs and perhaps other details of the collection's members.

Replace the entire collection with another collection.

Create a new entry in the collection. Delete the entire collection.

Element URI, such as http://api.example.com/v1/re

sources/item17

Retrieve a representation of the addressed member of the collection.

Replace the addressed member of the collection, or if it does not exist, create it.

- Delete the addressed member of the collection.

Paypal/ Stripe (Billing) OpenStreetMaps [nomatim] (Geospatial

services) data.worldbank.org (statistics) GNU Health (ERP for healthcare)

Usage of APIs

Virtual Hands-onLet’s do this

A simple Inventory Management System Case Study

DistributorsRetailersSKUs

Entities

MyInventory

Case 1Desktop Application

Development Tech: C# DB: None – File based approach OS: Strictly Windows Specifications

Simple, one server, tightly coupled user-interface bound to backend

Case 1 - Architecture

Quick to develop Quick to market Single responsibility product Fixed cost

Case 1 - Advantages

Single use – single deployment Not scalable Not extendable Costly to maintain in the long run

Case 1 - Challenges

Case 2MyInventory as a Web Service

Server Development Tech: PHP, Rails, NodeJS DB: MySQL, SQL Server, MongoDB OS: Debian

Client Development Tech: JS, HTML, Android, iOS DB: - OS: -

Specifications

GET distributors/{id?} List

POST distributors Create

PUT distributors/{id} Update

DELETE distributors/{id} Delete

REST at work

We can run it in mobile too

Can be simple, with database and interface installed on same machine

Can be complex, single server installation and N-tier clients via API

Case 2 - Architecture

Scalable Platform agnostic solution Easy to test, decoupled

functionality vs. interface

Case 2 - Advantages

Multiple versions/platforms can be costly to implement

Higher technical complexity on development and deployment

Case 1 - Challenges

Resources

Terms OData (Open Data Protocol) JSON Service Oriented Architecture

Technologies OAuth

Websites mashape.com apigee.com publicapis.com data.worldbank.com