Who's speaking? linkd.in/jbaruch. stackoverflow.com/users/402053/jbaruch
|
|
- Jeffry Newton
- 6 years ago
- Views:
Transcription
1
2 Who's speaking? linkd.in/jbaruch stackoverflow.com/users/402053/jbaruch
3 Frogs Groovy
4 Frogs Groovy Hosting Groovy on Bintray Hosting Groovy on Artifactory Bintray UI is Grails Artifactory plugins are Groovy Gradle and Grails plugins on Bintray
5 First Season Was a Blast!
6
7 BTW,
8 1. Two entertaining guys on stage
9
10 1. Two entertaining guys on stage 2. Funny Puzzling questions 3. You think and vote 4. Awesome Groovy t-shirts fly in the air 5. Official twitter handle! groovypuzzlers
11
12 Cédric?!
13 All works (or doesn't work) in Groovy 2.4.5
14
15
16 'a'..'z'.each { println it } A. a b c... z B. NoSuchMethodError C. z D. Won t run
17
18 ('a'..'z').each { println it } You knew it, right?
19 All problems in computer science can be solved by another pair of parentheses John McCarthy, the inventor of LISP
20 And the t-shirt goes to
21
22 How Many Bachs? def back = 'back' def quotes = ["I'll be $back", "I'll be ${-> back}", "I'll be ${back}", A.No Bachs "I'll be "+back] println quotes back = 'Bach' B.One Bach println quotes C.Two Bachs D.Three Bachs
23
24 Only closures are evaluated at runtime Others are inlined
25 Only closures are evaluated at def back = 'back' def quotes = ["I'll be $back", "I'll be ${-> back}", "I'll be ${back}", "I'll be "+back] runtime Others are inlined
26 Only closures are evaluated at def back = 'back' def quotes = ["I'll be $back", "I'll be ${-> back}", "I'll be ${back}", "I'll be "+back] runtime Others are inlined That is the only closure
27 And the t-shirt goes to
28
29
30 How one prints 666? A. def beast = '6' * Math.PI B. def beast = '6' * '3' C. def beast = '667' 1 D. def beast = '6' + '6'
31
32 def beast = '6' * Math.PI
33 def beast = '6' *
34
35 /** * Repeat a String a certain number of times. * self a String to be repeated factor the number of times the String should be repeated a String composed of a repetition IllegalArgumentException if the number of repetitions is < */ public static String multiply(string self, Number factor) { int size = factor.intvalue(); }
36 def beast = '6' *
37 def beast = '6' * 3
38 Pop Quiz! B. def beast = '6' * '3' C. def beast = '667' 1 D. def beast = '6' + '6'
39 Pop Quiz! B. def beast = '6' * '3' C. def beast = '667' 1 D. def beast = '6' + '6' + (0 + 6)
40 Pop Quiz! B. def beast = '6' * '3' C. def beast = '667' 1 D. def beast = '6' + '6' + (0 + 6) Yup, I am watching you!
41 And the t-shirt goes to
42
43 class THERE_CAN_BE_ONLY_ONE { } class MacLeod { } THERE_CAN_BE_ONLY_ONE getthere_can_be_only_one() { Class clazz = THERE_CAN_BE_ONLY_ONE return clazz.newinstance() } println new MacLeod().THERE_CAN_BE_ONLY_ONE
44 class THERE_CAN_BE_ONLY_ONE { } class MacLeod { THERE_CAN_BE_ONLY_ONE getthere_can_be_only_one() { Class clazz = THERE_CAN_BE_ONLY_ONE return clazz.newinstance() } } println new MacLeod().THERE_CAN_BE_ONLY_ONE A. Won't start B. No such property: THERE_CAN_BE_ONLY_ONE for class: MacLeod C. THERE_CAN_BE_ONLY_ONE@3d74bf60 D. Another Exception
45
46 A.MultipleCompilationErrorsException B.StackOverflowError C.NullPointerException D.Yet Another Exception
47
48 class MacLeod { } THERE_CAN_BE_ONLY_ONE getthere_can_be_only_one() { Class clazz = THERE_CAN_BE_ONLY_ONE return clazz.newinstance() }
49 class MacLeod { } THERE_CAN_BE_ONLY_ONE getthere_can_be_only_one() { Class clazz = getthere_can_be_only_one() return clazz.newinstance() }
50 Let's Fix It! Class<THERE_CAN_BE_ONLY_ONE> clazz = THERE_CAN_BE_ONLY_ONE.class
51 class MacLeod { } THERE_CAN_BE_ONLY_ONE getthere_can_be_only_one() { Class<THERE_CAN_BE_ONLY_ONE> clazz = THERE_CAN_BE_ONLY_ONE.class return clazz.newinstance() }
52
53 class MacLeod { } THERE_CAN_BE_ONLY_ONE getthere_can_be_only_one() { Class<THERE_CAN_BE_ONLY_ONE> clazz = getthere_can_be_only_one().class return clazz.newinstance() }
54 Let's Fix It! Class<THERE_CAN_BE_ONLY_ONE> clazz = (THERE_CAN_BE_ONLY_ONE as Class)
55 class MacLeod { } THERE_CAN_BE_ONLY_ONE getthere_can_be_only_one() { Class<THERE_CAN_BE_ONLY_ONE> clazz = (THERE_CAN_BE_ONLY_ONE as Class) return clazz.newinstance() }
56
57 class MacLeod { } THERE_CAN_BE_ONLY_ONE getthere_can_be_only_one() { Class<THERE_CAN_BE_ONLY_ONE> clazz = (getthere_can_be_only_one() as Class) return clazz.newinstance() }
58 Let's Fix It!
59 And the t-shirt goes to
60
61 @groovy.transform.inheritconstructors class TreaayeMap extends HashMap { } TreaayeMap a = [5] TreaayeMap b = [6] println "${a.getclass()} ${a.equals(b)}" A.class HashMap true B.class TreaayeMap false C.class TreaayeMap true D.class HashMap false
62
63
64
65 TreaayeMap a = [5]
66 TreaayeMap a = [5]
67 TreaayeMap a = [5]
68 TreaayeMap a = class TreaayeMap extends HashMap { }
69 /** * Constructs an empty <tt>hashmap</tt> with the specified initial * capacity and the default load factor (0.75). * initialcapacity the initial capacity. IllegalArgumentException if the initial capacity is negative. */ public HashMap(int initialcapacity) TreaayeMap a = class TreaayeMap extends HashMap { }
70 equals() doesn t care about capacity, mappings only
71 And the t-shirt goes to
72
73 class Kitty { def fur } def kitties = [new Kitty(fur: 'soft'),new Kitty(fur: 'warm'),new Kitty(fur: 'purr') ] println kitties.collect { it.fur } println kitties*.fur println kitties.fur How many of the printed lines will be the same? A.All different B.2 similar, one different C.All the same
74
75 class Kitty { def fur } def kitties println kitties.collect { it.fur } println kitties*.fur println kitties.fur How many of the printed lines will be the same? A.All different B.2 similar, one different C.All the same
76
77 class Kitty { def fur } def kitties println kitties.fur
78 class Kitty { def fur } def kitties println kitties.fur
79 class Kitty { def fur } def kitties println kitties.collect { it.fur }
80 class Kitty { def fur } def kitties println kitties.collect { it.fur } public static Collection ascollection(object value) { if (value == null) { return Collections.EMPTY_LIST; } }
81 class Kitty { def fur } def kitties println kitties*.fur
82 class Kitty { def fur } def kitties println kitties*.fur
83 class Kitty { def fur } def kitties println kitties*.fur
84 Consistency, yeah. [] null Caught: java.lang.nullpointerexception: Cannot get property 'fur' on null object
85 All happy families are alike; each unhappy family is unhappy in its own way. Leo Tolstoy, Anna Karenina
86 And the t-shirt goes to
87
88 ArrayList<String> expendables = ['Arnold', 'Chuck', Sly'] def expendable = //someone from the list for(string hero in expendables) { if(hero == expendable){ expendables.remove(hero) } } println expendables
89 Which one won t cause a ConcurrentModificationException? ArrayList<String> expendables = ['Arnold', 'Chuck', Sly'] def expendable = //someone from the list for(string hero in expendables) { if(hero == expendable){ expendables.remove(hero) } } println expendables A.Can't avoid CME B.Arnold C.Chuck D.Sly
90
91
92 You have been warned.
93 Let s decompile this, baby! List expendables = Arrays.asList(new String[]{"Arnold", "Chuck", " Sly"}); String expendable = "Chuck"; Iterator iterator = expendables.iterator(); while(iterator.hasnext()) { String hero = (String)iterator.next(); if(hero.equals(expendable)) { expendables.remove(hero); } }
94 while(iterator.hasnext()) { String hero = (String)iterator.next(); if(hero.equals(expendable)) { // expendables.remove(hero); } }
95 while(iterator.hasnext()) { String hero = (String)iterator.next(); if(hero.equals(expendable)) { // expendables.remove(hero); } } public E next() { checkforcomodification(); cursor = i + 1; } public boolean hasnext() { return cursor!= size(); } Modifications are only checked in the next cycle Getting ready for hasnext() check in the next cycle Exit on last element +1 == size()
96 while(iterator.hasnext()) { String hero = (String)iterator.next(); if(hero.equals(expendable)) { // expendables.remove(hero); } } public E next() { checkforcomodification(); cursor = i + 1; } After Sly cursor is 3 public boolean hasnext() { return cursor!= size(); } And size is 3 as well All good. Now let s mess with
97 while(iterator.hasnext()) { String hero = (String)iterator.next(); if(hero.equals(expendable)) { expendables.remove(hero); } } public E next() { checkforcomodification(); cursor = i + 1; } public boolean hasnext() { return cursor!= size(); } After Chuck the cursor is 2 Then we remove the element And now the size now is 2! It won t get to the next() to run
98 Hey, what about me?!
99 while(iterator.hasnext()) { String hero = (String)iterator.next(); if(hero.equals(expendable)) { expendables.remove(hero); } } public E next() { checkforcomodification(); cursor = i + 1; } After Sly the cursor is 3 public boolean hasnext() { return cursor!= size(); } Then we remove the element But the size now is 2! It will go to another loop and fail on
100 And the t-shirt goes to
101
102 String truth = 'false' boolean groovytruth = truth println groovytruth
103 String truth = 'false' boolean groovytruth = truth println groovytruth A.false B.true C.ClassCastException D.Startup error
104
105
106
107 And the t-shirt goes to
108
109 assert 1L == 1 println 1L.equals(1) A. Assertion failed B. true C. false D. MissingMethodException
110
111
112
113
114 And the t-shirt goes to
115
116
117 A. [[2, 3, 5], [2, 4, 8], [42, 73, , 0]] B. Won't run C. [[null, null, null, 5]] D. null
118
119
120
121 No t-shirt for this guy
122
123 def jailhouserock def lovemetender def rockaroundtheclock = [1,2,3] jailhouserock?:[] + lovemetender?:[] + rockaroundtheclock?:[] *Yes, we know, it's not Elvis' song.
124 def jailhouserock def lovemetender def rockaroundtheclock = [1,2,3] jailhouserock?:[] + lovemetender?:[] + rockaroundtheclock?:[] A.[null] B.null C.[] D.[1,2,3]
125
126 def jailhouserock def lovemetender def rockaroundtheclock = [1,2,3] jailhouserock?:[] + lovemetender?:[] + rockaroundtheclock?:[]
127 def jailhouserock def lovemetender def rockaroundtheclock = [1,2,3] jailhouserock?:[null]?:[] + rockaroundtheclock?:[]
128 def jailhouserock def lovemetender def rockaroundtheclock = [1,2,3] jailhouserock?:[null]?:[1,2,3]?:[]
129 def jailhouserock def lovemetender def rockaroundtheclock = [1,2,3] [null]
130 Let's fix it (jailhouserock?:[])+(lovemetender?:[])+(rockaroundtheclock?:[]) Love me tender!
131 And the t-shirt goes to
132 Conclusions
133 1. Write readable code 2. Comment neat tricks 3. Sometimes it is just a bug 4. Use static code analysis (intellij IDEA!) 5. Rtfm 6. Parentheses. Always use Parentheses.
134 We keep going! (Look at the awesome t-shirts!) Puzzlers? Gotchas? Fetal position inducing behavior? - puzzlers jfrog.com - Groovypuzzlers
135 Jfrog always pays its debts
136 Positive feedback? Fill the feedback form! Praise us on twitter groovypuzzlers - Groovypuzzlers - tlberglund - jbaruch Negative feeback? /dev/null
137 No, Thank you!
#jenkinsconf. Jenkins user plugin. This time it's. Jenkins User Conference Israel. Shiran JFrog
Jenkins user plugin This time it's Shiran Rubin @ShiranRU JFrog http://jfrog.com July 16, 2014 About me Groovy developer in JFrog. The home of We work with: But support many others. It's time to There's
More informationPIC 10A Flow control. Ernest Ryu UCLA Mathematics
PIC 10A Flow control Ernest Ryu UCLA Mathematics If statement An if statement conditionally executes a block of code. # include < iostream > using namespace std ; int main () { double d1; cin >> d1; if
More informationDESIGNING, CODING, AND DOCUMENTING
DESIGNING, CODING, AND DOCUMENTING Lecture 16 CS2110 Fall 2013 Designing and Writing a Program 2 Don't sit down at the terminal immediately and start hacking Design stage THINK first about the data you
More informationFunctional Programming. Pure Functional Languages
Functional Programming Pure functional PLs S-expressions cons, car, cdr Defining functions read-eval-print loop of Lisp interpreter Examples of recursive functions Shallow, deep Equality testing 1 Pure
More informationHomography estimation
RANSAC continued Homography estimation x w? ~x img H~x w Homography estimation? x img ~x w = H 1 ~x img Homography estimation (0,0) (1,0) (6.4,2.8) (8.0,2.9) (5.6, 4.0) (7.8, 4.2) (0,1) (1,1) Ah =0s.tkhk
More informationKotlin for Android Developers
Kotlin for Android Developers Learn Kotlin the easy way while developing an Android App Antonio Leiva This book is for sale at http://leanpub.com/kotlin-for-android-developers This version was published
More informationFunctional Programming. Pure Functional Languages
Functional Programming Pure functional PLs S-expressions cons, car, cdr Defining functions read-eval-print loop of Lisp interpreter Examples of recursive functions Shallow, deep Equality testing 1 Pure
More informationException Handling. Sometimes when the computer tries to execute a statement something goes wrong:
Exception Handling Run-time errors The exception concept Throwing exceptions Handling exceptions Declaring exceptions Creating your own exception Ariel Shamir 1 Run-time Errors Sometimes when the computer
More informationException Handling. Run-time Errors. Methods Failure. Sometimes when the computer tries to execute a statement something goes wrong:
Exception Handling Run-time errors The exception concept Throwing exceptions Handling exceptions Declaring exceptions Creating your own exception 22 November 2007 Ariel Shamir 1 Run-time Errors Sometimes
More informationKotlin for Android Developers
Kotlin for Android Developers Learn Kotlin the easy way while developing an Android App Antonio Leiva This book is for sale at http://leanpub.com/kotlin-for-android-developers This version was published
More informationCS61B Spring 2016 Guerrilla Section 2 Worksheet
Spring 2016 27 February 2016 Directions: In groups of 4-5, work on the following exercises. Do not proceed to the next exercise until everyone in your group has the answer and understands why the answer
More informationDECISION STRUCTURES: USING IF STATEMENTS IN JAVA
DECISION STRUCTURES: USING IF STATEMENTS IN JAVA S o far all the programs we have created run straight through from start to finish, without making any decisions along the way. Many times, however, you
More informationThese are notes for the third lecture; if statements and loops.
These are notes for the third lecture; if statements and loops. 1 Yeah, this is going to be the second slide in a lot of lectures. 2 - Dominant language for desktop application development - Most modern
More informationCS 3 Introduction to Software Engineering. 3: Exceptions
CS 3 Introduction to Software Engineering 3: Exceptions Questions? 2 Objectives Last Time: Procedural Abstraction This Time: Procedural Abstraction II Focus on Exceptions. Starting Next Time: Data Abstraction
More informationUser Plugins. About Plugins. Deploying Plugins
User Plugins About Plugins Artifactory Pro allows you to easily extend Artifactory's behavior with your own plugins written in Groovy. User plugins are used for running user's code in Artifactory. Plugins
More informationLab 5 - Repetition. September 26, 2018
Lab 5 - Repetition September 26, 2018 1 ME 30 Lab 5 - Repetition ME 30 ReDev Team Description and Summary: This lab introduces the programming concept of repetition, also called looping, where some operations
More informationDesigning and Writing a Program. Divide and Conquer! The Design-Code-Debug Cycle. Documentation is Code. Pair Programming 3/8/2012
CS/ENGRD 2110 Object-Oriented Programming and Data Structures Spring 2012 Thorsten Joachims Lecture 13: Designing, Coding, and Documenting Designing and Writing a Program Don't sit down at the terminal
More informationProgramming Fundamentals
Programming Fundamentals Computers are really very dumb machines -- they only do what they are told to do. Most computers perform their operations on a very primitive level. The basic operations of a computer
More information<Insert Picture Here> How to Debug Oracle ADF Framework Applications
How to Debug Oracle ADF Framework Applications Steve Muench Oracle ADF Development Team "My ADF Application's Not Working Help!" "I see an exception stack trace " "I get data, but
More informationControl of Flow. There are several Python expressions that control the flow of a program. All of them make use of Boolean conditional tests.
Control of Flow There are several Python expressions that control the flow of a program. All of them make use of Boolean conditional tests. If Statements While Loops Assert Statements 6 If Statements if
More informationCS162 Week 1. Kyle Dewey. Friday, January 10, 14
CS162 Week 1 Kyle Dewey Overview Basic Introduction CS Accounts Scala survival guide Office Hour Choose an hour from within: Tuesday/Thursday 11 AM - 1 PM Friday 11 AM - 4 PM Also available by appointment
More informationAlgorithms. Produced by. Eamonn de Leastar
Algorithms Produced by Eamonn de Leastar (edeleastar@wit.ie) Collections ± Collections Architecture ± Definition ± Architecture ± Interfaces ± Collection ± List ± Set ± Map ± Iterator ± Implementations
More informationSTUDENT LESSON A12 Iterations
STUDENT LESSON A12 Iterations Java Curriculum for AP Computer Science, Student Lesson A12 1 STUDENT LESSON A12 Iterations INTRODUCTION: Solving problems on a computer very often requires a repetition of
More informationMITOCW ocw f99-lec07_300k
MITOCW ocw-18.06-f99-lec07_300k OK, here's linear algebra lecture seven. I've been talking about vector spaces and specially the null space of a matrix and the column space of a matrix. What's in those
More informationHashing as a Dictionary Implementation
Hashing as a Dictionary Implementation Chapter 22 Contents The Efficiency of Hashing The Load Factor The Cost of Open Addressing The Cost of Separate Chaining Rehashing Comparing Schemes for Collision
More informationLab 5 : WordAnalyzer class
Lab 5 : WordAnalyzer class Introduction READ THE INSTRUCTIONS FIRST! The WordAnalyzer class was written to perform a few different analyses of words: - identify the first repeated (adjacent) character
More informationObject Oriented Programming Exception Handling
Object Oriented Programming Exception Handling Budditha Hettige Department of Computer Science Programming Errors Types Syntax Errors Logical Errors Runtime Errors Syntax Errors Error in the syntax of
More informationCS159. Nathan Sprague. September 30, 2015
CS159 Nathan Sprague September 30, 2015 Testing Happens at Multiple Levels Unit Testing - Test individual classes in isolation. Focus is on making sure that each method works according to specification.
More informationAnimation. Piech, CS106A, Stanford University
Animation Our story so far Our story so far Learning Goals 1. Write animated programs 2. Center an object You will be able to write Bouncing Ball Learning Goals For Me 1. Speak slower But First! private
More informationChapter 4: Conditionals and Loops
Chapter 4: Conditionals and Loops CS 121 Department of Computer Science College of Engineering Boise State University March 2, 2016 Chapter 4: Conditionals and Loops CS 121 1 / 76 Chapter 4 Topics Flow
More informationCS-152: Software Testing
CS-152: Software Testing Neal Holtschulte July 2, 2013 Software Testing Outline Terminology Assertions and when to use them Try-catch and when to use them What are Exceptions Further resources Practice
More informationEnums, Generics, Nested Types. June 23, 2017
Enums, Generics, Nested Types June 23, 2017 Reading Quiz What is true of Generics? A. They allow you to maintain more type information in your code B. They are required to store different types of objects
More informationSummer 2017 Discussion 10: July 25, Introduction. 2 Primitives and Define
CS 6A Scheme Summer 207 Discussion 0: July 25, 207 Introduction In the next part of the course, we will be working with the Scheme programming language. In addition to learning how to write Scheme programs,
More informationBASIC COMPUTATION. public static void main(string [] args) Fundamentals of Computer Science I
BASIC COMPUTATION x public static void main(string [] args) Fundamentals of Computer Science I Outline Using Eclipse Data Types Variables Primitive and Class Data Types Expressions Declaration Assignment
More informationPractice exam for CMSC131-04, Fall 2017
Practice exam for CMSC131-04, Fall 2017 Q1 makepalindrome - Relevant topics: arrays, loops Write a method makepalidrome that takes an int array, return a new int array that contains the values from the
More informationMITOCW 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 informationCSE143X: Computer Programming I & II Programming Assignment #9 due: Monday, 11/27/17, 11:00 pm
CSE143X: Computer Programming I & II Programming Assignment #9 due: Monday, 11/27/17, 11:00 pm This assignment will give you practice with recursive backtracking. You are to create a class called AnagramSolver
More informationThe following content is provided under a Creative Commons license. Your support
MITOCW Lecture 10 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 make a
More informationCMSC 201 Spring 2017 Lab 05 Lists
CMSC 201 Spring 2017 Lab 05 Lists Assignment: Lab 05 Lists Due Date: During discussion, February 27th through March 2nd Value: 10 points (8 points during lab, 2 points for Pre Lab quiz) This week s lab
More informationCS 61B Spring 2017 Guerrilla Section 3 Solutions
Spring 2017 25 February 2017 Directions: In groups of 4-5, work on the following exercises. Do not proceed to the next exercise until everyone in your group has the answer and understands why the answer
More informationCSE 331. Programming by contract: pre/post conditions; Javadoc
CSE 331 Programming by contract: pre/post conditions; Javadoc slides created by Marty Stepp based on materials by M. Ernst, S. Reges, D. Notkin, R. Mercer, Wikipedia http://www.cs.washington.edu/331/ 1
More informationSCHEME 8. 1 Introduction. 2 Primitives COMPUTER SCIENCE 61A. March 23, 2017
SCHEME 8 COMPUTER SCIENCE 61A March 2, 2017 1 Introduction In the next part of the course, we will be working with the Scheme programming language. In addition to learning how to write Scheme programs,
More informationCS18000: Programming I
CS18000: Programming I Linked Data Structures 5 April 2010 Prof. Chris Clifton Multiple Items: Beyond Arrays interface Set { boolean contains(e item); /* true iff x s.t. item.equals(x) */ void add(e
More informationTesting and Debugging
COS226 - Spring 2018 Class Meeting # 3 February 12, 2018 Testing and Debugging Tips & Tricks Ibrahim Albluwi COS 126 Unofficial Coding Strategy Repeat Until Deadline : Hack! Click Check All Submitted Files
More informationWhat is an Iterator? An iterator is an abstract data type that allows us to iterate through the elements of a collection one by one
Iterators What is an Iterator? An iterator is an abstract data type that allows us to iterate through the elements of a collection one by one 9-2 2-2 What is an Iterator? An iterator is an abstract data
More informationCSCI-140 Midterm Review October 10, 2015 Presented by the RIT Computer Science Community
CSCI-140 Midterm Review October 10, 2015 Presented by the RIT Computer Science Community http://csc.cs.rit.edu 1. In each of the following situations, would it be better to use array-backed storage or
More informationErrors. And How to Handle Them
Errors And How to Handle Them 1 GIGO There is a saying in computer science: Garbage in, garbage out. Is this true, or is it just an excuse for bad programming? Answer: Both. Here s what you want: Can you
More informationProgramming with GUTs
Programming with GUTs @KevlinHenney kevlin@curbralan.com When you write unit tests, TDDstyle or after your development, you scrutinize, you think, and often you prevent problems without even encountering
More informationThe Grails Plugin System
Grails Seminar 11/12/09 The Grails Plugin System Modular Application Development With Grails The Background Grails is designed to wire together different libraries and make them easy to use In this sense
More informationA guide to learning the popular JVM programming language, Groovy 2.x, and its ecosystem
Learning Groovy A guide to learning the popular JVM programming language, Groovy 2.x, and its ecosystem Adam L. Davis This book is for sale at http://leanpub.com/learninggroovy This version was published
More informationToday. Homework 1 / Test 1 Making decisions in Java If statements If/Else ( Either-or ) statements Logical NOT operator
Today Homework 1 / Test 1 Making decisions in Java If statements If/Else ( Either-or ) statements Logical NOT operator BIT 115: Introduction To Programming 1 Something to Remember: In parameter order,
More informationGroovy A Language Introduction for Java Programmers
Groovy A Language Introduction for Java Programmers Eric Schreiner Managing Director Contecon Software GmbH Eric Schreiner Groovy: A Language Introduction for Java Programmers Slide 1 Other Groovy related
More informationMost of the class will focus on if/else statements and the logical statements ("conditionals") that are used to build them. Then I'll go over a few
With notes! 1 Most of the class will focus on if/else statements and the logical statements ("conditionals") that are used to build them. Then I'll go over a few useful functions (some built into standard
More informationCS 1110, LAB 1: PYTHON EXPRESSIONS.
CS 1110, LAB 1: PYTHON EXPRESSIONS Name: Net-ID: There is an online version of these instructions at http://www.cs.cornell.edu/courses/cs1110/2012fa/labs/lab1 You may wish to use that version of the instructions.
More informationGroovy Primer Chris Dail Groovy Primer (March 2010)
Groovy Primer Chris Dail http://chrisdail.com Twitter: @chrisdail What is Groovy? An agile dynamic language for the Java Platform Both dynamically and statically typed Functional programming influence
More informationCS 314 Principles of Programming Languages
CS 314 Principles of Programming Languages Lecture 16: Functional Programming Zheng (Eddy Zhang Rutgers University April 2, 2018 Review: Computation Paradigms Functional: Composition of operations on data.
More informationPrinciples of Computer Science I
Principles of Computer Science I Prof. Nadeem Abdul Hamid CSC 120A - Fall 2004 Lecture Unit 7 Review Chapter 4 Boolean data type and operators (&&,,) Selection control flow structure if, if-else, nested
More informationCS 106 Introduction to Computer Science I
CS 106 Introduction to Computer Science I 06 / 04 / 2015 Instructor: Michael Eckmann Today s Topics Questions / comments? Calling methods (noting parameter(s) and their types, as well as the return type)
More informationIntroduction to Python and programming. Ruth Anderson UW CSE 160 Winter 2017
Introduction to Python and programming Ruth Anderson UW CSE 160 Winter 2017 1 1. Python is a calculator 2. A variable is a container 3. Different types cannot be compared 4. A program is a recipe 2 0.
More informationCSE 331 Midterm Exam 11/9/15 Sample Solution
Remember: For all of the questions involving proofs, assertions, invariants, and so forth, you should assume that all numeric quantities are unbounded integers (i.e., overflow can not happen) and that
More informationControl Structures 1 / 17
Control Structures 1 / 17 Structured Programming Any algorithm can be expressed by: Sequence - one statement after another Selection - conditional execution (not conditional jumping) Repetition - loops
More information"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 informationLecture. Loops && Booleans. Richard E Sarkis CSC 161: The Art of Programming
Lecture Loops && Booleans Richard E Sarkis CSC 161: The Art of Programming Class Administrivia Agenda (In-)definite loops (for/while) Patterns: interactive loop and sentinel loop Solve problems using (possibly
More informationLoop structures and booleans
Loop structures and booleans Michael Mandel Lecture 7 Methods in Computational Linguistics I The City University of New York, Graduate Center https://github.com/ling78100/lectureexamples/blob/master/lecture07final.ipynb
More informationThe following content is provided under a Creative Commons license. Your support
MITOCW Recitation 1 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 make
More informationExcel Skill Module. EPG Workshop. by T. A. Ebert M.E. Rogers
Excel Skill Module by T. A. Ebert M.E. Rogers Introduction Please become familiar with keyboard shortcuts. They save time, especially with highly repetitive tasks. This module is about developing skills
More informationCompSci 125 Lecture 09. Chapter 5: while, break and continue statements Iterators and the ArrayList Class
CompSci 125 Lecture 09 Chapter 5: while, break and continue statements Iterators and the ArrayList Class Homework Update HW3 Due 9/20 HW4 Due 9/27 Exam-1 10/2 Programming Assignment Update p1: Traffic
More informationSpam. Time: five years from now Place: England
Spam Time: five years from now Place: England Oh no! said Joe Turner. When I go on the computer, all I get is spam email that nobody wants. It s all from people who are trying to sell you things. Email
More information1. Answer as shown or -2 unless question allows partial credit. No points off for differences in spacing, capitalization, commas, and braces
CS314 Fall 2012 Midterm 2 Solution and Grading Criteria. Grading acronyms: AIOBE - Array Index out of Bounds Exception may occur BOD - Benefit of the Doubt. Not certain code works, but, can't prove otherwise
More information3 Nonlocal Exit. Quiz Program Revisited
3 Nonlocal Exit This chapter is about the commands catch and throw. These commands work together as a kind of super-stop command, which you can use to stop several levels of procedure invocation at once.
More informationA simple map: Hashtable
Using Maps A simple map: Hashtable To create a Hashtable, use: import java.util.*; Hashtable table = new Hashtable(); To put things into a Hashtable, use: table.put(key, value); To retrieve a value from
More informationCITS1001 week 4 Grouping objects lecture 2
CITS1001 week 4 Grouping objects lecture 2 Arran Stewart March 29, 2018 1 / 37 Overview Last lecture, we looked at how we can group objects together into collections We looked at the ArrayList class. This
More informationCSE 143 Sp03 Final Exam Sample Solution Page 1 of 13
CSE 143 Sp03 Final Exam Sample Solution Page 1 of 13 Question 1. (3 points) Java classifies exceptions as either checked or unchecked. For each of the following, indicate whether it is checked or unchecked
More informationCSC Java Programming, Fall Java Data Types and Control Constructs
CSC 243 - Java Programming, Fall 2016 Java Data Types and Control Constructs Java Types In general, a type is collection of possible values Main categories of Java types: Primitive/built-in Object/Reference
More informationNote that if both p1 and p2 are null, equals returns true.
258 students took the exam. The average was 26.4 out of 36; the median was 27.5; scores ranged from 3 to 35.5. 133 students scored between 27.5 and 36, 99 between 18.5 and 27, 24 between 9.5 and 18, and
More informationCSE 143 Au04 Midterm 2 Sample Solution Page 1 of 7
CSE 143 Au04 Midterm 2 Sample Solution Page 1 of 7 Reference information about some standard Java library classes appears on the last pages of the test. You can tear off these pages for easier reference
More informationAssertions and Exceptions Lecture 11 Fall 2005
Assertions and Exceptions 6.170 Lecture 11 Fall 2005 10.1. Introduction In this lecture, we ll look at Java s exception mechanism. As always, we ll focus more on design issues than the details of the language,
More informationGroovy. Extending Java with scripting capabilities. Last updated: 10 July 2017
Groovy Extending Java with scripting capabilities Last updated: 10 July 2017 Pepgo Limited, 71-75 Shelton Street, Covent Garden, London, WC2H 9JQ, United Kingdom Contents About Groovy... 3 Install Groovy...
More informationFlow of Control. Chapter 3. Chapter 3 1
Flow of Control Chapter 3 Chapter 3 1 Flow of Control Flow of control is the order in which a program performs actions. Up to this point, the order has been sequential. A branching statement chooses between
More informationQUIZ on Ch.5. Why is it sometimes not a good idea to place the private part of the interface in a header file?
QUIZ on Ch.5 Why is it sometimes not a good idea to place the private part of the interface in a header file? Example projects where we don t want the implementation visible to the client programmer: The
More informationCourse Outline. Introduction to java
Course Outline 1. Introduction to OO programming 2. Language Basics Syntax and Semantics 3. Algorithms, stepwise refinements. 4. Quiz/Assignment ( 5. Repetitions (for loops) 6. Writing simple classes 7.
More informationCS 201 Advanced Object-Oriented Programming Lab 6 - Sudoku, Part 2 Due: March 10/11, 11:30 PM
CS 201 Advanced Object-Oriented Programming Lab 6 - Sudoku, Part 2 Due: March 10/11, 11:30 PM Introduction to the Assignment In this lab, you will finish the program to allow a user to solve Sudoku puzzles.
More informationCMSC 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 informationHomework 2: Imperative Due: 5:00 PM, Feb 15, 2019
CS18 Integrated Introduction to Computer Science Fisler Homework 2: Imperative Due: 5:00 PM, Feb 15, 2019 Contents 1 Overview of Generic/Parameterized Types 2 2 Double the Fun with Doubly-Linked Lists
More information(f) d={ alchemist :( a, t ), shaman : ( s, n ), wizard : ( w, z )} d[ shaman ][1]
CSCI1101 Final Exam December 18, 2018 Solutions 1. Determine the value and type of each of the expressions below. If the question has two lines, assume that the statement in the first line is executed,
More informationDesigning Robust Classes
Designing Robust Classes Learning Goals You must be able to:! specify a robust data abstraction! implement a robust class! design robust software! use Java exceptions Specifications and Implementations
More informationDecision Structures. Selection. Selection options (in Java) Plain if s (3 variations) Each action could be any of: if else (3 variations)
Decision Structures if, if/ conditions Selection DECISION: determine which of 2 paths to follow (1+ statements in each path) CS1110 - Kaminski (ELSE path optional) 2 Selection options (in Java) Plain if
More informationMITOCW watch?v=se4p7ivcune
MITOCW watch?v=se4p7ivcune 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 informationCS112 Lecture: Exceptions. Objectives: 1. Introduce the concepts of program robustness and reliability 2. Introduce exceptions
CS112 Lecture: Exceptions Objectives: 1. Introduce the concepts of program robustness and reliability 2. Introduce exceptions Materials: 1. Online Java documentation to project 2. ExceptionDemo.java to
More informationGuideTorrent. The best excellent exam certification guide torrent and dumps torrent provider
GuideTorrent http://www.guidetorrent.com The best excellent exam certification guide torrent and dumps torrent provider Exam : 1z1-804 Title : Java SE 7 Programmer II Exam Vendor : Oracle Version : DEMO
More informationWhat happens if someone new wants to join our awesome club?
If a variable is like a box an array is like a box with compartments The compartments in arrays are numbered (the element number, starting at 0) and they have a fixed length Once the length is set it cannot
More informationCS314 Exam 2 - Spring Suggested Solution and Criteria 1
CS314 Spring 2016 Exam 2 Solution and Grading Criteria. Grading acronyms: AIOBE - Array Index out of Bounds Exception may occur BOD - Benefit of the Doubt. Not certain code works, but, can't prove otherwise
More informationGraphs: A graph is a data structure that has two types of elements, vertices and edges.
Graphs: A graph is a data structure that has two types of elements, vertices and edges. An edge is a connection between two vetices If the connection is symmetric (in other words A is connected to B B
More informationCSE 331 Summer 2016 Final Exam. Please wait to turn the page until everyone is told to begin.
Name The exam is closed book, closed notes, and closed electronics. Please wait to turn the page until everyone is told to begin. Score / 54 1. / 12 2. / 12 3. / 10 4. / 10 5. / 10 Bonus: 1. / 6 2. / 4
More informationINF4820: 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 informationCSC 1351: Quiz 6: Sort and Search
CSC 1351: Quiz 6: Sort and Search Name: 0.1 You want to implement combat within a role playing game on a computer. Specifically, the game rules for damage inflicted by a hit are: In order to figure out
More informationExceptions in Java
Exceptions in Java 3-10-2005 Opening Discussion Do you have any questions about the quiz? What did we talk about last class? Do you have any code to show? Do you have any questions about the assignment?
More informationAdvanced Java Concepts Unit 3: Stacks and Queues
Advanced Java Concepts Unit 3: Stacks and Queues Stacks are linear collections in which access is completely restricted to just one end, called the top. Stacks adhere to a last-in, first-out protocol (LIFO).
More informationCS112 Lecture: Exceptions and Assertions
Objectives: CS112 Lecture: Exceptions and Assertions 1. Introduce the concepts of program robustness and reliability 2. Introduce exceptions 3. Introduce assertions Materials: 1. Online Java documentation
More informationAll code must follow best practices. Part (but not all) of this is adhering to the following guidelines:
Java Coding Guidelines Version 1.3.2 All code must follow best practices. Part (but not all) of this is adhering to the following guidelines: Development For code development, I recommend the following
More information