Lecture 3. Miscellaneous Ruby and Testing 1 / 48

Size: px
Start display at page:

Download "Lecture 3. Miscellaneous Ruby and Testing 1 / 48"

Transcription

1 Lecture 3 Miscellaneous Ruby and Testing 1 / 48

2 Homework 1 Grades were released! TAs provided feedback on best practices, but did not take off points Keep the comments in mind for future assignments! Any questions? 2 / 48

3 Homework 2 Homework 2 was due last night Any questions? 3 / 48

4 How would you rate the di culty of Homework 2? Vote at 4 / 48

5 CIS 19x Lecture This week's lecture was on How the Web Works It was the last one Questions from the lecture? 5 / 48

6 What does git clone do? Makes a clone of a specific file Makes a clone of a specific folder Clones an existing repository into a new directory This isn't a real git command Vote at 6 / 48

7 What does git add do? Specifies that you would like to include updates made on the provided file in the next commit Adds a file to your remote Git repository Add text to an existing file This isn't a real git command Vote at 7 / 48

8 What does git commit do? Commits your staged files to the project history locally Commits your staged files to the project history remotely (i.e. GitHub repository) This isn't a real git command Vote at 8 / 48

9 What does git push do? Pushes changes from your remote repo to your local directory Pushes your committed changes to your remote repo This isn't a real git command Vote at 9 / 48

10 O ce Hours Weekday Time TA Location Monday 5-7 Zhilei Moore 100 Tuesday 6-8 Edward Harrison Mezz 8-10 Sanjana Harrison Mezz Wednesday 7-9 Zena Moore 100 Thursday 5-7 Desmond Moore / 48

11 Variables 11 / 48

12 Constants Constants start with a capital letter By convention, they should be in all upper case and separated with underscores Like variables, but their value should never be changed once set Ruby will allow you to change them, but it will output a warning They can be accessed from another class or module with :: class Foo BAR = 'bar' end p Foo::BAR #=> "bar" 12 / 48

13 Global Variables Denoted with a $ in the beginning of the identifier They are accessible throughout the entire Ruby program and never go out of scope They generally provide information you would want regardless of where in the program you are For example, $0 returns the name of the startup file for the program You should never create new global variables unless you know what you're doing 13 / 48

14 Regular Expressions 14 / 48

15 Regular Expressions Regular expressions are usually instantiated with // from the Regexp class They match patterns For example, if I wanted to find all letters in the string h3l1o w0r1d: 'h3l1o w0rld'.scan(/[a-za-z]/) #=> ["h", "l", "o", "w", "r", "d"] And if I wanted to find all numbers: 'h3l1o w0rld'.scan(/[0-9]/) #=> ["3", "1", "0"] 15 / 48

16 Methods to Match String#scan Returns an array of all matches Returns an empty array if there is no match String#=~ or Regexp#=~ Returns the index where the Regexp matches the string Returns nil if there is no match String#match or Regexp#match Returns a MatchData object that can be used to get more info about the match Returns nil if there is no match 16 / 48

17 How to Write Regexes Use Rubular You can match with: literal characters dot wildcard characters character classes 17 / 48

18 Literal Characters The exact characters in the regular expression are used 'abcd'=~ /a/ #=> 0 'abcd'=~ /ab/ #=> 0 'abcd'=~ /ac/ #=> nil 18 / 48

