Programming and Python

Ace your homework & exams now with Quizwiz!

Variables

A container for a single data value. Unlike an object, a variable does not include instructions (methods). Unless it is declared as a constant, the value of a variable may vary during the execution of the program.

Polymorphism

A programming language's ability to process objects differently depending on their data type or class.

Data structures

A scheme for organizing related pieces of information. The basic types of data structures include: arrays, tables, lists, files

Decision logic flow (diamond)

Flows across or DOWN the page and step(s) performed 0 or 1 time.

Repetition logic flow (diamond)

Logic flows back UP the page and step performed 0 to many time or 1 to many times, depending on the logic structure.

How to denote the beginning and end of code in VBA

Marking pairs •Sub..End Sub •Function...End Function •Module...End Module •Class....End Class •For...Next •Do...Loop •If...End If

Set

Similar to a dictionary with its keys only - no associated values. Like a dictionary, each key must be unique. You use a set when you only want to know that something exists, but don't need the key related to any further data To create a set, you use the set() function or enclose one or more comma-separated values in curly brackets. e.g. setname=set()

String in Python

You make a Python string by enclosing characters in either single quotes or double quotes. Use + to concatenate (join strings together) (& is a Set intersection operator) * Denotes multiplication when used with numbers. You use the * operator to duplicate a string. * has yet another use with functions (later).

Example of using Try (catch) except to validate if only integers entered by using the int function:

def inputNumber(message): while True: try: userInput = int(input(message)) except ValueError: print("Not an integer! Try again.") continue else: return userInput break #MAIN PROGRAM STARTS HERE: age = inputNumber("How old are you?")

Array

data structures that allow you to store and work with multiple values of the same data type. You can create different types of arrays (numeric, character, string). Arrays are not in python starts at 0 not 1 array(row,column)

Storing a value in python (inputs)

objectnamewhereyouwillstoreuserresponse = input("message displayed") name = input("What's your name? ")

Events

- Actions that are triggered by •the user, •other objects, •the operating system User presses a submit button, or selects an item from a combo box, or selects a radio button, or changes a value, or opens a form, or mouses over an area of the screen, etc

Object Property

-A property is an attribute to which you assign a value. (For example, a flower 's attributes/properties might include name, color, size, care while a student's attributes/properties might include name, ss#, age, phone) -objectname.propertyname For example, Textbox1.text or employee.name

Recursion and serious logic issues

-Avoid infinite recursion -Infinite loop of procedure calls Public Sub Process1() Call Process2() End Sub Public Sub Process 2() Call Process1() End Sub -Avoid infinite recursive loop/infinite do loop Dim x as integer x=1 Do while x=1 ....lines of code that never reset x to anything but 1 Loop -These lead to stack overflow issues

Python Error /Exception handling

-Python handles errors via the logic of try and except. -Errors/exceptions that are caught in try blocks and handled in except blocks. while True: try: x = int(input("Please enter an integer: ")) break except ValueError: print("Oops! That was not a valid number. Try again...")

List of sub processes

1) Sub 2) Event Handlers 3) Functions 4) Methods 5) Components (groups of functions)

Event Handler

A block of code written to generate outcome or action based on specified event. Sits dormant until event occurs

Class

A category of objects. The class defines all the common properties of the different objects that belong to it.

Functions

A function often receives input (called arguments) and is specifically written to return a result value. -in python, function doesn't have to return value

Collection

A group of items with the same characteristics, often a group of objects of the same class ex. -Workbooks is a collection of all Workbook objects. -Worksheets is a collection of Worksheet objects. -Sheets is a collection of all the sheets in the workbook (both chart sheets and worksheets). -Not the same as a class

Procedure

A section of a program that performs a specific task.

How do units of code (subs, functions, event handlers, etc) talk to each other

By calling a sub process and passing values (arguments) based on parameters

Functions in VBA and Python

Can be written by the user or the user may use functions already written for them by the team who wrote the programming language (built in functions). VBA Excel worksheet functions Functions written using VBA VBA functions DAX functions Python Functions written by user Builtin Functions

