Tuesday, May 14, 2019

Class relations

Lock classes and relationships

Inheritance

User Class

class User():
    def __init__(self,name, email, securityLevel):
        self.name=name
        self.email=email
        self.securityLevel=securityLevel

    def getName(self):
        return self.name
    
    def getEmail(self):
        return self.email

    def getSecurityLevel(self):
        return self.securityLevel

    def __str__(self):
        return self.name + ", " + self.email

Staff Class

from user import User

class Staff(User):
    def __init__(self, name, email, securityLevel, position):
        self.name=name
        self.email=email
        self.securityLevel=securityLevel
        self.position=position

    def getPosition(self):
        return self.position

    def __str__(self):
        return super(Staff, self).__str__() + ", " + self.position

main

from staff import Staff
def setUser():
    s=Staff('Sue', 's@gmail.com', 'high', 'Janitor')
    print(s.getEmail())
    print(s.getName())
    print(s)

def main():
    setUser()

main()

Tuesday, April 30, 2019

Class diagram

Just a note: the video for this did not record

Background

GW-Basic, Fortran, Cobol, Top to bottom
hard to debug, not reusable Goto
Structured programming c pascal ADA functions
code reuse -- call function, debugging was easier
Objects --break the code into natural groups of functions that
reflect the structure of what you are working with
door(lock), card, scan, user, validation,
Object contains fields and methods
C++, Java, C#, Objective C
Python, php, JScript, ruby

Theory

Abstraction--abstract classes, interfaces
Encapsulation--lego idea-- every class should be self contained,
internal should be private
Inheritance--get all the public fields and
methods from the parent classes
Polymorphism--different behaviors for different environments
Overriding and overloading

Diagrams

User Class

Lock Class

More complete diagram

Tuesday, April 23, 2019

Activity diagram

Manage access activity diagram

Security alert

Security Alert

Forks and Joins

Thursday, April 11, 2019

Use cases

Locks ERD

Here is the link to the use case diagrams

Security Use case

Inheritance

Written Use Case 1

Written Use case 2

Thursday, April 4, 2019

Class Discussion ERD

Security system uses key cards.

People (administrator,students, staff,faculty, Custodial, security)

Departments

Rooms--locks

Security levels--people--rooms--server, computer labs

Smart cards: info is on the card

*Dumb cards--just a number--

Which card has access to which rooms at which times

Grouping of rooms

emergency opening and locking of doors

log every swipe--logging card number and lock

Alert if door open --swipe three times and fail

Here is a a picture of the ERD

here is the link to the ERD in LucidCharts

Systems Beginning

Definition: A System consists of parts that work together to accomplish a task or goal

A car engine, a computer, a body, an economy, or a planet's ecology can be a system

Definition: a sub system is a set of components that work together to accomplish a task or goal which contributes to the larger system.

Examples, the fuel or electrical systems of an engine, the circulatory system, the supply system, the water cycle.

Systems Analysis consists of identifying systems and their purpose, and the identifying--breaking them into--their component parts and determining how those parts interact with the whole.

The idea is to break complex processes into simpler pieces that can be understood and manipulated much more easily than the system as a whole.

The various techniques of systems analysis were developed to aid this process and increase the chances of success.

Most attempts to create and replace systems fail.

Reasons for Analysis

Typically one analyzes a system in order to understand some business process in order to automate it or improve the existing automation

The first steps would be to identify the system to be considered and its outcomes.

Then you would define the requirements of the replacement system

Thirdly you would identify any number of possible solutions that meet those requirements. You would analyze the feasibility of each potential solution financially,temporally , technologically, legally and culturally.

That done, you would choose one and setup a project with the timeline, personnel and resources to complete the project.

Then you test the product, fix any errors and deploy it. After deploying it, you maintain it until such a point as the process needs to start over.

In most contemporary organizations, systems are monitored continuously. Analysis, development, deployment and maintenance are all happening simultaneously.

Tuesday, March 5, 2019

Admin commands

--System queries
Select * from information_Schema.tables
Where table_schema='public';

Select table_schema, table_name, is_updatable
from information_schema.views
Where Not table_schema='pg_catalog'
And not table_schema='information_schema';

Select column_name, data_type, constraint_name, constraint_Type
From information_schema.columns
Join information_schema.table_constraints
on information_schema.columns.table_name=information_schema.table_constraints.table_name
where information_schema.columns.table_name='grantapplication'
Order by column_name;

--index
Create index on Person(personlastname);

Alter index person_personlastname_idx 
rename to idx_lastname;

Select Grantapplicationkey, grantapplicationdate, personlastname, grantapplicationamount
From grantapplication
join person
using (personkey)
Where personlastname = 'Blake';

Create unique index on person(personprimaryphone);

Create index on grantapplication (granttypekey, personkey);

Create index on donation(donationamount)
Where donationamount > 500;

--roles
Create role employeerole;

Grant connect on database communityassistpg to employeerole;
Grant usage on Schema public to employeerole;
Grant SELECT on All Tables in schema public to employeerole;
Grant usage on Schema employeeschema to employeerole;
Grant SELECT on All Tables in schema employeeschema to employeerole;

Create Role janderson with password 'P@ssw0rd1' Login inherit;

Grant employeerole to janderson;