Improving Coverage Analysis

Size: px
Start display at page:

Download "Improving Coverage Analysis"

Transcription

1 Improving Coverage Analysis 1

2 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 downloaded gems (114/10648 = 1%!) Developer s Developer: I building tools Run Seattle.rb Consulting Most text of any slide 2

3 Setting Expectations Conceptual / Idea Talk Beginner+ 144 slides = 3-5 spm (easy pace) Shooting for ~30 minutes 3

4 Introduction 4

5 As a Consultant 5

6 I get clients 6

7 Huge/Messy Implementations 7

8 Tiny/No Tests 8

9 Making working on it dangerous/impossible 9

10 Pair 100%? 10

11 (Not Realistic) 11

12 PRs in Limbo 12

13 for Months 13

14 It s Frustrating 14

15 To Be a Fixer 15

16 But Not Fix Things 16

17 Being a Tool Builder 17

18 Lots of tools 18

19 To Help Me 19

20 Flog 20

21 Flay 21

22 Debride 22

23 Minitest 23

24 Minitest-bisect 24

25 But 25

26 Without Tests? 26

27 I m not getting very far 27

28 How to Improve Tests? 28

29 Code Coverage 29

30 What is Code Coverage Analysis? 30

31 Miller & Maloney Communications of the ACM 31

32 in 1963!!! 32

33 Everything good in computing 33

34 is old. 34

35 Like me. 35

36 The Measure of the Amount of the Code that the Tests execute 36

37 Huh? 100% class Adder Covered! def initialize n = n class TestAdder < Minitest::Test def test_add assert_equal 3, Adder.new(1).add(2) def add + m end end end end 37

38 Lots of Types 38

39 C0-C2 C0 Statement/Line coverage C1 Branch coverage C2 Condition coverage 39

40 MyClass#method1 Function MyClass#method2 MyClass#method3 Coverage 40

41 Statement executed? (C0) 41

42 Branches if condition then # truthy else # falsey end exhausted? (C1) 42

43 Conditions if (a or b) and c then # truthy exhausted? else end # falsey (C2) 43

44 (a or b) and c > > > > > > > > > > > > > > 1 and Decision Coverage truthy decision falsey Modified Decision/ Condition Coverage or and Full Condition Coverage a or b c 44

45 Parameter Strings: Null Edge Case Coverage Empty Whitespace Valid Format Invalid Format Single-Byte Multi-Byte 45

46 1 2 Path Coverage 6 46

47 Entry/Exit Coverage def return unless? if then x = y return z end x end 47

48 def initialize str = str end Coverage 48

49 Warning! 49

50 Bad Metrics Ahead! 50

51 This is NOT a Dilbert Cartoon 51

52 Because Fuck Scott Adams 52

53 Soooo 53

54 People Get Caught Up 54

55 In Getting High Scores 55

56 Leading to Gaming the System 56

57 But High Code Coverage 57

58 IS NOT 58

59 Proof of Good Tests 59

60 But we have 110% code coverage, we can't have bugs Actual Quote 60

61 Proof class Adder def initialize = n end def add + m end end 61

62 Proof class TestAdder < Minitest::Test def test_add assert_equal 3, Adder.new(1).add(2) end end 62

63 Proof class TestAdder < Minitest::Test def test_add assert_equal 3, Adder.new(1).add(2) end end 63

64 Proof Still 100% class TestAdder < Minitest::Test Covered!?! def test_add Adder.new(1).add(2) end end 64

65 To the Rescue! TDD 65

66 Red Green Refactor 66

67 Natural Fix 67

68 Many other Benefits 68

69 Current State of the Art 69

70 Coverage 70

71 Nobody Knows About It 71

72 Because 72

73 Ships w/ Ruby 73

74 Coverage require "coverage" Coverage.start # must be first-ish require "the_code" require "the_tests" Tests.run Coverage.result # => { } 74