Objects blend..... into a single element

Data and Algorithms

Units of code that perform tasks or sets of tasks?

Depends on the language used but; 1) Sub 2) Event Handlers 3) Functions 4) Methods 5) Components (groups of functions)

Places to store values in Python

Everything is stored in an objects •Lists •Dictionaries •Sets Tuples

How to denote the beginning and end of code in Python

Indentation

method vs. function

Methods are stored in a class and can be associated with an object A function can be its standalone code as well as its own object (in Python)

Object-oriented programming (OOP)

Programming (software design) in which programmers define the data type of a data structure, and also the types of operations (functions) that can be applied to the data structure. Data structure becomes an object that include BOTH data (properties) and functions (methods)

Python Importing libraries

Python comes with a standard library of modules that perform many useful tasks, and are kept separate to avoid increasing the size of the core language. When you're about to write some Python code, it's best to first check whether there's a standard module that already does what you want

Declaring in Python

Python has only objects, no declarations required

Python Open File Input/Output

Read Data from a Text File and Print to Screen (Windows users, for an easy way to get your file path, open Explorer and find the file name. Right click on it and choose Properties. copy location. Copy the location to the code below, but change the direction of slashes.) line_number = 0 myfile=open('C:/filepath/filename.text') for a_line in myfile: line_number += 1 print('{:>4} {}'.format(line_number, a_line.rstrip())) ., fileobj = open( filename, mode ) Write a Text File with write() Read a Text File with read(), readline(), or readlines() Write a Binary File with write() Read a Binary File with read()

Logic Flow chart shapes and their meaning

Rectangle- Sequence step Diamond- Decision/Condition/ Repetition test Parallelogram- Display message for Input or Display Output Pill- Begin or end Rectangle with two lines within= Predefined process Arrow- flow of diagram

Scope of Code

Scope/access levels of code impacts which subprocesses can "see" and call other subprocesses. Scope of code is who can see the code, the eventhandler, module VB Public function -it will show up in the pull down menu on functions Private- doesn't show up but can still use in a worksheet, be nervous about Sub Private- wont show up in the macro list , can still run it/call it Doesn't matter if the code is public or private if they are in the same module Cant see each other if they are private and in different modules If public they can see each other even if in different modules Local takes precident or the computer

Locations for outputs

Screen, Files, Paper (printing), Databases, System generated sound, etc.

Python Type Conversions (data casting)

Sometimes, you need to change the data types of objects (to avoid data type mismatch issues). •To change other data types to an integer, use the int() function. This will keep the whole number and discard any fractional part. •To convert other types to floats, you use the float() function. •You can convert other data types to strings by using the str() function. •Python's list() function converts other data types to lists. •The tuple() conversion function makes tuples from other things. •You can use the dict() function to convert two-value sequences into a dictionary. •Convert from other data types with set(). You can create a set from a list, string, tuple, or dictionary, discarding any duplicate values.

User Interface

The junction between a user and a computer program. An interface is a set of commands or menus through which a user communicates with a program.

if __name__ == "__main__": main()

This is because before the Python interpreter executes your program, it defines a few objects. One of those objects is called __name__ and it is automatically set to the string value "__main__" when the program is being executed by itself in a standalone fashion. On the other hand, if the program is being imported by another program, then the __name__ object is set to the name of that module. This means that we can know whether the program is being run by itself or whether it is being used by another program and based on that observation, we may or may not choose to execute some of the code that we have written. So if someone imports a file or just calls it with Python from the terminal prompt, e.g., $ python hello.py They can include an if statement that asks if __name__ and it is set to the string value "__main__" . It will be since it is the start of the processing, so the code will go to whatever function is included in the if logic (main() in the example above).

PROCESS (sequence) symbol

Used to show calculations, assigning values to variables/objects, and other "process steps" that take place within a program. - Use for any non decision, non input/output, non start/stop, non connector point Rectangle

Extracting substrings in Python