19 Dot Wildcard Characters Using a dot (.) will match any character in that place To match for an actual dot, escape it with the backslash (\) This is also true for any other special characters (\, #, +) 'cat bat data'.scan(/.at/) #=> ["cat", "bat", "dat"] 'hello. loco. world'.scan(/.o\./) #=> ["lo.", "co."] 19 / 48

20 Character Classes A list of characters can be denoted with square brackets ([]) 'cat bat sat'.scan(/[cb]at/) #=> ["cat", "bat"] These also support ranges with a hyphen (-) To search for all letters, use [a-za-z] 'hi Bye'.scan(/[a-hB-G]/) #=> ["h", "B", "e"] 20 / 48

21 Common Character Classes Instead of constantly typing out the same list of character classes, some have been abstracted into special characters For example: \s denotes whitespace characters \d denotes digits \w denotes word characters (letter, number, underscore) '12hello3'.scan(/\d/) #=> ["1", "2", "3"] 21 / 48

22 Command Line Interfaces 22 / 48

23 Interacting with Users Use the gets method to collect user input The program will halt while it waits for the user to type in input The input will have a newline character at the end (because the user has to press enter) Call strip on the output of gets to get rid of any whitespace at the beginning or end gets allows us to create dynamic command line interfaces 23 / 48

24 Testing 24 / 48

25 Why do we write tests? Vote at 25 / 48

26 Why do we write tests? Determine that our code provides expected output For expected cases and edge cases Allows us to refactor confidently They make for good documentation Improve design 26 / 48

27 Test-Driven Development (TDD) Process that involves writing tests before writing the code being tested Steps: 1. Write a very small test for code that does not yet exist 2. Run the test & watch it fail 3. Write just enough code to make the test pass 4. Once the test passes, refactor as necessary 5. Repeat 27 / 48

28 Behavior-Driven Development (BDD) Started as a way to better understand & explain TDD Puts the focus on behavior instead of structure BDD Triad Given some context When some event occurs Then I expect some outcome 28 / 48

29 Ruby Testing Frameworks MiniTest RSpec* Cucumber 29 / 48

30 RSpec RSpec is a productive Ruby test framework Made of three independent gems: rspec-core: overall test harness that runs the specs rspec-expectations: provides a readable, powerful, syntax, for checking properties of your code rspec-mocks: makes it easy to isolate code being tested from the rest of system 30 / 48

31 Getting Started gem install rspec Run rspec --init Creates a.rspec file Creates spec/spec_helper.rb which contains configuration options 31 / 48

32 Specs RSpec tests are known as specs Short for specifications because they "specify" the desired behavior of your code Specs are placed in files ending in _spec.rb inside of the spec directory Specs serve two purposes: Documenting what the object can do Checking that the object does what it's supposed to 32 / 48

33 Running Specs Run tests by running the rspec command Running specific directories/files: rspec spec/{directory/file_name} 33 / 48

34 Example Groups You create example groups in RSpec using describe Example groups define what you're testing & keep related specs together You can pass a string, Ruby class, module, or object to describe describe User do describe '#valid?' do... end end 34 / 48

35 Examples You create examples using it Pass it the description of the behavior you're specifying describe User do describe '#valid?' do it 'returns true if the user is valid' do... end end end 35 / 48

36 context context is an alias for describe Groups together examples that are related to a shared situation or condition Useful to improve readability describe User do describe '#valid?' do context 'when the user is valid' do it 'returns true' do... end end end end 36 / 48

37 Expectations Expectations are like assertions in other languages Each RSpec example should contain at least one expectation Most of the time they should contain exactly one (unit tests) Primary goal is for clarity 37 / 48

38 Expect You create expectation using expect Parts: Subject - what's being tested Matcher - an object specifying what you expect to be true about the subject Custom Failure Message - this is optional expect(user.valid?).to be true, 'user is not valid' expect(user.valid?).to_not be true, 'user is valid' expect(user.valid?).not_to be true, 'user is valid' 38 / 48

39 Matchers Similar to regular expressions Define a category of objects that meet a certain specification List of Built-In Matchers expect(a).to eq(b) expect(a).to be(b) expect(a).to_not be_empty expect(a).to include(b) expect { a }.not_to output(b).to_stdout 39 / 48

40 Would this test pass? it 'does not include the number 3' do expect([1, 2, 4, 5]).to_not include(3) end Vote at 40 / 48

41 How about this test? it 'prints out hi' do expect { print 'hello' }.to output('hi').to_stdout end Vote at 41 / 48

42 Hooks Great for common setup/teardown code Types specify when the hook should run relative to the examples: before will run before an example/example group after will run after an example/example group around will sandwich an example Scope allows you to specify how often the hook gets run :each will run once per example (default) :all will run once per example group 42 / 48

43 Hooks before(:each) do... end after(:all) do... end around do... example.run... end 43 / 48

44 let let binds a name to the result of a computation They are useful for assigning variables at the beginning of an example group describe User do describe '#valid?' do let(:user) { User.new } it 'is not valid without a name' do expect(user.valid?).to be false end end end 44 / 48

45 Resources RSpec API Documentation RSpec Built-In Matchers Better Specs 45 / 48

46 Test Coverage We want to strive for 100% test coverage Can use the simplecov gem to check coverage To use: Add gem 'simplecov', require: false to testing group of Gemfile and bundle install Add the following at top of spec/spec_helper.rb: require 'simplecov' SimpleCov.start Run tests and open coverage/index.html file in browser 46 / 48

47 Homework 3 You will be writing tests for three fully intact classes Grading: Correctness (15pts): Must have at least one test for every method (5pts) All tests must pass (5pts) Must reach 100% test coverage (5pts) Style (5pts) Best Practices (5pts) 47 / 48

48 Next Week: Ruby on Rails! 48 / 48

Lecture 3. Miscellaneous Ruby and Testing 1 / 40

Lecture 3. Miscellaneous Ruby and Testing 1 / 40 Lecture 3 Miscellaneous Ruby and Testing 1 / 40 Homework 1 Grades were released! TAs provided feedback on best practices, but did not take off points Keep the comments in mind for future assignments! Any

More information

Lecture 3. Miscellaneous Ruby and Testing

Lecture 3. Miscellaneous Ruby and Testing Lecture 3 Miscellaneous Ruby and Testing 1 Sublime Text Guide I wrote a quick Sublime Text Guide that will help with Rubocop offenses It ll walk you through: Using spaces instead of tabs by default Using

More information

Lecture 1. Basic Ruby 1 / 61

Lecture 1. Basic Ruby 1 / 61 Lecture 1 Basic Ruby 1 / 61 What does this do? 3.times do print 'Hello, world!' end 2 / 61 Why Ruby? Optimized for programmer happiness Used for Ruby on Rails Very popular web framework 3 / 61 Course Policies

More information

Lecture 2. Object Orientation 1 / 50

Lecture 2. Object Orientation 1 / 50 Lecture 2 Object Orientation 1 / 50 Homework 1 Homework 1 was due last night You will be graded on: Correctness: 15 points (passing all RSpec tests) Style: 5 points (having no Rubocop style offenses) Best

More information

Lecture 4. Ruby on Rails 1 / 52

Lecture 4. Ruby on Rails 1 / 52 Lecture 4 Ruby on Rails 1 / 52 Homeworks 2 & 3 Grades were released for homework 2 Homework 3 was due last night Everyone got a style freebie since my default setup ignores spec files and I didn't change

More information

Lecture 2. Object Orientation

Lecture 2. Object Orientation Lecture 2 Object Orientation 1 Homework 0 Grades Homework 0 grades were returned earlier this week Any questions? 2 Homework 1 Homework 1 is due tonight at 11:59pm You will be graded on: Correctness: 15

More information

This tutorial will show you, how to use RSpec to test your code when building applications with Ruby.

This tutorial will show you, how to use RSpec to test your code when building applications with Ruby. About the Tutorial RSpec is a unit test framework for the Ruby programming language. RSpec is different than traditional xunit frameworks like JUnit because RSpec is a Behavior driven development tool.

More information

Lecture 2. Object Orientation 1 / 51

Lecture 2. Object Orientation 1 / 51 Lecture 2 Object Orientation 1 / 51 Homework 1 Homework 1 was due at noon You will be graded on: Correctness: 15 points (passing all RSpec tests) Style: 5 points (having no Rubocop style offenses) Best

More information

This tutorial will show you, how to use RSpec to test your code when building applications with Ruby.

This tutorial will show you, how to use RSpec to test your code when building applications with Ruby. About the Tutorial RSpec is a unit test framework for the Ruby programming language. RSpec is different than traditional xunit frameworks like JUnit because RSpec is a Behavior driven development tool.

More information

Watir-Webdriver Cucumber Automation Framework Setup Guide

Watir-Webdriver Cucumber Automation Framework Setup Guide Watir-Webdriver Cucumber Automation Framework Setup Guide Documentation version table: Document updating summary. Version Date Date Created 1.0 08/05/15 Index Page 1 November 18, 2015 Table of Contents

More information

CS 2112 Lab: Regular Expressions

CS 2112 Lab: Regular Expressions October 10, 2012 Regex Overview Regular Expressions, also known as regex or regexps are a common scheme for pattern matching regex supports matching individual characters as well as categories and ranges

More information

RSPec Documentation. 4. Scenario Testing Examples of OAR REST APIs using Rspec

RSPec Documentation. 4. Scenario Testing Examples of OAR REST APIs using Rspec RSPec Documentation Contents: 1. Introduction to Rspec - Installing Rspec Gem (Getting Started) - Terminology used in Rspec 2. Writing Simple Rspec Tests 3. Running Rspec Testfiles 4. Scenario Testing

More information

Lecture 4. Ruby on Rails 1 / 49

Lecture 4. Ruby on Rails 1 / 49 Lecture 4 Ruby on Rails 1 / 49 Client-Server Model 2 / 49 What is it? A client (e.g. web browser, phone, computer, etc.) sends a request to a server Request is an HTTP request Stands for HyperText Transfer

More information

Can you upgrade to Puppet 4.x? PuppetCamp Düsseldorf Martin Alfke

Can you upgrade to Puppet 4.x? PuppetCamp Düsseldorf Martin Alfke Can you upgrade to Puppet 4.x? PuppetCamp Düsseldorf Martin Alfke About me Martin Alfke Berlin/Germany Freelancer / Trainer PuppetLabs Training Partner Puppet User Group Berlin

More information

Lecture 8. Validations & Sessions 1 / 41

Lecture 8. Validations & Sessions 1 / 41 Lecture 8 Validations & Sessions 1 / 41 Advanced Active Record 2 / 41 More Complex Queries Arel provides us with a number of methods to query our database tables So far, we've only used find which limits

More information

Dr. Sarah Abraham University of Texas at Austin Computer Science Department. Regular Expressions. Elements of Graphics CS324e Spring 2017

Dr. Sarah Abraham University of Texas at Austin Computer Science Department. Regular Expressions. Elements of Graphics CS324e Spring 2017 Dr. Sarah Abraham University of Texas at Austin Computer Science Department Regular Expressions Elements of Graphics CS324e Spring 2017 What are Regular Expressions? Describe a set of strings based on

More information

RSpec Core Project: RSpec Core 2.11 Publisher: RSpec. Issues. Open Feedback Dialog. rspec-core provides the structure for RSpec code examples:

RSpec Core Project: RSpec Core 2.11 Publisher: RSpec. Issues. Open Feedback Dialog. rspec-core provides the structure for RSpec code examples: Open Feedback Dialog Project: RSpec Core 2.11 Publisher: RSpec RSpec Core 2.11 rspec-core provides the structure for RSpec code examples: describe Account do it "has a balance of zero when first opened"

More information

Regular Expressions. Regular expressions are a powerful search-and-replace technique that is widely used in other environments (such as Unix and Perl)

Regular Expressions. Regular expressions are a powerful search-and-replace technique that is widely used in other environments (such as Unix and Perl) Regular Expressions Regular expressions are a powerful search-and-replace technique that is widely used in other environments (such as Unix and Perl) JavaScript started supporting regular expressions in

More information

Git. Charles J. Geyer School of Statistics University of Minnesota. Stat 8054 Lecture Notes

Git. Charles J. Geyer School of Statistics University of Minnesota. Stat 8054 Lecture Notes Git Charles J. Geyer School of Statistics University of Minnesota Stat 8054 Lecture Notes 1 Before Anything Else Tell git who you are. git config --global user.name "Charles J. Geyer" git config --global

More information

FEEG Applied Programming 3 - Version Control and Git II

FEEG Applied Programming 3 - Version Control and Git II FEEG6002 - Applied Programming 3 - Version Control and Git II Richard Boardman, Sam Sinayoko 2016-10-19 Outline Learning outcomes Working with a single repository (review) Working with multiple versions

More information

Your First Ruby Script

Your First Ruby Script Learn Ruby in 50 pages Your First Ruby Script Step-By-Step Martin Miliauskas @mmiliauskas 1 Your First Ruby Script, Step-By-Step By Martin Miliauskas Published in 2013 by Martin Miliauskas On the web:

More information

CS Unix Tools & Scripting

CS Unix Tools & Scripting Cornell University, Spring 2014 1 February 7, 2014 1 Slides evolved from previous versions by Hussam Abu-Libdeh and David Slater Regular Expression A new level of mastery over your data. Pattern matching

More information

Regex Guide. Complete Revolution In programming For Text Detection

Regex Guide. Complete Revolution In programming For Text Detection Regex Guide Complete Revolution In programming For Text Detection What is Regular Expression In computing, a regular expressionis a specific pattern that provides concise and flexible means to "match"

More information

FPLLL. Contributing. Martin R. Albrecht 2017/07/06

FPLLL. Contributing. Martin R. Albrecht 2017/07/06 FPLLL Contributing Martin R. Albrecht 2017/07/06 Outline Communication Setup Reporting Bugs Topic Branches and Pull Requests How to Get your Pull Request Accepted Documentation Overview All contributions

More information

FSASIM: A Simulator for Finite-State Automata

FSASIM: A Simulator for Finite-State Automata FSASIM: A Simulator for Finite-State Automata P. N. Hilfinger Chapter 1: Overview 1 1 Overview The fsasim program reads in a description of a finite-state recognizer (either deterministic or non-deterministic),

More information

Effective Software Development and Version Control

Effective Software Development and Version Control Effective Software Development and Version Control Jennifer Helsby, Eric Potash Computation for Public Policy Lecture 5: January 19, 2016 computationforpolicy.github.io Announcements Do look at the readings

More information

CS 230 Programming Languages

CS 230 Programming Languages CS 230 Programming Languages 09 / 20 / 2013 Instructor: Michael Eckmann Today s Topics Questions/comments? Continue Regular expressions Matching string basics =~ (matches) m/ / (this is the format of match

More information

Regular Expressions. Computer Science and Engineering College of Engineering The Ohio State University. Lecture 9

Regular Expressions. Computer Science and Engineering College of Engineering The Ohio State University. Lecture 9 Regular Expressions Computer Science and Engineering College of Engineering The Ohio State University Lecture 9 Language Definition: a set of strings Examples Activity: For each above, find (the cardinality

More information

Object-Oriented Software Engineering CS288

Object-Oriented Software Engineering CS288 Object-Oriented Software Engineering CS288 1 Regular Expressions Contents Material for this lecture is based on the Java tutorial from Sun Microsystems: http://java.sun.com/docs/books/tutorial/essential/regex/index.html

More information

Pieter van den Hombergh. April 13, 2018

Pieter van den Hombergh. April 13, 2018 Intro ergh Fontys Hogeschool voor Techniek en Logistiek April 13, 2018 ergh/fhtenl April 13, 2018 1/11 Regex? are a very power, but also complex tool. There is the saying that: Intro If you start with

More information

String Calculator TDD Kata

String Calculator TDD Kata String Calculator TDD Kata Created by Roy Osherove http://osherove.com/tdd-kata-1 Ruby Solution based on performance by Corey Haines http://katas.softwarecraftsmanship.org/?p=80 Basic Requirements Create

More information

Basic Syntax - First Program 1

Basic Syntax - First Program 1 Python Basic Syntax Basic Syntax - First Program 1 All python files will have extension.py put the following source code in a test.py file. print "Hello, Python!";#hello world program run this program

More information

Software Engineering 2 (SWT2)

Software Engineering 2 (SWT2) Software Engineering 2 (SWT2) Chapter 5: Getting you ready for the project - Lego Scrum Exercise, Git, Infrastructure, your next week, Testing, PO presentation - Agenda 2 Lego Scrum Exercise Git Project

More information

Cucumber 3.0 and Beyond

Cucumber 3.0 and Beyond Cucumber 3.0 and Beyond Thomas Haver tjhaver@gmail.com Abstract Cucumber is a tool that supports Behavior Driven Development (BDD), a software development practice that promotes collaboration. Cucumber

More information

Lab 5: Web Application Test Automation

Lab 5: Web Application Test Automation Software Testing MTAT.03.159 Lab 5: Web Application Test Automation Inst. of Comp. Science, University of Tartu Spring 2018 Instructions Submission deadline: Lab reports must be submitted within seven

More information

Outline. Logistics. Logistics. Principles of Software (CSCI 2600) Spring Logistics csci2600/

Outline. Logistics. Logistics. Principles of Software (CSCI 2600) Spring Logistics  csci2600/ Outline Principles of Software (CSCI 600) Spring 018 http://www.cs.rpi.edu/academics/courses/spring18/csci600/ Konstantin Kuzmin, kuzmik@cs.rpi.edu Office hours: Monday and Thursday 4:00 pm - 5:30 pm Mailing

More information

Practical Node.js. Building Real-World Scalable Web Apps. Apress* Azat Mardan

Practical Node.js. Building Real-World Scalable Web Apps. Apress* Azat Mardan Practical Node.js Building Real-World Scalable Web Apps Azat Mardan Apress* Contents About the Author About the Technical Reviewer Acknowledgments Introduction xv xvii xix xxi Chapter 1: Setting up Node.js

More information

Having Fun with Social Coding. Sean Handley. February 25, 2010

Having Fun with Social Coding. Sean Handley. February 25, 2010 Having Fun with Social Coding February 25, 2010 What is Github? GitHub is to collaborative coding, what Facebook is to social networking 1 It serves as a web front-end to open source projects by allowing

More information

CIS192: Python Programming

CIS192: Python Programming CIS192: Python Programming Introduction Harry Smith University of Pennsylvania January 18, 2017 Harry Smith (University of Pennsylvania) CIS 192 Lecture 1 January 18, 2017 1 / 34 Outline 1 Logistics Rooms

More information

CSE 401/M501 18au Midterm Exam 11/2/18. Name ID #

CSE 401/M501 18au Midterm Exam 11/2/18. Name ID # Name ID # There are 7 questions worth a total of 100 points. Please budget your time so you get to all of the questions. Keep your answers brief and to the point. The exam is closed books, closed notes,

More information

Improving Coverage Analysis

Improving Coverage Analysis Improving Coverage Analysis 1 Ryan Davis Coding professionally 25 years, 16 years Ruby Founder, Seattle.rb; First & Oldest Ruby Brigade Author: minitest, flog, flay, debride, ruby_parser, etc. ~114 million

More information

A Folding Language. Ola Bini computational metalinguist fredag, 2009 september 18

A Folding Language. Ola Bini computational metalinguist   fredag, 2009 september 18 A Folding Language Ola Bini computational metalinguist ola.bini@gmail.com http://olabini.com/blog Your host From Sweden Language geek at ThoughtWorks Experience with C/C++, C#, Java, Ruby, Lisp and many

More information

Git, the magical version control

Git, the magical version control Git, the magical version control Git is an open-source version control system (meaning, it s free!) that allows developers to track changes made on their code files throughout the lifetime of a project.

More information

Contents. Jairo Pava COMS W4115 June 28, 2013 LEARN: Language Reference Manual

Contents. Jairo Pava COMS W4115 June 28, 2013 LEARN: Language Reference Manual Jairo Pava COMS W4115 June 28, 2013 LEARN: Language Reference Manual Contents 1 Introduction...2 2 Lexical Conventions...2 3 Types...3 4 Syntax...3 5 Expressions...4 6 Declarations...8 7 Statements...9

More information

C++ DATA TYPES BASIC CONTROL FLOW

C++ DATA TYPES BASIC CONTROL FLOW C++ DATA TYPES BASIC CONTROL FLOW Problem Solving with Computers-I Chapter 1 and Chapter 2 CLICKERS OUT FREQUENCY AB Review: Program compilation What does it mean to compile a C++ program? A. Write the

More information

CS164: Programming Assignment 2 Dlex Lexer Generator and Decaf Lexer

CS164: Programming Assignment 2 Dlex Lexer Generator and Decaf Lexer CS164: Programming Assignment 2 Dlex Lexer Generator and Decaf Lexer Assigned: Thursday, September 16, 2004 Due: Tuesday, September 28, 2004, at 11:59pm September 16, 2004 1 Introduction Overview In this

More information

Testing your puppet code

Testing your puppet code Libre Software Meeting 2013 July 10, 2013 1 2 Style and linting Catalogs 3 4 Homework sysadmin @ inuits open-source defender for 7+ years devops believer @roidelapluie on twitter/github Infrastructure

More information

Unit Testing In Python

Unit Testing In Python Lab 13 Unit Testing In Python Lab Objective: One of the hardest parts of computer programming is ensuring that a program does what you expect it to do. For instance, a program may fail to meet specifications,

More information

Setting up GitHub Version Control with Qt Creator*

Setting up GitHub Version Control with Qt Creator* Setting up GitHub Version Control with Qt Creator* *This tutorial is assuming you already have an account on GitHub. If you don t, go to www.github.com and set up an account using your buckeyemail account.

More information

Copyright 2013 Avdi Grimm. All rights reserved.

Copyright 2013 Avdi Grimm. All rights reserved. Copyright 2013 Avdi Grimm. All rights reserved. Confident Ruby 4.17 Represent special cases as objects If it's possible to for a variable to be null, you have to remember to surround it with null test

More information

Computational Applications in Nuclear Astrophysics using Java Java course Lecture 2

Computational Applications in Nuclear Astrophysics using Java Java course Lecture 2 Computational Applications in Nuclear Astrophysics using Java Java course Lecture 2 Prepared for course 160410/411 Michael C. Kunkel m.kunkel@fz-juelich.de Materials taken from; docs.oracle.com Teach Yourself

More information

Git. CSCI 5828: Foundations of Software Engineering Lecture 02a 08/27/2015

Git. CSCI 5828: Foundations of Software Engineering Lecture 02a 08/27/2015 Git CSCI 5828: Foundations of Software Engineering Lecture 02a 08/27/2015 1 Lecture Goals Present a brief introduction to git You will need to know git to work on your presentations this semester 2 Git

More information

Testing Frameworks (MiniTest)

Testing Frameworks (MiniTest) Testing Frameworks (MiniTest) Computer Science and Engineering College of Engineering The Ohio State University Lecture 20 MiniTest and RSpec Many popular testing libraries for Ruby MiniTest (replaces

More information

GBIL: Generic Binary Instrumentation Language. Language Reference Manual. By: Andrew Calvano. COMS W4115 Fall 2015 CVN

GBIL: Generic Binary Instrumentation Language. Language Reference Manual. By: Andrew Calvano. COMS W4115 Fall 2015 CVN GBIL: Generic Binary Instrumentation Language Language Reference Manual By: Andrew Calvano COMS W4115 Fall 2015 CVN Table of Contents 1) Introduction 2) Lexical Conventions 1. Tokens 2. Whitespace 3. Comments

More information

CS 374 Fall 2014 Homework 2 Due Tuesday, September 16, 2014 at noon

CS 374 Fall 2014 Homework 2 Due Tuesday, September 16, 2014 at noon CS 374 Fall 2014 Homework 2 Due Tuesday, September 16, 2014 at noon Groups of up to three students may submit common solutions for each problem in this homework and in all future homeworks You are responsible

More information

Mamba Documentation. Release Néstor Salceda

Mamba Documentation. Release Néstor Salceda Mamba Documentation Release 0.9.2 Néstor Salceda Jul 12, 2018 Contents 1 Contents 3 1.1 Getting Started.............................................. 3 1.2 Example Groups.............................................

More information

S206E Lecture 19, 5/24/2016, Python an overview

S206E Lecture 19, 5/24/2016, Python an overview S206E057 Spring 2016 Copyright 2016, Chiu-Shui Chan. All Rights Reserved. Global and local variables: differences between the two Global variable is usually declared at the start of the program, their

More information

CMSC 330: Organization of Programming Languages. Ruby Regular Expressions

CMSC 330: Organization of Programming Languages. Ruby Regular Expressions CMSC 330: Organization of Programming Languages Ruby Regular Expressions 1 String Processing in Ruby Earlier, we motivated scripting languages using a popular application of them: string processing The

More information

Lab 08. Command Line and Git

Lab 08. Command Line and Git Lab 08 Command Line and Git Agenda Final Project Information All Things Git! Make sure to come to lab next week for Python! Final Projects Connect 4 Arduino ios Creative AI Being on a Team - How To Maximize

More information

Ruby Regular Expressions AND FINITE AUTOMATA

Ruby Regular Expressions AND FINITE AUTOMATA Ruby Regular Expressions AND FINITE AUTOMATA Why Learn Regular Expressions? RegEx are part of many programmer s tools vi, grep, PHP, Perl They provide powerful search (via pattern matching) capabilities

More information

Agenda. - Final Project Info. - All things Git. - Make sure to come to lab for Python next week

Agenda. - Final Project Info. - All things Git. - Make sure to come to lab for Python next week Lab #8 Git Agenda - Final Project Info - All things Git - Make sure to come to lab for Python next week Final Project Low Down The Projects are Creative AI, Arduino, Web Scheduler, ios and Connect 4 Notes

More information

Programming Language Concepts, cs2104 Lecture 04 ( )

Programming Language Concepts, cs2104 Lecture 04 ( ) Programming Language Concepts, cs2104 Lecture 04 (2003-08-29) Seif Haridi Department of Computer Science, NUS haridi@comp.nus.edu.sg 2003-09-05 S. Haridi, CS2104, L04 (slides: C. Schulte, S. Haridi) 1

More information

CS Homework 8. Deadline. Purpose. Problem 1. Problem 2. CS Homework 8 p. 1

CS Homework 8. Deadline. Purpose. Problem 1. Problem 2. CS Homework 8 p. 1 CS 458 - Homework 8 p. 1 Deadline CS 458 - Homework 8 Problem 1 was completed during CS 458 Week 10 Lab. Problems 2 onward are due by 11:59 pm on Friday, November 3, 2017 Purpose To meet with your project

More information

CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG

CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG 1 Notice Reading Assignment Chapter 1: Introduction to Java Programming Homework 1 It is due this coming Sunday

More information

CSCE 120: Learning To Code

CSCE 120: Learning To Code CSCE 120: Learning To Code Manipulating Data I Introduction This module is designed to get you started working with data by understanding and using variables and data types in JavaScript. It will also

More information

Regular expressions and regexp-based string operations

Regular expressions and regexp-based string operations Regular expressions and regexp-based string operations In this chapter Regular expression syntax Pattern-matching operations The MatchData class Built-in methods based on pattern matching In this chapter,

More information

Agile Behaviour Driven Development (BDD) and Integrated Testing with the Cucumber Framework. Melbourne ANZTB SIGIST, 15 th June 2011

Agile Behaviour Driven Development (BDD) and Integrated Testing with the Cucumber Framework. Melbourne ANZTB SIGIST, 15 th June 2011 Agile Behaviour Driven Development (BDD) and Integrated Testing with the Cucumber Framework Damian Versaci Melbourne ANZTB SIGIST, 15 th June 2011 Contents The Importance of Requirements Behaviour Driven

More information

S18 Modern Version Control with Git

S18 Modern Version Control with Git 98-174 S18 Modern Version Control with Git Aaron Perley (aperley@andrew.cmu.edu) Ilan Biala (ibiala@andrew.cmu.edu) https://www.andrew.cmu.edu/course/98-174/ Why should you take this course? Version control

More information

CS 330 Homework Regexercise

CS 330 Homework Regexercise CS 330 Homework Regexercise 1 Overview Your responsibility in this homework is to fall in love with regular expressions. You will do so in the context of writing a handful of regexes for a handful of independent

More information

Testing in ios. Paweł Dudek. Thursday, July 4, 13

Testing in ios. Paweł Dudek. Thursday, July 4, 13 Testing in ios Paweł Dudek 1 Why do we want to write tests? 2 Reasons for testing Striving for better software Faster development cycles Being confident about your code Leads to better, more modularized

More information

Lecture 2: Data in Linguistics, Git/GitHub, Jupyter Notebook. LING 1340/2340: Data Science for Linguists Na-Rae Han

Lecture 2: Data in Linguistics, Git/GitHub, Jupyter Notebook. LING 1340/2340: Data Science for Linguists Na-Rae Han Lecture 2: Data in Linguistics, Git/GitHub, Jupyter Notebook LING 1340/2340: Data Science for Linguists Na-Rae Han Objectives What do linguistic data look like? Tools: You should be taking NOTES! Git and

More information

Configuration Management

Configuration Management Configuration Management A True Life Story October 16, 2018 Page 1 Configuration Management: A True Life Story John E. Picozzi Senior Drupal Architect Drupal Providence 401-228-7660 oomphinc.com 72 Clifford

More information

Lecture 27. Lecture 27: Regular Expressions and Python Identifiers

Lecture 27. Lecture 27: Regular Expressions and Python Identifiers Lecture 27 Lecture 27: Regular Expressions and Python Identifiers Python Syntax Python syntax makes very few restrictions on the ways that we can name our variables, functions, and classes. Variables names

More information

RTL Reference 1. JVM. 2. Lexical Conventions

RTL Reference 1. JVM. 2. Lexical Conventions RTL Reference 1. JVM Record Transformation Language (RTL) runs on the JVM. Runtime support for operations on data types are all implemented in Java. This constrains the data types to be compatible to Java's

More information

Lecture 2 Making Simple Commits

Lecture 2 Making Simple Commits Lecture 2 Making Simple Commits Sign in on the attendance sheet! credit: https://xkcd.com/1296/ Course Website https://www.andrew.cmu.edu/course/98-174/ Homework Reminders Great job gitting the homework

More information

JUnit in EDA Introduction. 2 JUnit 4.3

JUnit in EDA Introduction. 2 JUnit 4.3 Lunds tekniska högskola Datavetenskap, Nov 25, 2010 Görel Hedin EDA260 Programvaruutveckling i grupp projekt Labb 3 (Test First): Bakgrundsmaterial JUnit in EDA260 1 Introduction The JUnit framework is

More information

https://lambda.mines.edu You should have researched one of these topics on the LGA: Reference Couting Smart Pointers Valgrind Explain to your group! Regular expression languages describe a search pattern

More information

CMSC 330: Organization of Programming Languages. Functional Programming with Lists

CMSC 330: Organization of Programming Languages. Functional Programming with Lists CMSC 330: Organization of Programming Languages Functional Programming with Lists CMSC330 Spring 2018 1 Lists in OCaml The basic data structure in OCaml Lists can be of arbitrary length Implemented as

More information

W13:Homework:H08. CS40 Foundations of Computer Science W13. From 40wiki

W13:Homework:H08. CS40 Foundations of Computer Science W13. From 40wiki W13:Homework:H08 From 40wiki CS40 Foundations of Computer Science W13 W13:Exams W13:Homework in Class and Web Work W13:Calendar W13:Syllabus and Lecture Notes UCSB-CS40-W13 on Facebook (https://www.facebook.com/groups/ucsb.cs40.w13/)

More information

Lesson 7: Recipe Display Application Setup Workspace

Lesson 7: Recipe Display Application Setup Workspace Lesson 7: Recipe Display Application Setup Workspace Setup Workspace - 5 STEPS Step #1: Setup a new workspace in Cloud9 Step #2: Copy the files & folder to the local repository (Cloud9) Step #3: Create

More information

Object Oriented Programming in Python 3

Object Oriented Programming in Python 3 Object Oriented Programming in Python 3 Objects Python 3 Objects play a central role in the Python data model All the types we ve seen until now are in-fact objects Numeric types, strings, lists, tuples,

More information

Here's an example of how the method works on the string "My text" with a start value of 3 and a length value of 2:

Here's an example of how the method works on the string My text with a start value of 3 and a length value of 2: CS 1251 Page 1 Friday Friday, October 31, 2014 10:36 AM Finding patterns in text A smaller string inside of a larger one is called a substring. You have already learned how to make substrings in the spreadsheet

More information

BEHAVIOR DRIVEN DEVELOPMENT BDD GUIDE TO AGILE PRACTICES. Director, Strategic Solutions

BEHAVIOR DRIVEN DEVELOPMENT BDD GUIDE TO AGILE PRACTICES. Director, Strategic Solutions BEHAVIOR DRIVEN DEVELOPMENT BDD GUIDE TO AGILE PRACTICES Presenter: Joshua Eastman Director, Strategic Solutions ABOUT THE SPEAKER Josh has over seven years of experience as an accomplished software testing

More information

Programming Languages and Techniques (CIS120)

Programming Languages and Techniques (CIS120) Programming Languages and Techniques (CIS120) Lecture 5 Jan 18, 2013 Tuples and Lists No class Monday Announcements Homework 1 due Tuesday at midnight Don t wait! 24 people have already submiped See schedule

More information

1. Which of these Git client commands creates a copy of the repository and a working directory in the client s workspace. (Choose one.

1. Which of these Git client commands creates a copy of the repository and a working directory in the client s workspace. (Choose one. Multiple-Choice Questions: 1. Which of these Git client commands creates a copy of the repository and a working directory in the client s workspace. (Choose one.) a. update b. checkout c. clone d. import

More information

Python I. Some material adapted from Upenn cmpe391 slides and other sources

Python I. Some material adapted from Upenn cmpe391 slides and other sources Python I Some material adapted from Upenn cmpe391 slides and other sources Overview Names & Assignment Data types Sequences types: Lists, Tuples, and Strings Mutability Understanding Reference Semantics

More information

F17 Modern Version Control with Git. Aaron Perley https://www.andrew.cmu.edu/course/98-174/

F17 Modern Version Control with Git. Aaron Perley https://www.andrew.cmu.edu/course/98-174/ 98-174 F17 Modern Version Control with Git Aaron Perley (aperley@andrew.cmu.edu) https://www.andrew.cmu.edu/course/98-174/ Why should you take this course? Version control software is an essential part

More information

How to version control like a pro: a roadmap to your reproducible & collaborative research

How to version control like a pro: a roadmap to your reproducible & collaborative research How to version control like a pro: a roadmap to your reproducible & collaborative research The material in this tutorial is inspired by & adapted from the Software Carpentry lesson on version control &

More information

Regexp. Lecture 26: Regular Expressions

Regexp. Lecture 26: Regular Expressions Regexp Lecture 26: Regular Expressions Regular expressions are a small programming language over strings Regex or regexp are not unique to Python They let us to succinctly and compactly represent classes

More information

CSE : Python Programming

CSE : Python Programming CSE 399-004: Python Programming Lecture 11: Regular expressions April 2, 2007 http://www.seas.upenn.edu/~cse39904/ Announcements About those meeting from last week If I said I was going to look into something

More information

Configuring the RADIUS Listener LEG

Configuring the RADIUS Listener LEG CHAPTER 16 Revised: July 28, 2009, Introduction This module describes the configuration procedure for the RADIUS Listener LEG. The RADIUS Listener LEG is configured using the SM configuration file p3sm.cfg,

More information

Day 6: 24/May/2012. TDD (Test Driven Development)

Day 6: 24/May/2012. TDD (Test Driven Development) Day 6: 24/May/2012 TDD (Test Driven Development) p Understand what TDD (Test Driven Development) is. p Understand the words related to the Test Driven Development p Get used to the Rails-Way of TDD p We

More information

Typescript on LLVM Language Reference Manual

Typescript on LLVM Language Reference Manual Typescript on LLVM Language Reference Manual Ratheet Pandya UNI: rp2707 COMS 4115 H01 (CVN) 1. Introduction 2. Lexical Conventions 2.1 Tokens 2.2 Comments 2.3 Identifiers 2.4 Reserved Keywords 2.5 String

More information

Regular Expressions. Regular Expression Syntax in Python. Achtung!

Regular Expressions. Regular Expression Syntax in Python. Achtung! 1 Regular Expressions Lab Objective: Cleaning and formatting data are fundamental problems in data science. Regular expressions are an important tool for working with text carefully and eciently, and are

More information

Introduction to Ruby on Rails

Introduction to Ruby on Rails Introduction to Ruby on Rails Keven Richly keven.richly@hpi.de Software Engineering II WS 2017/18 Prof. Plattner, Dr. Uflacker Enterprise Platform and Integration Concepts group Introduction to Ruby on

More information

Effective Testing with RSpec 3

Effective Testing with RSpec 3 Extracted from: Effective Testing with RSpec 3 Build Ruby Apps with Confidence This PDF file contains pages extracted from Effective Testing with RSpec 3, published by the Pragmatic Bookshelf. For more

More information

Introduction to Ruby on Rails

Introduction to Ruby on Rails Introduction to Ruby on Rails Ralf Teusner ralf.teusner@hpi.de Software Engineering II WS 2018/19 Prof. Plattner, Dr. Uflacker Enterprise Platform and Integration Concepts group Introduction to Ruby on

More information

IT441. Regular Expressions. Handling Text: DRAFT. Network Services Administration

IT441. Regular Expressions. Handling Text: DRAFT. Network Services Administration IT441 Network Services Administration Handling Text: DRAFT Regular Expressions Searching for Text in a File Make note of the following directory: /home/ckelly/course_files/it441_files Given the file gettysburg.txt

More information

More Examples Using Functions and Command-Line Arguments in C++ CS 16: Solving Problems with Computers I Lecture #6

More Examples Using Functions and Command-Line Arguments in C++ CS 16: Solving Problems with Computers I Lecture #6 More Examples Using Functions and Command-Line Arguments in C++ CS 16: Solving Problems with Computers I Lecture #6 Ziad Matni Dept. of Computer Science, UCSB Administrative CHANGED T.A. OFFICE/OPEN LAB

More information

Configuring the RADIUS Listener Login Event Generator

Configuring the RADIUS Listener Login Event Generator CHAPTER 19 Configuring the RADIUS Listener Login Event Generator Published: December 21, 2012 Introduction This chapter describes the configuration procedure for the RADIUS listener Login Event Generator

More information