75 Coverage pp Coverage.result { "/full/path_to_file.rb" => [ nil, # comment/blank ], 0, # not covered 1+ # covered N times } 75

76 Not For Human Consumption 76

77 How does it Work? 77

78 Hooks in VM 78

79 Coverage.start -> sets hash 79

80 Load or Eval 80

81 Extra VM Instructions sasm: +trace ( 12) putspecialobject 1 ( 12) putobject :foo putiseq foo send <callinfo!mid:core#define_method, argc:2, ARGS_SIMPLE>, <callcache>, nil pop +trace ( 16) putself ( 16) send <callinfo!mid:foo, argc:0, FCALL VCALL ARGS_SIMPLE>, <callcache>, nil putobject 10 send <callinfo!mid:+, argc:1, ARGS_SIMPLE>, <callcache>, nil leave sasm: #<ISeq:foo@<compiled>>======================================= +trace ( 13) putself ( 13) send <callinfo!mid:bar, argc:0, FCALL VCALL ARGS_SIMPLE>, <callcache>, nil leave 81

82 tests run code 82

83 increments counters 83

84 Coverage.result -> returns & clears hash 84

85 Coverage.peek_result -> returns hash 85

86 Simplecov 86

87 Code Example require "simplecov" SimpleCov.start # must be first-ish require "the_code" require "the_tests" Tests.run 87

88 Simplecov Uses Coverage Internally. Improves Reporting. 88

89 89

90 90

91 Not Much Else 91

92 The Problem 92

93 But First 93

94 Types of Errors 94

95 Statistics 95

96 Type 1: False Positive 96

97 class X class Y if else end if else end class TestX assert = = 75% 97

98 Type 2: False Negative 98

99 class X class Y if else end if else end??? class TestX assert class TestQ assert n 75% 99

100 Numerator Errors 100

101 Type 3 : Error by Omission 101

102 class X class Y class Z if else end if else end????????????????????????????????????????????????????? class TestX assert n m =??% 102

103 Denominator Error 103

104 OK 104

105 How Coverage Sucks 105

106 Type 1 Errors: Macro Type 1 Errors: Micro Type 2 Errors: None Type 3 Errors: Maybe 106

107 Type 1 Error: Macro class X class Y class Z if else end if else end Never Directly Tested if else end class TestX class TestY class TestZ assert assert assert 107

108 Type 1Error: Micro buggy_response if false # line covered raise "haha" unless true # line covered a? b : c a? b : c a = b rescue c a = b c # line covered # line covered # line covered # line covered has_many :problems # line covered a; b; c; d; e; # line covered i_raise; d; e; # line covered (and so on ) 108

109 No Type 2 Errors in simplecov 109

110 Type 3 Errors class X class Y Never class Z Rails Loaded Lazy if else end if else end if else end Loading class TestX class TestY Don't class TestZ Don't Write Run assert assert assert 110

111 How can it be improved? 111

112 minitest-coverage 112

113 Uses Coverage 113

114 Extends C API (optionally?) Coverage.result= 114

115 New Strategy 115

116 Record Baseline = Fix Error by Omission 116

117 Baseline? a minimum or starting point used for comparisons. 117

118 Loading Everything + Running Nothing = Baseline 118

119 Creating a Baseline ENV["RAILS_ENV"] = "production" require "coverage/start" require "./config/environment.rb" Dir["app/**/*.rb", "lib/**/*.rb"].each do path end require path require "coverage/pruner" # (or just use `minitest_coverage_baseline`) 119

120 Only record coverage for CUT 120

121 Record for CUT class X class Y if else end if else end class TestX class TestY assert assert 121

122 class X if else end Hard to do class TestX assert Map Test Class to Implementation 122

123 Coverage is by Path { "/full/path_to_file.rb" => [ nil, # comment/blank ], 0, # not covered 1+ # covered N times } 123

124 Classes Path % ag class.something app/models/something_else.rb: 1: class Something 124

125 Test Names Impl Names Valuations::UpdateWeightedExit ValuationWeightedExitTest 125

126 Test Names Impl Names app/services/valuations/updated_weighted_exit.rb: module Valuations class UpdateWeightedExit test/unit/services/valuations/weighted_exit_test.rb: class ValuationWeightedExitTest 126

127 Biased Towards False Negatives 127

128 Increased Type 2 Errors 128

129 Fixed by Naming Conventions 129

130 simplecov: 83% 130

131 + Baseline: 51% 131

132 Fixed Type 2s: 62% 132

133 Report Output CompanyTest::Create:... app/models/company.rb: from 0.0% to 28.6% of 228 lines CompanyTest::Modify:... app/models/company.rb: from 28.6% to 45.6% of 228 lines 133

134 Difference in Numbers uncv covr% totl : path % 422 : app/models/report.rb % 319 : app/controllers/transactions_controller.rb % 198 : app/concerns/formula.rb % 180 : app/controllers/workflows_controller.rb % 170 : app/controllers/permissions_controller.rb % 207 : app/helpers/transactions_helper.rb % 159 : app/helpers/reports_helper.rb

135 What s left? 135

136 Hook into simplecov s report generator 136

137 emacs & vim visualization / coloring 137

138 Better error handling: type 2 errors on name mismatches 138

139 class X if else end class TestX Enhancment: Record per-test & map lines covered back assert to each test 139

140 class X if else end class TestX assert Enhancment: then use that to show heavy overlaps 140

141 class X class Y Neat Idea: if else end if else end Do this without filtering to identify class TestX places to isolate/ assert disconnect 141

142 I'd Help! 142

143 Need Tools? Need Help? I m Available! 143

144 Thank You (hire me) 144

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

Let s Write an Interpreter!

Let s Write an Interpreter! Let s Write an Interpreter! Thank you so much! Setting Expectations TODO 168 Slides in 30 minutes. ~5.6 spm. Boatloads of content. Almost all code. I hope to Hurt Brains. How to solve a rubiks cube in

More information

Lecture 3. Miscellaneous Ruby and Testing 1 / 48

Lecture 3. Miscellaneous Ruby and Testing 1 / 48 Lecture 3 Miscellaneous Ruby and Testing 1 / 48 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

ERICH PRIMEHAMMER REFACTORING

ERICH PRIMEHAMMER REFACTORING ERICH KADERKA @ PRIMEHAMMER REFACTORING WHAT IS REFACTORING? Martin Fowler: Refactoring is a controlled technique for improving the design of an existing code base. Its essence is applying a series of

More information

ruby2c Automatic translation of ruby code to C. by Seattle.rb s Ryan Davis & Eric Hodel

ruby2c Automatic translation of ruby code to C. by Seattle.rb s Ryan Davis & Eric Hodel ruby2c Automatic translation of ruby code to C. by Seattle.rb s Ryan Davis & Eric Hodel Overview Background information and Goals Introduction to metaruby

More information

Introduction to JUnit. Data Structures and Algorithms for Language Processing

Introduction to JUnit. Data Structures and Algorithms for Language Processing Data Structures and Algorithms for Language Processing What is JUnit JUnit is a small, but powerful Java framework to create and execute automatic unit tests Unit testing is the test of a part of a program

More information

Object Oriented Software Design - I

Object Oriented Software Design - I Object Oriented Software Design - I Unit Testing Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa November 28, 2011 G. Lipari (Scuola Superiore Sant Anna) Unit Testing November

More information

MITOCW watch?v=9h6muyzjms0

MITOCW watch?v=9h6muyzjms0 MITOCW watch?v=9h6muyzjms0 The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high quality educational resources for free. To

More information

code://rubinius/technical

code://rubinius/technical code://rubinius/technical /GC, /cpu, /organization, /compiler weeee!! Rubinius New, custom VM for running ruby code Small VM written in not ruby Kernel and everything else in ruby http://rubini.us git://rubini.us/code

More information

Debugging. CSE 2231 Supplement A Annatala Wolf

Debugging. CSE 2231 Supplement A Annatala Wolf Debugging CSE 2231 Supplement A Annatala Wolf Testing is not debugging! The purpose of testing is to detect the existence of errors, not to identify precisely where the errors came from. Error messages

More information

Trolls of Ryan Davis, Seattle.rb. Trolls of MWRC 2013, Salt Lake City, UT

Trolls of Ryan Davis, Seattle.rb. Trolls of MWRC 2013, Salt Lake City, UT Trolls of 2013 Trolls of 2013 Trolls of 2013 Setting Expectations Followup of my talk, Occupy Ruby: Why We Need to Moderate the 1% 130 Slides in 30 minutes. 4.3 spm I must go quickly, so please hold questions.

More information

3 Continuous Integration 3. Automated system finding bugs is better than people

3 Continuous Integration 3. Automated system finding bugs is better than people This presentation is based upon a 3 day course I took from Jared Richardson. The examples and most of the tools presented are Java-centric, but there are equivalent tools for other languages or you can

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

Ruby: Introduction, Basics

Ruby: Introduction, Basics Ruby: Introduction, Basics Computer Science and Engineering College of Engineering The Ohio State University Lecture 4 Ruby vs Java: Similarities Imperative and object-oriented Classes and instances (ie

More information

Who am I? I m a python developer who has been working on OpenStack since I currently work for Aptira, who do OpenStack, SDN, and orchestration

Who am I? I m a python developer who has been working on OpenStack since I currently work for Aptira, who do OpenStack, SDN, and orchestration Who am I? I m a python developer who has been working on OpenStack since 2011. I currently work for Aptira, who do OpenStack, SDN, and orchestration consulting. I m here today to help you learn from my

More information

C Review. MaxMSP Developers Workshop Summer 2009 CNMAT

C Review. MaxMSP Developers Workshop Summer 2009 CNMAT C Review MaxMSP Developers Workshop Summer 2009 CNMAT C Syntax Program control (loops, branches): Function calls Math: +, -, *, /, ++, -- Variables, types, structures, assignment Pointers and memory (***

More information

Ruby assign variable if nil. Ruby assign variable if nil.zip

Ruby assign variable if nil. Ruby assign variable if nil.zip Ruby assign variable if nil Ruby assign variable if nil.zip Assign variable only if not nil (Ruby) and I want the method below to assign value to it only if. Email codedump link for Assign variable only

More information

Rainlendar 2.13 BETA build 139 Posted by Rainy /04/28 08:05

Rainlendar 2.13 BETA build 139 Posted by Rainy /04/28 08:05 Rainlendar 2.13 BETA build 139 Posted by Rainy - 2014/04/28 08:05 Build 139 can be downloaded from here: Windows (32-bit): Rainlendar-2.13.b139-32bit.zip Windows (64-bit): Rainlendar-2.13.b139-64bit.zip

More information

CSE : Python Programming. Homework 5 and Projects. Announcements. Course project: Overview. Course Project: Grading criteria

CSE : Python Programming. Homework 5 and Projects. Announcements. Course project: Overview. Course Project: Grading criteria CSE 399-004: Python Programming Lecture 5: Course project and Exceptions February 12, 2007 Announcements Still working on grading Homeworks 3 and 4 (and 2 ) Homework 5 will be out by tomorrow morning I

More information

PROFESSOR: Last time, we took a look at an explicit control evaluator for Lisp, and that bridged the gap between

PROFESSOR: Last time, we took a look at an explicit control evaluator for Lisp, and that bridged the gap between MITOCW Lecture 10A [MUSIC PLAYING] PROFESSOR: Last time, we took a look at an explicit control evaluator for Lisp, and that bridged the gap between all these high-level languages like Lisp and the query

More information

Testing, code coverage and static analysis. COSC345 Software Engineering

Testing, code coverage and static analysis. COSC345 Software Engineering Testing, code coverage and static analysis COSC345 Software Engineering Outline Various testing processes ad hoc / formal / automatic Unit tests and test driven development Code coverage metrics Integration

More information

Popcorn's ini Tutorial

Popcorn's ini Tutorial Popcorn's ini Tutorial Last update: November 30 th 2006. There are lot's of ways to save information into a file in The Games Factory 2 and Multimedia Fusion 2. This tutorial will teach you the basics

More information

2/28/2018. Let s Talk About Testing the Nonogram Code. ECE 220: Computer Systems & Programming. Example Nonogram Code Solution

2/28/2018. Let s Talk About Testing the Nonogram Code. ECE 220: Computer Systems & Programming. Example Nonogram Code Solution University of Illinois at Urbana-Champaign Dept. of Electrical and Computer Engineering ECE 220: Computer Systems & Programming Testing the Nonogram Code Let s Talk About Testing the Nonogram Code What

More information

CMSC 201 Fall 2016 Lab 09 Advanced Debugging

CMSC 201 Fall 2016 Lab 09 Advanced Debugging CMSC 201 Fall 2016 Lab 09 Advanced Debugging Assignment: Lab 09 Advanced Debugging Due Date: During discussion Value: 10 points Part 1: Introduction to Errors Throughout this semester, we have been working

More information

Ruby: Introduction, Basics

Ruby: Introduction, Basics Ruby: Introduction, Basics Computer Science and Engineering College of Engineering The Ohio State University Lecture 4 Ruby vs Java: Similarities Imperative and object-oriented Classes and instances (ie

More information

Testing My Patience. Automated Testing for Python Projects. Adam Lowry Portland Python Users Group

Testing My Patience. Automated Testing for Python Projects. Adam Lowry Portland Python Users Group Testing My Patience Automated Testing for Python Projects Adam Lowry Portland Python Users Group 2009-08-11 Unit Testing Integration/Functional Testing Web Testing Maurice Koop: http://www.flickr.com/photos/mauricekoop/1491529630/

More information

Decisions, Decisions. Testing, testing C H A P T E R 7

Decisions, Decisions. Testing, testing C H A P T E R 7 C H A P T E R 7 In the first few chapters, we saw some of the basic building blocks of a program. We can now make a program with input, processing, and output. We can even make our input and output a little

More information

Environments

Environments Environments PLAI Chapter 6 Evaluating using substitutions is very inefficient To work around this, we want to use a cache of substitutions. We begin evaluating with no cached substitutions, then collect

More information

Test First Software Development

Test First Software Development Test First Software Development Jacob Kristhammar Roger Schildmeijer D04, Lund Institute of Technology, Sweden {d04jk d04rp}@student.lth.se 2008-02-06 Abstract In this in-depth study we will try to explain

More information

ACORN.COM CS 1110 SPRING 2012: ASSIGNMENT A1

ACORN.COM CS 1110 SPRING 2012: ASSIGNMENT A1 ACORN.COM CS 1110 SPRING 2012: ASSIGNMENT A1 Due to CMS by Tuesday, February 14. Social networking has caused a return of the dot-com madness. You want in on the easy money, so you have decided to make

More information

Functional Programming and the Web

Functional Programming and the Web June 13, 2011 About Me Undergraduate: University of Illinois at Champaign-Urbana PhD: Penn State University Retrofitting Programs for Complete Security Mediation Static analysis, type-based compiler Racker:

More information

CS 11 C track: lecture 8

CS 11 C track: lecture 8 CS 11 C track: lecture 8 n Last week: hash tables, C preprocessor n This week: n Other integral types: short, long, unsigned n bitwise operators n switch n "fun" assignment: virtual machine Integral types

More information

CS 301: Recursion. The Art of Self Reference. Tyler Caraza-Harter

CS 301: Recursion. The Art of Self Reference. Tyler Caraza-Harter CS 301: Recursion The Art of Self Reference Tyler Caraza-Harter Goal: use self-reference is a meaningful way Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's

More information

Using Code Coverage to Improve the Reliability of Embedded Software. Whitepaper V

Using Code Coverage to Improve the Reliability of Embedded Software. Whitepaper V Using Code Coverage to Improve the Reliability of Embedded Software Whitepaper V2.0 2017-12 Table of Contents 1 Introduction... 3 2 Levels of Code Coverage... 3 2.1 Statement Coverage... 3 2.2 Statement

More information

1 of 5 3/28/2010 8:01 AM Unit Testing Notes Home Class Info Links Lectures Newsgroup Assignmen [Jump to Writing Clear Tests, What about Private Functions?] Testing The typical approach to testing code

More information

Python Unit Testing and CI Workflow. Tim Scott, Python Meetup 11/07/17

Python Unit Testing and CI Workflow. Tim Scott, Python Meetup 11/07/17 Python Unit Testing and CI Workflow Tim Scott, Python Meetup 11/07/17 A Little About Me Started as a CoOp Engineer (2007-2008) and Design Engineer at Adtran (2010-2014) Currently work at Abaco Systems

More information

Condition Controlled Loops. Introduction to Programming - Python

Condition Controlled Loops. Introduction to Programming - Python Condition Controlled Loops Introduction to Programming - Python Decision Structures Review Programming Challenge: Review Ask the user for a number from 1 to 7. Tell the user which day of the week was selected!

More information

"BEHAVIOR PATTERNS FOR DESIGNING AUTOMATED TESTS"

BEHAVIOR PATTERNS FOR DESIGNING AUTOMATED TESTS BIO PRESENTATION W3 5/16/2007 11:30:00 AM "BEHAVIOR PATTERNS FOR DESIGNING AUTOMATED TESTS" Jamie Mitchell Test & Automation Consulting LLC International Conference On Software Test Analysis And Review

More information

Retrospective Testing - How Good Heuristics Really Work

Retrospective Testing - How Good Heuristics Really Work Retrospective Testing - How Good Heuristics Really Work Andreas Marx amarx@gega-it.de AV-Test.org University of Magdeburg GEGA IT-Solutions GbR Retrospective Testing I What it is: Use an old (archived)

More information

CIT 590 Homework 10 Battleship

CIT 590 Homework 10 Battleship CIT 590 Homework 10 Battleship Purposes of this assignment: To give you more experience with classes and inheritance General Idea of the Assignment Once again, this assignment is based on a game, since

More information

Programming for Beginners

Programming for Beginners Programming for Beginners Learn to Code by Making Little Games Tom Dalling This book is for sale at http://leanpub.com/programming-for-beginners This version was published on 2018-02-23 This is a Leanpub

More information

JavaScript: More Syntax

JavaScript: More Syntax JavaScript: More Syntax CISC 282 October 23, 2018 null and undefined What s the difference? null is synonymous with nothing i.e., no value, nothing there undefined is synonymous with the unknown i.e.,

More information

MITOCW watch?v=flgjisf3l78

MITOCW watch?v=flgjisf3l78 MITOCW watch?v=flgjisf3l78 The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high-quality educational resources for free. To

More information

6.001 Notes: Section 15.1

6.001 Notes: Section 15.1 6.001 Notes: Section 15.1 Slide 15.1.1 Our goal over the next few lectures is to build an interpreter, which in a very basic sense is the ultimate in programming, since doing so will allow us to define

More information

HW1 due Monday by 9:30am Assignment online, submission details to come

HW1 due Monday by 9:30am Assignment online, submission details to come inst.eecs.berkeley.edu/~cs61c CS61CL : Machine Structures Lecture #2 - C Pointers and Arrays Administrivia Buggy Start Lab schedule, lab machines, HW0 due tomorrow in lab 2009-06-24 HW1 due Monday by 9:30am

More information

WRITING QUALITY CODE IDEAS, TECHNIQUES AND TOOLS FOR IMPROVING THE QUALITY OF WRITTEN CODE

WRITING QUALITY CODE IDEAS, TECHNIQUES AND TOOLS FOR IMPROVING THE QUALITY OF WRITTEN CODE WRITING QUALITY CODE IDEAS, TECHNIQUES AND TOOLS FOR IMPROVING THE QUALITY OF WRITTEN CODE Radosław Jankiewicz / @radek_j / radekj WHO AM I Programming in Python since 2007 Web applications (mostly) RANDOM

More information

use attributes (); # optional, to get subroutine declarations = attributes::get(\&foo);

use attributes (); # optional, to get subroutine declarations = attributes::get(\&foo); NAME SYNOPSIS attributes - get/set subroutine or variable attributes sub foo : method ; my ($x,@y,%z) : Bent = 1; my $s = sub : method {... ; use attributes (); # optional, to get subroutine declarations

More information

Civil Engineering Computation

Civil Engineering Computation Civil Engineering Computation First Steps in VBA Homework Evaluation 2 1 Homework Evaluation 3 Based on this rubric, you may resubmit Homework 1 and Homework 2 (along with today s homework) by next Monday

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

Beyond JavaScript Frameworks: Writing Reliable Web Apps With. Elm. Erik Wendel DevDays Vilnius 2018

Beyond JavaScript Frameworks: Writing Reliable Web Apps With. Elm. Erik Wendel DevDays Vilnius 2018 Beyond JavaScript Frameworks: Writing Reliable Web Apps With Elm Erik Wendel DevDays Vilnius 2018 Who is Jonathan Ive? Erik Wendel JavaZone 2017 Elm is like Jonathan Ive would have designed a programming

More information

Profile-Guided Program Simplification for Effective Testing and Analysis

Profile-Guided Program Simplification for Effective Testing and Analysis Profile-Guided Program Simplification for Effective Testing and Analysis Lingxiao Jiang Zhendong Su Program Execution Profiles A profile is a set of information about an execution, either succeeded or

More information

Scientific Programming Algolab. Wednesday 21 Dec 2016

Scientific Programming Algolab. Wednesday 21 Dec 2016 Algolab (index.html#chapters) Out[1]: Exam Simulation Exam Simulation Scientific Programming Algolab Wednesday 21 Dec 2016 Introduction This is just an exam simulation. If you don't ship it or do a poor

More information

CS61C Machine Structures. Lecture 4 C Pointers and Arrays. 1/25/2006 John Wawrzynek. www-inst.eecs.berkeley.edu/~cs61c/

CS61C Machine Structures. Lecture 4 C Pointers and Arrays. 1/25/2006 John Wawrzynek. www-inst.eecs.berkeley.edu/~cs61c/ CS61C Machine Structures Lecture 4 C Pointers and Arrays 1/25/2006 John Wawrzynek (www.cs.berkeley.edu/~johnw) www-inst.eecs.berkeley.edu/~cs61c/ CS 61C L04 C Pointers (1) Common C Error There is a difference

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

CSC201, SECTION 002, Fall 2000: Homework Assignment #1

CSC201, SECTION 002, Fall 2000: Homework Assignment #1 1 of 6 11/8/2003 7:34 PM CSC201, SECTION 002, Fall 2000: Homework Assignment #1 DUE DATE Monday, September 11, at the start of class. INSTRUCTIONS FOR PREPARATION Neat, in order, answers easy to find.

More information

CMSC 201 Fall 2018 Python Coding Standards

CMSC 201 Fall 2018 Python Coding Standards CMSC 201 Fall 2018 Python Coding Standards The purpose of these coding standards is to make programs readable and maintainable. In the real world you may need to update your own code more than 6 months

More information

Privacy and Security in Online Social Networks Department of Computer Science and Engineering Indian Institute of Technology, Madras

Privacy and Security in Online Social Networks Department of Computer Science and Engineering Indian Institute of Technology, Madras Privacy and Security in Online Social Networks Department of Computer Science and Engineering Indian Institute of Technology, Madras Lecture 08 Tutorial 2, Part 2, Facebook API (Refer Slide Time: 00:12)

More information

Stacks and queues (chapters 6.6, 15.1, 15.5)

Stacks and queues (chapters 6.6, 15.1, 15.5) Stacks and queues (chapters 6.6, 15.1, 15.5) So far... Complexity analysis For recursive and iterative programs Sorting algorithms Insertion, selection, quick, merge, (intro, dual-pivot quick, natural

More information

Common LISP Tutorial 1 (Basic)

Common LISP Tutorial 1 (Basic) Common LISP Tutorial 1 (Basic) CLISP Download https://sourceforge.net/projects/clisp/ IPPL Course Materials (UST sir only) Download https://silp.iiita.ac.in/wordpress/?page_id=494 Introduction Lisp (1958)

More information

Sedgewick Specialties

Sedgewick Specialties Sedgewick Specialties Our textbook is apparently a follow-up on another CS1083-ish book that uses a lot of simplified libraries, to avoid overwhelming newbies with the standard Java libraries. This book

More information

Hello World! Computer Programming for Kids and Other Beginners. Chapter 1. by Warren Sande and Carter Sande. Copyright 2009 Manning Publications

Hello World! Computer Programming for Kids and Other Beginners. Chapter 1. by Warren Sande and Carter Sande. Copyright 2009 Manning Publications Hello World! Computer Programming for Kids and Other Beginners by Warren Sande and Carter Sande Chapter 1 Copyright 2009 Manning Publications brief contents Preface xiii Acknowledgments xix About this

More information

MRI Internals. Koichi Sasada.

MRI Internals. Koichi Sasada. MRI Internals Koichi Sasada ko1@heroku.com MRI Internals towards Ruby 3 Koichi Sasada ko1@heroku.com Today s talk Koichi is working on improving Ruby internals Introduce my ideas toward Ruby 3 Koichi Sasada

More information

Impossible Programs. Tom Stuart

Impossible Programs. Tom Stuart Impossible Programs Tom Stuart IMPOSSIBLE PROGRAMS @tomstuart / GOTO Chicago / 2015-05-11 PROGRAMS CAN T DO EVERYTHING IMPOSSIBLE PROGRAMS @tomstuart / GOTO Chicago / 2015-05-11 how can a PROGRAM be IMPOSSIBLE?

More information

How to hold onto things in a multiprocessor world

How to hold onto things in a multiprocessor world How to hold onto things in a multiprocessor world Taylor Riastradh Campbell campbell@mumble.net riastradh@netbsd.org AsiaBSDcon 2017 Tokyo, Japan March 12, 2017 Slides n code Full of code! Please browse

More information

Design of Decode, Control and Associated Datapath Units

Design of Decode, Control and Associated Datapath Units 1 Design of Decode, Control and Associated Datapath Units ECE/CS 3710 - Computer Design Lab Lab 3 - Due Date: Thu Oct 18 I. OVERVIEW In the previous lab, you have designed the ALU and hooked it up with

More information

Ruby: Introduction, Basics

Ruby: Introduction, Basics Ruby: Introduction, Basics Computer Science and Engineering College of Engineering The Ohio State University Lecture 3 Ruby vs Java: Similarities Imperative and object-oriented Classes and instances (ie

More information

CS 302: Introduction to Programming in Java. Lecture 9

CS 302: Introduction to Programming in Java. Lecture 9 1 CS 302: Introduction to Programming in Java Lecture 9 2 No class on Wednesday in Observance of Fourth of July 3 Announcement Programming Assignment #1 Due 11:59pm Sunday July 8 th Follow style and commenting

More information

This chapter is intended to take you through the basic steps of using the Visual Basic

This chapter is intended to take you through the basic steps of using the Visual Basic CHAPTER 1 The Basics This chapter is intended to take you through the basic steps of using the Visual Basic Editor window and writing a simple piece of VBA code. It will show you how to use the Visual

More information

Parametricity. Types Are Documentation. Tony Morris

Parametricity. Types Are Documentation. Tony Morris Parametricity Types Are Documentation Tony Morris The Journey Fast and loose reasoning is morally correct Danielsson, Hughes, Jansson & Gibbons [DHJG06] tell us: Functional programmers often reason about

More information

JavaScript 1 Instructions

JavaScript 1 Instructions JavaScript 1 Instructions 1. Intro to lessons 2-10 1.1. use alert to show a message This 1 st lesson contains 5 tasks that give examples JavaScript code you'll learn to read and write in lessons 2-10.

More information

Testing. My favourite testing quote: Program testing can be used to show the presence of bugs, but never to show their absence!

Testing. My favourite testing quote: Program testing can be used to show the presence of bugs, but never to show their absence! Testing Some resources The most time-consuming of a development project. See for example https://www.itu.dk/people/sestoft/ papers/softwaretesting.pdf - Peter Sestoft testing notes Testing My favourite

More information

How to Improve Your Campaign Conversion Rates

How to Improve Your  Campaign Conversion Rates How to Improve Your Email Campaign Conversion Rates Chris Williams Author of 7 Figure Business Models How to Exponentially Increase Conversion Rates I'm going to teach you my system for optimizing an email

More information

The Ruby Programming Language: Everything You Need To Know By Yukihiro Matsumoto, David Flanagan

The Ruby Programming Language: Everything You Need To Know By Yukihiro Matsumoto, David Flanagan The Ruby Programming Language: Everything You Need To Know By Yukihiro Matsumoto, David Flanagan 6 answers: What should every programmer know about Ruby - Quora - A Ruby newbie can begin learning the language

More information

Org mode (La)TEX macros for HTML and L A TEX export

Org mode (La)TEX macros for HTML and L A TEX export Org mode (La)TEX macros for HTML and L A TEX export Brian C. Wells September 15, 2016 Contents 1 Preliminary Macros 2 1.1 when-fmt............................. 2 1.2 preamble..............................

More information

Programming Languages

Programming Languages CSE 130 : Winter 2013 Programming Languages Lecture 3: Crash Course, Datatypes Ranjit Jhala UC San Diego 1 Story So Far... Simple Expressions Branches Let-Bindings... Today: Finish Crash Course Datatypes

More information

Accelerating Information Technology Innovation

Accelerating Information Technology Innovation Accelerating Information Technology Innovation http://aiti.mit.edu/program/philippines-summer-2012/ Philippines Summer 2012 Lecture 1 Introduction to Python June 19, 2012 Agenda About the Course What is

More information

PERL DATABASE ACCESS

PERL DATABASE ACCESS http://www.tutialspoint.com/perl/perl_database.htm PERL DATABASE ACCESS Copyright tutialspoint.com This tutial will teach you how to access a database inside your Perl script. Starting from Perl 5 it has

More information

Overview. State-of-the-Art. Relative cost of error correction. CS 619 Introduction to OO Design and Development. Testing.

Overview. State-of-the-Art. Relative cost of error correction. CS 619 Introduction to OO Design and Development. Testing. Overview CS 619 Introduction to OO Design and Development ing! Preliminaries! All sorts of test techniques! Comparison of test techniques! Software reliability Fall 2012! Main issues: There are a great

More information

CMSC 330: Organization of Programming Languages. OCaml Imperative Programming

CMSC 330: Organization of Programming Languages. OCaml Imperative Programming CMSC 330: Organization of Programming Languages OCaml Imperative Programming CMSC330 Fall 2017 1 So Far, Only Functional Programming We haven t given you any way so far to change something in memory All

More information

Write a procedure powerset which takes as its only argument a set S and returns the powerset of S.

Write a procedure powerset which takes as its only argument a set S and returns the powerset of S. Answers to CS61 A Final of May 23, 1997 We repeat the questions; some have typos corrected with respect to the actual exam handed out. Question 1 (5 points): Let us represent a set S of unique expressions,

More information

Connecting Arduino to Processing a

Connecting Arduino to Processing a Connecting Arduino to Processing a learn.sparkfun.com tutorial Available online at: http://sfe.io/t69 Contents Introduction From Arduino......to Processing From Processing......to Arduino Shaking Hands

More information

Growing Embedded Applications Organically with Ceedling and Friends. Greg Williams

Growing Embedded Applications Organically with Ceedling and Friends. Greg Williams Growing Embedded Applications Organically with Ceedling and Friends Greg Williams Embedded Development... Limited Memory Limited Processing Power Language Limitations Short Timelines Growing Complexity

More information

7. (2 pts) str( str( b ) ) str '4' will not compile (single, double, or triple quotes

7. (2 pts) str( str( b ) ) str '4' will not compile (single, double, or triple quotes For the following questions, use these variable definitions a = 45 b = 4 c = 39999 d = "7" What is the value and type of each of the following expressions or, if it won't compile, circle that answer type

More information

CPE 112 Spring 2015 Exam II (100 pts) March 4, Definition Matching (8 Points)

CPE 112 Spring 2015 Exam II (100 pts) March 4, Definition Matching (8 Points) Name Definition Matching (8 Points) 1. (8 pts) Match the words with their definitions. Choose the best definition for each word. Relational Expression Iteration Counter Count-controlled loop Loop Flow

More information

Incoherent Rant about Code

Incoherent Rant about Code Incoherent Rant about Code Aras Pranckevičius Unity Unity Bootcamp II, 2010 Nov-Dec This is pretty much on random code related things with no structure. Expect lots of topic jumps for no reason at all!

More information

JavaScript: More Syntax and Using Events

JavaScript: More Syntax and Using Events JavaScript: Me Syntax and Using Events CISC 282 October 4, 2017 null and undefined null is synonymous with nothing i.e., no value, nothing there undefined in synonymous with confusion i.e., what's this?

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

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

Beyond Blocks: Python Session #1

Beyond Blocks: Python Session #1 Beyond Blocks: Session #1 CS10 Spring 2013 Thursday, April 30, 2013 Michael Ball Beyond Blocks : : Session #1 by Michael Ball adapted from Glenn Sugden is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike

More information

Clojure. The Revenge of Data. by Vjeran Marcinko Kapsch CarrierCom

Clojure. The Revenge of Data. by Vjeran Marcinko Kapsch CarrierCom Clojure The Revenge of Data by Vjeran Marcinko Kapsch CarrierCom Data Processing is what we do Most programs receive, transform, search, and send data Data is raw, immutable information In its essence,

More information

Recap: ML s Holy Trinity. Story So Far... CSE 130 Programming Languages. Datatypes. A function is a value! Next: functions, but remember.

Recap: ML s Holy Trinity. Story So Far... CSE 130 Programming Languages. Datatypes. A function is a value! Next: functions, but remember. CSE 130 Programming Languages Recap: ML s Holy Trinity Expressions (Syntax) Exec-time Dynamic Values (Semantics) Datatypes Compile-time Static Types Ranjit Jhala UC San Diego 1. Programmer enters expression

More information

shortcut Tap into learning NOW! Visit for a complete list of Short Cuts. Your Short Cut to Knowledge

shortcut Tap into learning NOW! Visit  for a complete list of Short Cuts. Your Short Cut to Knowledge shortcut Your Short Cut to Knowledge The following is an excerpt from a Short Cut published by one of the Pearson Education imprints. Short Cuts are short, concise, PDF documents designed specifically

More information

CMSC 201 Fall 2018 Lab 04 While Loops

CMSC 201 Fall 2018 Lab 04 While Loops CMSC 201 Fall 2018 Lab 04 While Loops Assignment: Lab 04 While Loops Due Date: During discussion, September 24 th through September 27 th Value: 10 points (8 points during lab, 2 points for Pre Lab quiz)

More information

Pathologically Eclectic Rubbish Lister

Pathologically Eclectic Rubbish Lister Pathologically Eclectic Rubbish Lister 1 Perl Design Philosophy Author: Reuben Francis Cornel perl is an acronym for Practical Extraction and Report Language. But I guess the title is a rough translation

More information

Crystal for Rubyists

Crystal for Rubyists Crystal for Rubyists Serdar Dogruyol Contents Preamble 2 Why Crystal? 3 Installing Crystal 5 Binary installers.............................. 5 From Source................................ 5 Future Proofing............................

More information

Chapter 14 Testing Tactics

Chapter 14 Testing Tactics Chapter 14 Testing Tactics Moonzoo Kim CS Division of EECS Dept. KAIST moonzoo@cs.kaist.ac.kr http://pswlab.kaist.ac.kr/courses/cs550-07 Spring 2007 1 Overview of Ch14. Testing Tactics 14.1 Software Testing

More information

CSE 130 Programming Languages. Datatypes. Ranjit Jhala UC San Diego

CSE 130 Programming Languages. Datatypes. Ranjit Jhala UC San Diego CSE 130 Programming Languages Datatypes Ranjit Jhala UC San Diego Recap: ML s Holy Trinity Expressions (Syntax) Exec-time Dynamic Values (Semantics) Compile-time Static Types 1. Programmer enters expression

More information

Failure is not an option

Failure is not an option Failure is not an option or: How I learned to read the logs and love the stack trace Hiro Asari Senior Software Engineer Red Hat RubyConf Brasil 2012 Failure is not an option or: How I learned to read

More information

INF4820: Algorithms for Artificial Intelligence and Natural Language Processing. Common Lisp Fundamentals

INF4820: Algorithms for Artificial Intelligence and Natural Language Processing. Common Lisp Fundamentals INF4820: Algorithms for Artificial Intelligence and Natural Language Processing Common Lisp Fundamentals Stephan Oepen & Murhaf Fares Language Technology Group (LTG) August 30, 2017 Last Week: What is

More information