Using a slice (using numbers and symbols when referring to string). You define a slice by using square brackets, a start offset, an end offset, and an optional step size • [:] extracts the entire sequence from start to end. • [ start :] specifies from the start offset to the end. • [: end ] specifies from the beginning to the end offset minus 1. • [ start : end ] indicates from the start offset to the end offset minus 1. • [ start : end : step ] extracts from the start offset to the end offset minus 1, skipping characters by step.

Declaring variables in VBA

VBA doesn't require declaration (it comes up with its own data type) can be problematic Dim variablename as datatype example: Dim x As Integer (assigning a value) Variablename = value example: x=40

Python arguments and calls

Values are shared by code via passing them. However, they do not have to share the same name. The receiving code can refer to the value as an alias. The arguments passed (the list in the call command) are matched up to the parameters (the list in the first line of the receiving code structure) by their placement in the list separated by commas. Positional arguments - Argument values are copied to their corresponding parameters in order. Keyword arguments - You can specify arguments by the names of their corresponding parameters and not follow the order listed in the function definition statement. Default parameters - You can specify default values for parameters. The default is used if the calling line of code does not provide a corresponding argument.

Arguments

When you call a subprocess, you can pass values (literals/values, objects, variables, arrays...). The values you pass are called arguments The items in the call parentheses are being passed to the function. We refer to these as arguments and they are separated by commas.

Parameters

When you define/declare a subprocess (write the event handler, method, function, sub code), you specify the values that it will accept in its declaration statement. These values are called parameters and the declaration statement specifies what the values will be called during processing in the sub. elements, when housed in the def statement, are called parameters and they are separated by commas. Unless you specify otherwise, order is important.

Collection

a group of items with the same characteristics, often a group of objects of the same class. Many Excel objects come in collections (collections of worksheets, collections of cells in ranges, etc..). Excel Examples (notice the label ends in s):Workbooks is a collection of all Workbook objects. Worksheets is a collection of Worksheet objects. Sheets is a collection of all the sheets in the workbook (both chart sheets and worksheets). Controls on a userform constitute a collection.

False Values in Python

boolean False null None zero integer 0 zero float 0.0 empty string '' empty list [] empty tuple () empty dict {} empty set set() anything else is considered true

Initialize

place the original value in a variable, array, object property, list, etc. -If it is mutable, value can be changed during processing. -If it is immutable or constant, the value cannot be changed during processing.

Assigning a value

placing a value in a variable, array, object property, list, etc

Outputs in Python and VBA

print( ) function - notice lowercase MsgBox()

Instantiate

using the template (properties and methods) defined in a class to create a new instance of an object, an object that you can use in a program. When you create a new object in memory, you instantiate the object (create an instance).

Object Oriented Programming

-Organize programs as objects (data plus behaviors) -Blurs the line between data and algorithms by housing both data and algorithm instructions within a single object

Traditional programming (data+algrithms)

-You hard code the behavior of the application. -Create a suitable algorithm, then write the code. -The programmer sets the mandatory input parameters and a valid programmed algorithm will produce the expected result.

Sub processes in VBA

1) Function -Has to return a value (receives arguments, returns a value) -Can do anything a sub can do 2) Event handler 3) Subroutines (Subs) Sub is just doing a part of the steps (can share with it some values and can choose if I want to change or not change) -Don't have to return values

Objects consists of 2 parts

1) Properties = data values 2) Methods= object behaviors

Tuple

are similar to lists because both are groupings/sequences of arbitrary items. Unlike lists, tuples are immutable, meaning you can't add, delete, or change items after the tuple is defined. So, a tuple is similar to a constant list. Create a Tuple by Using () e.g., tuplename=() You can use many of the same methods with tuples that you used with lists, but there are fewer option because they can not be modified as creation (so no append, insert, etc.)

•DECISION symbol

•Used to show that the program must test a condition and decide a path based on outcome. YES and NO (or True/False) branches are usually shown. - Used in BOTH decision and repetition algorithm elements. -When used in decision logic, logic flows across or DOWN the page and step(s) performed 0 or 1 time. - When used in repetition logic, logic flows back UP the page and step performed 0 to many time or 1 to many times, depending on the logic structure. Diamond shaped

List

•order important, mutable meaning you can insert and delete elements, 0 or more elements, can have same elements > once, choose element via offset (such as 0, 1, etc) Note- List comprehension (a way to define and create lists based on existing lists). is an ordered collection of values. Lists can be indexed, sliced and manipulated with other built-in functions Create with [] e.g. listname=[ ] A list is made from zero or more elements, separated by commas, and surrounded by brackets.

Predefined PROCESS symbol

•Used to indicates a set of steps that combine to create a sub-process that is defined elsewhere in the documentation set. (Program control flows to a DIFFERENT Unit of Code) Rectangle with stripes

Traditional computer program

-A set of detailed directions telling the computer exactly what to do, one step at a time. - A program can be as short as one line of code, or as long as several millions lines of code. Input--->Process---->Output

Machine Learning programming (math/stats + algorithms)

-A subset of AI (artificial intelligence), machine learning denotes systems that can learn from experience. -It is a field of study that gives computers the ability to learn without being explicitly programmed. In other words, the computer behavior is based on learning from data (observations and real-world interactions). -Programmers collect an array of historical data and that data is used for model building. (So no need to build a model in advance.) - Data are loaded into the machine learning algorithm. The result is a model that can predict a new result when receiving new data as input

Data types

-Booleans -only the values True and False. When converted to integers, they represent the values 1 and 0: - Numbers can be integers (1 and 2), floats (1.1 and 1.2), fractions (1/2 and 2/3), or even complex numbers. -Strings are sequences of Unicode characters, e.g. an HTML document. -Bytes and byte arrays, e.g. a JPEG image file. - Lists are ordered sequences of values. -Tuples are ordered, immutable sequences of values. -Sets are unordered bags of values. -Dictionaries are unordered bags of key-value pairs.

Data type

-Classification of a particular type of information -Most programming languages require the programmer to declare the data type of every data object, and most database systems require the user to specify the type of each data field. -The available data types vary from one programming language to another, and from one database application to another, but the following usually exist in one form or another: Integer= Whole numbers Floating-point= Decimal numbers Characters (text)= readable text

Inheritance

-Creating a new class from an existing class but with some additions or changes. The original class is called a parent, superclass, or base class; the new class is called a child, subclass, or derived class. -It's an excellent way to reuse code

Imperative approach - Explicit programming

-Focus is on how the problem should be solved and requires detailed, step by step instructions for solving a problem (similar to a recipe). Language examples include C, C++,C#, and Java Imperative programming requires an understanding of the functions necessary to solve a problem, rather than a reliance on models that are able to solve it. - Because the written code performs the functions instead of models, the programmer must code each step. - Imperative programming contrasts with declarative programming,

Declarative approach, also called model-based programming - Implicit programming

-Focuses on what to execute, defines program logic, but does not detail control flow. -The exact manner in which the problem is solved is defined by the programming language's implementation through models. Language examples include SQL, HTML, XML and CSS.

Break and Continue statements, and Else clauses in Loops

-You can cancel iteration with break (but don't use those in lieu of good logic) and you can skip ahead in code with continue. -The break statement breaks out of the smallest enclosing for or while loop. -The continue statement, continues with the next iteration of the loop. -The pass statement does nothing. It can be used when a statement is required syntactically but the program requires no action.

4 Things to think about to think like a business technologist

1) Approach and solving problems by BREAKING THEM DOWN (decomposition) 2) Focusing on the most important information (abstraction) 3) Understanding your users- the ones who will be using you products or services you create (User Experience and User persona ) 4) Identifying key steps, decisions, and process flow (Algorithms)

Repetition coding construct examples

1) DO While/UNTIL.....Loop (Do While/Until condition met Process1 Process2 ProcessN Loop to Do and retest condition) -TEST AT TOP 2) DO.... Loop While/UNTIL or While (Do Process1 Process2 ProcessN Loop (to Do) Until/While condition met) -TESTS AT BOTTOM 3) For (For i= 1 to 5 Process1 Process2 ProcessN Next) -RUNS ON A SPECIFIED RANGE OF OBJECTS -TESTS AT TOP 4) Foreach ( Foreach Process1 Process2 ProcessN Next) RUNS BASED ON EVERY OBJECT IT SEES

Python Decision and Repetition Logic Code

1) Decision- If, else, elif -The if and else lines are Python statements that check whether a condition is True. -Testing with if, elif, and else runs from top to bottom. 2) Repetition- While, for ,for each -The simplest looping mechanism in Python is while. You can also iterate with For.Python has the ability to implement both For..each (object in a collection) and For a specified number of counts logic

4 places to store code in VBA

1) Excel Object Modules -Contain event procedures for the single objects such as individual worksheets, chart sheets, or a workbook 2) Class Modules -In addition to using the Excel application object classes written for you, you can create your own classes, collections and objects. 3) User Forms contain code for the controls on UserForm objects, which can provide user interfaces on which you can place graphical controls, such as buttons, images, and text areas 4) Standard Modules -Sometimes referred to as standard Code Modules, contain custom macros, functions, and event procedures for workbooks, worksheets, and other objects

Decision coding construct examples

1) IF (T/F) 2) IF ... THEN (if condition met,then process) 3) IF .... THEN.... ELSE (if condition met, then process 1, else process 2 4) Nested IF, IF...THEN...ELSE...IF (if condition met, then process 1, else start new IF)

Three types of steps that are featured in algorithms

1) Sequence steps 2) Decision Steps 3) Repetition Steps

Algorithms

A list of step-by-step instructions for how to complete a task. -One way to document an algorithm is to draw a logic flowchart. This is a diagram that uses different symbols and arrows to show the different steps in a process.

User Persona

A made-up profile for a person who matches the characteristics of someone who might use a particular product

Sequence (Process) steps

A step that is always to be performed, and only performed ONE time -Resides OUTSIDE of decision or repetition blocks of code. -Executed in a specific order

By reference

Access to change the value This means that you pass the memory address of the argument to the called procedure. So the called procedure does not get a copy of the value of the argument. It gains access to the actual argument at its memory address. The argument's value can be changed by the receiving (called) procedure. Any computer instructions carried out by the called procedure that affect the value of the argument are permanent, meaning that when the lines of code in the called procedure are completed, the argument retains the revised value. The original value of the argument when it entered the called procedure is lost.

Decomposition

Breaking down the big project into smaller parts, like making a to-do list. Once you have a list of all the tasks you need to complete for your project, you can figure out the best path forward.

List commands in Python

Change an Item by listname[ offset number ] e.g., listname[offset number] = new value You can extract a subsequence or range of a list by using a slice. e.g., listname[0:2] Add an Item to the End of a list with append() e.g., listname.append() Combine Lists by Using extend() method or += . e.g., listname.extend() or listname += listname Add an Item by Offset with insert() - Append() adds items only to the end of the list. When you want to add an item before any offset in the list, use insert(). Offset 0 inserts at the beginning. e.g., listname.inset(offset number, value) Delete an Item by Offset with del statement (del is a statement, not a list method) >>> del listname[-1] Or Delete an Item by Value with remove() method e.g., listname.remove() To retrieve and item and delete it at the same time, use pop() Find an Item's Offset by Value using listname.index() Count Occurrences of a Value by using listname.count() Check for the existence of a value in a list is using in: >>> marxes = ['Groucho', 'Chico', 'Harpo', 'Zeppo'] >>> 'Groucho' in marxes Output - True Count elements in a list (len).

Class code

Create a class by using the keyword class followed by the class name and a colon. Recall that you can use functions inside a class block of code to define the methods an object will be able to perform when used outside the class sturure, e.g., Objectname.method() Inside the class, you can also define the object properties (attributes).

Data storage rules with code

Data stored more permanently outside an application (e.g., in a data base or file) can be accessed by the application via lines of code. In addition, an application can create and "hold" data values during processing. However, once application processing ceases, those values created during processing are gone unless saved (which is why applications need lines of code that store any desired changes to data sources/destinations - e.g. data bases).

Python by ref by val

Doesn't have by ref by val #Python originally behaves as pass by reference #once change value, effectively creating new object, #python switches to pass by value

Subprocesses in Python

Functions -May or may not return a value no retruned value== Functionname(list of arguments) Returned with a value==value=Functionname(list of arguments) You use the keyword Def to define a function block of code followed by a colon (:) and the indentation of the code itself. Function names have the same rules as object names (they must start with a letter or _ and contain only letters, numbers, or _).

Type Casting VB

Implicit conversions: An implicit conversion does not require any special syntax in the source code because VB attempts to perform the conversion for you. When two data types you are manipulating are compatible with each other, then the conversion of one type to other is performed by the VB compiler (so the user does not have to perform the conversion). However, the result may not be what you want.

Locations of input data for processing

Lines of Code Users (via keyboard, voice, mouse, touch, etc.), Magnetic strips RFID devices OCR characters Databases and files, etc.

Places to store code in Python

Modules -A file containing function definitions and executable statements -When you write class code and save it to a separate file, that file is called a module. -You can have any number of classes in a single module.

Interface (API)

The languages and codes that the applications use to communicate with each other and with the hardware.

Type Conversion VB

Type casting, on the other hand, is explicitly performed by the programmer. Explicit conversions (casts) use a type conversion keyword/operator. Explicit Casting is required when information might be lost in the conversion, or when the conversion might not succeed for other reasons. Typical examples include numeric conversion to a type that has less precision or a smaller range.

By value

Value comes back unchanged The procedure that is called makes a copy of the value of the argument and makes that copy available. That way, the argument itself is not accessed, but its value can be used by the called procedure. At the end of the called procedure, the argument's original value (the value at the time the procedure was called) is unchanged when the code returns to the calling procedure. NOTE - but strange things/exceptions happen when you pass arrays. Why??

Dictionary Commands

You can use the update() function to copy the keys and values of one dictionary into another (combine dictionaries). Add or change an item by [key] e.g., dictionary[key]= new value Delete an Item by Key with del e.g., del dictionary[key] Delete All Items by Using clear() e.g., dictionary.clear() Test for a Key by Using in e.g., value in dictionary You specify the dictionary and key to get the corresponding value. e.g. dictionary[keyvalue] . If you do not specify a default value and no record is found, the system returns the value None. e.g., Dictionary.get(keyvalue, default value if not found) You can use dictionary.keys() to get all the keys in a dictionary. To obtain all the values in a dictionary, use dictionary.values(): When you want to get all the key-value pairs from a dictionary, use the items() function: >>> list( dictionary.items() )

Object Method

objectname.propertyname For example, Textbox1.text or employee.name Some methods may include parameters called arguments that are separated by commas, with := syntax if you include the argument name (argument name:=argument).

Subprocess (separate pieces of code)

subroutines, subs, functions, event handler subs, methods, or components These are separate pieces of code executed on demand via a call. When called, the subprocess code is executed and when it concludes, the program processing returns to the line of code where the subprocess was called

Encapsulation

•Encapsulation is the inclusion of one thing within another thing so that the included thing is not apparent. •The characteristic in which data and behavior are bundled into a class and hidden from the outside world. •Sometimes referred to as data hiding, it is the technique of making the fields in a class private (so the data can be seen only by the class that owns it). •Access to the data and behavior (methods) is provided and controlled through an object's interface. This prevents the code and data being randomly accessed by other code defined outside the class. The process of combining elements to create a new entity. A procedure is a type of encapsulation because it combines a series of computer instructions.

INPUT/OUTPUT (data) symbol

•Shows when information/data comes into a program or goes out. -Input examples include prompting user for input, reading from a file, etc.. -Output examples include printing, displaying to screen, storing to a file. Parallelogram

Begin/End symbol

•Used at the beginning and end of each flowchart, process, and/or sub process. Pill shaped

Generalization

The process of extracting shared characteristics from two or more classes, and combining them into a generalized superclass. •A generalization describes the relationship between a more general (or parent) class and a more specific (or child) class. •The more specific class has additional attributes and operations •A generalization shows what one class inherits from another. For example, both dogs and cats are animals, so you can generalize some attributes from the animal class to either cats or dogs.

Abstraction (OOP)

The process of picking out (abstracting) common features of objects and procedures.

Abstraction

The process of representing the most important parts of something without including complex background information or details. The goal is to remove characteristics so that you can reduce things to a set of essential characteristics.

Value Scope

The scope of a declared element is the set of all code that can refer to it without qualifying its name or making it available through an Imports Statement (.NET Namespace and Type). An element can have scope at one of the following levels:

Comments in code

a piece of text in your program that is ignored by the code interpreter, compiler or translator.. # for python ' for VB

Graphic User Interface (GUI)

a user interface in which icons represent applications, files, and commands

Dictionary

similar to a list, but the order of items doesn't matter, and they aren't selected by an offset such as 0 or 1. Instead, you specify a unique key to associate with each value. This key is often a string, but it can actually be any of Python's immutable types: boolean, integer, float, tuple, string, etc. Dictionaries are mutable, so you can add, delete, and change their key-value elements. In Python, a dictionary is also called a dict for short. In other languages, dictionaries might be called associative arrays, hashes, or hashmaps. create a dictionary, you place curly brackets {} around comma-separated key : value pairs. e.g., dictionaryname={ }

Declaring a variable

- naming a single value placeholder for use in a program, and defining its data type. You are telling the computer that you want this variable or object to exist, so the computer allocates space for it.

Excel object hierarchy

A hierarchy of all the objects coded into Excel and available for you to access via VBA code. Excel provides hundreds of objects with which you might want to interact, but much of the work done with Excel centers around these four classes and their members: •Application Object •Workbooks Object •Worksheet Object •Range Object

2 traditional programming approaches

1) Imperative Approach (explicit) 2) Declarative Approach (implicit)

Object

A self-contained entity that consists of both data and procedures to manipulate the data. -programming constructs that have data, behavior, and identity (Property + Methods)

Decision (Selection) Steps

A step (or steps) that you may or may not do depending on the outcome of a decision (blocks of code) -Runs either ONE or ZERO times - Executed after conditions are tested

Repetition (Iterations or Looping) Steps

A step (or steps) that you want repeated either; (Blocks of code) -TESTING AT THE BOTTOM OF THE STRING -0 to Many times -1 to Many times -A set number of times

Components

An identifiable part of a larger program or construction. Usually, a component provides a particular function or group of related functions. In programming design, a system is divided into components that in turn are made up of modules . Component test means testing all related modules that form a component as a group to make sure they work together. 2) In object-oriented programming and distributed object technology, a component is a reusable program building block that can be combined with other components in the same or other computers in a distributed network to form an application. Examples of a component include: a single button in a graphical user interface, a small interest calculator, an interface to a database manager.

Component of Code

An identifiable part of a larger program or construction. Usually, a component provides a particular function or group of related functions. In programming design, a system is divided into components that in turn are made up of modules . Component test means testing all related modules that form a component as a group to make sure they work together. In object-oriented programming and distributed object technology, a component is a reusable program building block that can be combined with other components in the same or other computers in a distributed network to form an application. Examples of a component include: a single button in a graphical user interface, a small interest calculator, an interface to a database manager.

Block scope

Available only within the code block in which it is declared (e.g. If, Case, Do, For)

Namespace scope

Available to all code in the namespace in which it is declared

Module scope

Available to all code within the module, class, or structure in which it is declared

Procedure scope

Available to all code within the procedure in which it is declared

User Experience

The feelings and attitudes a person has when they are using a product.

Places to store values in VBA

•Variables- only hold values (dumb) •Object Properties Arrays


Related study sets

Chapter 7: Creating Republican Governments, 1776-1790

View Set

Dante's Inferno- cantos 9, 24, 26, 34 review questions

View Set

Reproductive Drug Questions (Book, Practice, Evolve and Study Guide)

View Set

Study for quiz 4/Consumer Science Unit 9

View Set