Anything You Can Do I Can Do Better

Size: px
Start display at page:

Download "Anything You Can Do I Can Do Better"

Transcription

1 Anything You Can Do I Can Do Better

2 Algebraic Data Types Dynamic type Pattern Matching

3 Constructors

4 Extension Methods

5 Play

6 GATDs

7

8

9

10

11 A Simple Concrete Example

12

13

14 public class Thermometer public static event Action<double> Temperature; const int VendorId = 0x0C70; const int ProductId = 0x0750; static readonly byte[] ReadTemperature = new byte[]0x0, 0x0; static readonly HidDevice _device; static Thermometer() _device = HidDevices.Enumerate(VendorId, ProductId).First(); _device.opendevice(); Loop(); static void Loop() _device.write(readtemperature); _device.readreport(report => var listeners = Temperature; if(listeners!= null) var data = report.data; var temperature = -45+(0.01*BitConverter.ToInt16( new []data[1], data[0], 0)); listeners(temperature); Thread.Sleep(1000); Loop(); ); To keep self heating below 0.1 C, SHT7x should not be active for more than 10% of the time e.g. maximum one measurement per second at 12bit accuracy shall be made.

15 Thermometer.Temperature += t => Console.Write("0, ", t); 27.5, 27.44, 27.39, 27.72, 28.35, 28.82, 29.14, 29.42, 29.64, 29.83, 29.99, 30.12, 30.24, 30.36, 30.45, 30.54, 30.6, 30.68, 30.72, 30.77, 30.82, 30.86, 30.88, 30.91, 30.93, 30.97, 30.99, 31.03, 31.02, 31.04, 31.05, 30.78, 30.58, 30.39, 30.22, 30.08, 29.9, 29.76, 29.64, 29.52, 29.41, 29.32, 29.24, 29.17, 29.07, 28.96, 28.88, 28.82, 28.72

16 Temp alert safe Time How do we convert stream of temperature event notifications to alerts? How do we react to alerts, e.g. send SMS or ?

17 Twilio

18 curl -X POST \ --data-urlencode "To=+1 " \ --data-urlencode "From=+1 " \ --data-urlencode "Body="Hello world!" \ -u AccountSid:AuthToken

19

20 public class BasicAuthenticationHeaderValue : AuthenticationHeaderValue public BasicAuthenticationHeaderValue(string username, string password): base("basic",convert.tobase64string(utf8encoding.utf8.getbytes( string.format("0:1", username, password)))) public class SMS const string Twilio /Accounts/0/SMS/Messages.json"; readonly string AccountSid; readonly string AuthToken; public SMS(string accountsid, string authtoken) AccountSid = accountsid; AuthToken = authtoken; public Task<HttpResponseMessage> var client = new HttpClient DefaultRequestHeaders = Authorization = new BasicAuthenticationHeaderValue(AccountSid, AuthToken) ; var msg = new FormUrlEncodedContent(new NameValuePairs ); return client.postasync(string.format(twilio, AccountSid), msg); public class NameValuePairs : Dictionary<string, string>

21 Response "sid":" ","date_created":"wed, 29 Aug :30: ","date_updated":"Wed, 29 Aug :30: ","date_sent":null,"account_sid":" ","to":"+1 ","from":"+1 ","body":"3:30:43 PM","status":"queued","direction":"outbound-api","api_version":" ","price":null,"uri":"\/ \/Accounts\/ \/SMS\/Messages\/.json" Please, no more boilerplate mapping code!

22 var s 29 Aug :30: "" "; var json = System.Json.JsonValue.Parse(s).Dump(); var created= json["date_created"]; ((DateTime)created).Dump(); dynamic jsond = json; ((DateTime)jsond.date_created).Dump();

23 Static Typing Where Possible Dynamic Typing Where Necessary dynamic x = ; Static type to indicate dynamic typing ;-)

24 Visual Basic had this features forever

25 Dynamic Resolution Rules Try to resolve statically (.ToString(),.Equals()). If the value implements the interface IDynamicMetaObjectProvider, it is a so-called dynamic object, which means that it will itself be asked to bind and perform the operation. If the value is a COM object, the operation is dispatched dynamically through COM IDispatch. If the value is a standard.net object, and the operation will be dispatched using reflection on its type and a C# runtime binder.

26 dynamic d = instance of MyDynamicObject ; d.m(7); // calling methods // getting and settings fields and properties d.f = d.p; // getting and setting through indexers d["one"] = d["two"]; int i = d + 3; // calling operators string s = d(5,7); // invoking as a delegate var c = new C(d); // calling a constructor

27 class JsonValue : IDynamicMetaObjectProvider, class DynamicObject : IDynamicMetaObjectProvider The DynamicObject class enables you to define which operations can be performed on dynamic objects and how to perform those operations. For example, you can define what happens when you try to get or set an object property, call a method, or perform standard mathematical operations such as addition and multiplication.

28 class MyDynamicObject : DynamicObject override IEnumerable<string> GetDynamicMemberNames() override DynamicMetaObject GetMetaObject(Expression parameter) override bool TryBinaryOperation(BinaryOperationBinder binder, object arg, out object result) override bool TryConvert(ConvertBinder binder, out object result) override bool TryCreateInstance(CreateInstanceBinder binder, object[] args, out object result) override bool TryDeleteIndex(DeleteIndexBinder binder, object[] indexes) override bool TryDeleteMember(DeleteMemberBinder binder) override bool TryGetIndex(GetIndexBinder binder, object[] indexes, out object result) override bool TryGetMember(GetMemberBinder binder, out object result) override bool TryInvoke(InvokeBinder binder, object[] args, out object result) override bool TryInvokeMember(InvokeMemberBinder binder, object[] args, out object result) override bool TrySetIndex(SetIndexBinder binder, object[] indexes, object value) override bool TrySetMember(SetMemberBinder binder, object value) override bool TryUnaryOperation(UnaryOperationBinder binder, out object result)

29 var b = new B() as A; F(b); F(b as dynamic); // A // B void F(A a) Console.WriteLine("A"); multi method void F(B a) Console.WriteLine("B"); class A class B : A

30 b.g(); // Hi! (b as dynamic).g(); // throws static class Extensions public static void G(this A a) Console.WriteLine("Hi!"); public static void G(this B a) Console.WriteLine("There!"); Compile-time hack

31 Office/COM interop void Main() var bankaccounts = new [] new ID = , Balance = , new ID = , Balance = ; DisplayInExcel(bankAccounts); CreateIconInWordDoc();

32 static void DisplayInExcel(IEnumerable<dynamic> accounts) var excelapp = new Excel.Application Visible = true, Workbooks = XlWBATemplate.xlWBATWorksheet as dynamic; var worksheet = excelapp.activesheet; worksheet.cells[1, "A"] = "ID Number"; worksheet.cells[1, "B"] = "Current Balance"; foreach (var _ in accounts.select((account,i) => new account, row = i+2)) worksheet.cells[_.row, "A"] = _.account.id; worksheet.cells[_.row, "B"] = _.account.balance; worksheet.columns[1].autofit(); worksheet.columns[2].autofit(); // Put the spreadsheet contents on the clipboard. worksheet.range["a1:b3"].copy();

33 static void CreateIconInWordDoc() var wordapp = new Word.Application Visible = true ; wordapp.documents.add(documenttype: WdNewDocumentType.wdNewBlankDocument); // 7 optional parameters wordapp.selection.pastespecial(link: true, DisplayAsIcon: true);

Introduction to C# Applications

Introduction to C# Applications 1 2 3 Introduction to C# Applications OBJECTIVES To write simple C# applications To write statements that input and output data to the screen. To declare and use data of various types. To write decision-making

More information

Accessing loosely structured data from F# and C# Tomas Petricek PhD Student Microsoft C# MVP

Accessing loosely structured data from F# and C# Tomas Petricek PhD Student Microsoft C# MVP Accessing loosely structured data from F# and C# Tomas Petricek PhD Student Microsoft C# MVP http://tomasp.net/blog @tomaspetricek A little bit about me Real World Functional Programming Co-authored by

More information

C# s A Doddle. Steve Love. ACCU April 2013

C# s A Doddle. Steve Love. ACCU April 2013 C# s A Doddle Steve Love ACCU April 2013 A run through C# (pronounced See Sharp ) is a simple, modern, object-oriented, and type-safe programming language. C# has its roots in the C family of languages,

More information

COMP322 - Introduction to C++ Lecture 09 - Inheritance continued

COMP322 - Introduction to C++ Lecture 09 - Inheritance continued COMP322 - Introduction to C++ Lecture 09 - Inheritance continued Dan Pomerantz School of Computer Science 11 March 2012 Recall from last time Inheritance describes the creation of derived classes from

More information

Hierarchical inheritance: Contains one base class and multiple derived classes of the same base class.

Hierarchical inheritance: Contains one base class and multiple derived classes of the same base class. 1. What is C#? C# (pronounced "C sharp") is a simple, modern, object oriented, and type safe programming language. It will immediately be familiar to C and C++ programmers. C# combines the high productivity

More information

Ken Casada Developer Evangelist Microsoft Switzerland.

Ken Casada Developer Evangelist Microsoft Switzerland. Ken Casada Developer Evangelist Microsoft Switzerland kcasada@microsoft.com http://blogs.msdn.com/swiss_dpe_team/default.aspx C# 3.0 Language Integrated Query C# 2.0 Generics C# 1.0 Managed Code What

More information

OBJECT ORIENTED PROGRAMMING USING C++ CSCI Object Oriented Analysis and Design By Manali Torpe

OBJECT ORIENTED PROGRAMMING USING C++ CSCI Object Oriented Analysis and Design By Manali Torpe OBJECT ORIENTED PROGRAMMING USING C++ CSCI 5448- Object Oriented Analysis and Design By Manali Torpe Fundamentals of OOP Class Object Encapsulation Abstraction Inheritance Polymorphism Reusability C++

More information

OOPs Concepts. 1. Data Hiding 2. Encapsulation 3. Abstraction 4. Is-A Relationship 5. Method Signature 6. Polymorphism 7. Constructors 8.

OOPs Concepts. 1. Data Hiding 2. Encapsulation 3. Abstraction 4. Is-A Relationship 5. Method Signature 6. Polymorphism 7. Constructors 8. OOPs Concepts 1. Data Hiding 2. Encapsulation 3. Abstraction 4. Is-A Relationship 5. Method Signature 6. Polymorphism 7. Constructors 8. Type Casting Let us discuss them in detail: 1. Data Hiding: Every

More information

Object Oriented Programming in C#

Object Oriented Programming in C# Introduction to Object Oriented Programming in C# Class and Object 1 You will be able to: Objectives 1. Write a simple class definition in C#. 2. Control access to the methods and data in a class. 3. Create

More information

Class, Variable, Constructor, Object, Method Questions

Class, Variable, Constructor, Object, Method Questions Class, Variable, Constructor, Object, Method Questions http://www.wideskills.com/java-interview-questions/java-classes-andobjects-interview-questions https://www.careerride.com/java-objects-classes-methods.aspx

More information

POLYMORPHISM 2 PART Abstract Classes Static and Dynamic Casting Common Programming Errors

POLYMORPHISM 2 PART Abstract Classes Static and Dynamic Casting Common Programming Errors POLYMORPHISM 2 PART Abstract Classes Static and Dynamic Casting Common Programming Errors CSC 330 OO Software Design 1 Abstract Base Classes class B { // base class virtual void m( ) =0; // pure virtual

More information

POLYMORPHISM 2 PART. Shared Interface. Discussions. Abstract Base Classes. Abstract Base Classes and Pure Virtual Methods EXAMPLE

POLYMORPHISM 2 PART. Shared Interface. Discussions. Abstract Base Classes. Abstract Base Classes and Pure Virtual Methods EXAMPLE Abstract Base Classes POLYMORPHISM 2 PART Abstract Classes Static and Dynamic Casting Common Programming Errors class B { // base class virtual void m( ) =0; // pure virtual function class D1 : public

More information

Introduction to Programming Using Java (98-388)

Introduction to Programming Using Java (98-388) Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;

More information

Java and C# in Depth

Java and C# in Depth Chair of Software Engineering Java and C# in Depth Carlo A. Furia, Marco Piccioni, Bertrand Meyer Exercise Session Week 4 Chair of Software Engineering Don t forget to form project groups by tomorrow (March

More information

Administrivia. Java Review. Objects and Variables. Demo. Example. Example: Assignments

Administrivia. Java Review. Objects and Variables. Demo. Example. Example: Assignments CMSC433, Spring 2004 Programming Language Technology and Paradigms Java Review Jeff Foster Feburary 3, 2004 Administrivia Reading: Liskov, ch 4, optional Eckel, ch 8, 9 Project 1 posted Part 2 was revised

More information

What property of a C# array indicates its allocated size? What keyword in the base class allows a method to be polymorphic?

What property of a C# array indicates its allocated size? What keyword in the base class allows a method to be polymorphic? What property of a C# array indicates its allocated size? a. Size b. Count c. Length What property of a C# array indicates its allocated size? a. Size b. Count c. Length What keyword in the base class

More information

CS250 Intro to CS II. Spring CS250 - Intro to CS II 1

CS250 Intro to CS II. Spring CS250 - Intro to CS II 1 CS250 Intro to CS II Spring 2017 CS250 - Intro to CS II 1 Topics Virtual Functions Pure Virtual Functions Abstract Classes Concrete Classes Binding Time, Static Binding, Dynamic Binding Overriding vs Redefining

More information

Oracle Cloud Using the Twilio Adapter. Release 17.3

Oracle Cloud Using the Twilio Adapter. Release 17.3 Oracle Cloud Using the Twilio Adapter Release 17.3 E75769-04 September 2017 Oracle Cloud Using the Twilio Adapter, Release 17.3 E75769-04 Copyright 2016, 2017, Oracle and/or its affiliates. All rights

More information

Lab 2 (More Inheritance, Interfaces, Delegates)

Lab 2 (More Inheritance, Interfaces, Delegates) I. Inheritance Lab 2 (More Inheritance, Interfaces, Delegates) Goals of this activity: Learn how inheritance works Understand rules of construction with inheritance Learn the difference between static

More information

CS/B.TECH/CSE(New)/SEM-5/CS-504D/ OBJECT ORIENTED PROGRAMMING. Time Allotted : 3 Hours Full Marks : 70 GROUP A. (Multiple Choice Type Question)

CS/B.TECH/CSE(New)/SEM-5/CS-504D/ OBJECT ORIENTED PROGRAMMING. Time Allotted : 3 Hours Full Marks : 70 GROUP A. (Multiple Choice Type Question) CS/B.TECH/CSE(New)/SEM-5/CS-504D/2013-14 2013 OBJECT ORIENTED PROGRAMMING Time Allotted : 3 Hours Full Marks : 70 The figures in the margin indicate full marks. Candidates are required to give their answers

More information

Oops known as object-oriented programming language system is the main feature of C# which further support the major features of oops including:

Oops known as object-oriented programming language system is the main feature of C# which further support the major features of oops including: Oops known as object-oriented programming language system is the main feature of C# which further support the major features of oops including: Abstraction Encapsulation Inheritance and Polymorphism Object-Oriented

More information

Design Patterns: Part 2

Design Patterns: Part 2 Design Patterns: Part 2 ENGI 5895: Software Design Andrew Vardy with code samples from Dr. Rodrigue Byrne and [Martin(2003)] Faculty of Engineering & Applied Science Memorial University of Newfoundland

More information

Computers and Programming Section 450. Lab #1 C# Basic. Student ID Name Signature

Computers and Programming Section 450. Lab #1 C# Basic. Student ID Name Signature Lab #1 C# Basic Sheet s Owner Student ID Name Signature Group partner 1. Identifier Naming Rules in C# A name must consist of only letters (A Z,a z), digits (0 9), or underscores ( ) The first character

More information

Reflection in C# Case studies in metaprogramming. torsdag 6 mars 14

Reflection in C# Case studies in metaprogramming. torsdag 6 mars 14 Reflection in C# Case studies in metaprogramming GenericDAO ORM for legacy DB DB with T-SQL Stored Procedures (SP) Apps written in C#, VB.Net and VB6 Domain classes require mapping classes Different SP:s

More information

C # 7, 8, and beyond: language features from design to release to IDE support. Kevin

C # 7, 8, and beyond: language features from design to release to IDE support. Kevin C # 7, 8, and beyond: language features from design to release to IDE support Kevin Pilch kevinpi@microsoft.com @Pilchie Stack Overflow - most popular technologies http://stackoverflow.com/insights/survey/2017#most-popular-technologies

More information

CS242 COMPUTER PROGRAMMING

CS242 COMPUTER PROGRAMMING CS242 COMPUTER PROGRAMMING I.Safa a Alawneh Variables Outline 2 Data Type C++ Built-in Data Types o o o o bool Data Type char Data Type int Data Type Floating-Point Data Types Variable Declaration Initializing

More information

Short Notes of CS201

Short Notes of CS201 #includes: Short Notes of CS201 The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with < and > if the file is a system

More information

S.No Question Blooms Level Course Outcome UNIT I. Programming Language Syntax and semantics

S.No Question Blooms Level Course Outcome UNIT I. Programming Language Syntax and semantics S.No Question Blooms Level Course Outcome UNIT I. Programming Language Syntax and semantics 1 What do you mean by axiomatic Knowledge C254.1 semantics? Give the weakest precondition for a sequence of statements.

More information

CS-140 Fall 2017 Test 1 Version Practice Practice for Nov. 20, Name:

CS-140 Fall 2017 Test 1 Version Practice Practice for Nov. 20, Name: CS-140 Fall 2017 Test 1 Version Practice Practice for Nov. 20, 2017 Name: 1. (10 points) For the following, Check T if the statement is true, the F if the statement is false. (a) T F : If a child overrides

More information

CS201 - Introduction to Programming Glossary By

CS201 - Introduction to Programming Glossary By CS201 - Introduction to Programming Glossary By #include : The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with

More information

Object Oriented Programming

Object Oriented Programming Object Oriented Programming Objects self-contained working units encapsulate data and operations exist independantly of each other (functionally, they may depend) cooperate and communicate to perform a

More information

Objectives. Introduce static keyword examine syntax describe common uses

Objectives. Introduce static keyword examine syntax describe common uses Static Objectives Introduce static keyword examine syntax describe common uses 2 Static Static represents something which is part of a type rather than part of an object Two uses of static field method

More information

Imperative Languages!

Imperative Languages! Imperative Languages! Java is an imperative object-oriented language. What is the difference in the organisation of a program in a procedural and an objectoriented language? 30 class BankAccount { private

More information

COE318 Lecture Notes Week 10 (Nov 7, 2011)

COE318 Lecture Notes Week 10 (Nov 7, 2011) COE318 Software Systems Lecture Notes: Week 10 1 of 5 COE318 Lecture Notes Week 10 (Nov 7, 2011) Topics More about exceptions References Head First Java: Chapter 11 (Risky Behavior) The Java Tutorial:

More information

CSC 415 ONLINE PHOTOALBUM: THE SEQUEL ASP.NET VERSION

CSC 415 ONLINE PHOTOALBUM: THE SEQUEL ASP.NET VERSION CSC 415 ONLINE PHOTOALBUM: THE SEQUEL ASP.NET VERSION GODFREY MUGANDA In this project, you will convert the Online Photo Album project to run on the ASP.NET platform, using only generic HTTP handlers.

More information

ScaleOut Digital Twin Builder User Guide Version 0.5-Beta for ScaleOut StreamServer V5.8

ScaleOut Digital Twin Builder User Guide Version 0.5-Beta for ScaleOut StreamServer V5.8 ScaleOut Digital Twin Builder User Guide Version 0.5-Beta for ScaleOut StreamServer V5.8 Introduction The ScaleOut Digital Twin Builder is a software toolkit for creating stateful stream-processing applications

More information

Object-Oriented Programming

Object-Oriented Programming Object-Oriented Programming In C++ classes provide the functionality necessary to use object-oriented programming OOP is a particular way of organizing computer programs It doesn t allow you to do anything

More information

JavaScript CoAPRequest API

JavaScript CoAPRequest API JavaScript CoAPRequest API Abstract The CoAPRequest specification defines an API that provides scripted client functionality for transferring data between a CoAP client and a CoAP server. Table of Contents

More information

Exercise Session Week 8

Exercise Session Week 8 Chair of Software Engineering Java and C# in Depth Carlo A. Furia, Marco Piccioni, Bertrand Meyer Exercise Session Week 8 Quiz 1: What is printed? (Java) class MyTask implements Runnable { public void

More information

M257 Past Paper Oct 2008 Attempted Solution

M257 Past Paper Oct 2008 Attempted Solution M257 Past Paper Oct 2008 Attempted Solution Part 1 Question 1 A version of Java is a particular release of the language, which may be succeeded by subsequent updated versions at a later time. Some examples

More information

Chair of Software Engineering. Java and C# in Depth. Prof. Dr. Bertrand Meyer. Exercise Session 8. Nadia Polikarpova

Chair of Software Engineering. Java and C# in Depth. Prof. Dr. Bertrand Meyer. Exercise Session 8. Nadia Polikarpova Chair of Software Engineering Java and C# in Depth Prof. Dr. Bertrand Meyer Exercise Session 8 Nadia Polikarpova Quiz 1: What is printed? (Java) class MyTask implements Runnable { «Everything is ok! public

More information

B2.52-R3: INTRODUCTION TO OBJECT ORIENTATED PROGRAMMING THROUGH JAVA

B2.52-R3: INTRODUCTION TO OBJECT ORIENTATED PROGRAMMING THROUGH JAVA B2.52-R3: INTRODUCTION TO OBJECT ORIENTATED PROGRAMMING THROUGH JAVA NOTE: 1. There are TWO PARTS in this Module/Paper. PART ONE contains FOUR questions and PART TWO contains FIVE questions. 2. PART ONE

More information

JAVA MOCK TEST JAVA MOCK TEST IV

JAVA MOCK TEST JAVA MOCK TEST IV http://www.tutorialspoint.com JAVA MOCK TEST Copyright tutorialspoint.com This section presents you various set of Mock Tests related to Java Framework. You can download these sample mock tests at your

More information

Inheritance. OOP components. Another Example. Is a Vs Has a. Virtual Destructor rule. Virtual Functions 4/13/2017

Inheritance. OOP components. Another Example. Is a Vs Has a. Virtual Destructor rule. Virtual Functions 4/13/2017 OOP components For : COP 3330. Object oriented Programming (Using C++) http://www.compgeom.com/~piyush/teach/3330 Data Abstraction Information Hiding, ADTs Encapsulation Type Extensibility Operator Overloading

More information

Introduction to Inheritance

Introduction to Inheritance Introduction to Inheritance James Brucker These slides cover only the basics of inheritance. What is Inheritance? One class incorporates all the attributes and behavior from another class -- it inherits

More information

Binghamton University. CS-140 Fall Dynamic Types

Binghamton University. CS-140 Fall Dynamic Types Dynamic Types 1 Assignment to a subtype If public Duck extends Bird { Then, you may code:. } Bird bref; Duck quack = new Duck(); bref = quack; A subtype may be assigned where the supertype is expected

More information

Handout 9 OO Inheritance.

Handout 9 OO Inheritance. Handout 9 CS603 Object-Oriented Programming Fall 2016 Page 1 of 11 Handout 9 OO Inheritance. All classes in Java form a hierarchy. The top of the hierarchy is class Object Example: classicalarchives.com

More information

Exercise Session Week 8

Exercise Session Week 8 Chair of Software Engineering Java and C# in Depth Carlo A. Furia, Marco Piccioni, Bertrand Meyer Exercise Session Week 8 Java 8 release date Was early September 2013 Currently moved to March 2014 http://openjdk.java.net/projects/jdk8/milestones

More information

CMSC131. Inheritance. Object. When we talked about Object, I mentioned that all Java classes are "built" on top of that.

CMSC131. Inheritance. Object. When we talked about Object, I mentioned that all Java classes are built on top of that. CMSC131 Inheritance Object When we talked about Object, I mentioned that all Java classes are "built" on top of that. This came up when talking about the Java standard equals operator: boolean equals(object

More information

Lecture Outline. COOL operational semantics. Operational Semantics of Cool. Motivation. Notation. The rules. Evaluation Rules So Far.

Lecture Outline. COOL operational semantics. Operational Semantics of Cool. Motivation. Notation. The rules. Evaluation Rules So Far. Lecture Outline Operational Semantics of Cool COOL operational semantics Motivation Adapted from Lectures by Profs. Alex Aiken and George Necula (UCB) Notation The rules CS781(Prasad) L24CG 1 CS781(Prasad)

More information

Introduce C# as Object Oriented programming language. Explain, tokens,

Introduce C# as Object Oriented programming language. Explain, tokens, Module 2 98 Assignment 1 Introduce C# as Object Oriented programming language. Explain, tokens, lexicals and control flow constructs. 99 The C# Family Tree C Platform Independence C++ Object Orientation

More information

Method Resolution Approaches. Dynamic Dispatch

Method Resolution Approaches. Dynamic Dispatch Method Resolution Approaches Static - procedural languages (w/o fcn ptrs) Dynamically determined by data values C with function pointers Compile-time analysis can estimate possible callees Dynamically

More information

JAVA RMI. Remote Method Invocation

JAVA RMI. Remote Method Invocation 1 JAVA RMI Remote Method Invocation 2 Overview Java RMI is a mechanism that allows one to invoke a method on an object that exists in another address space. The other address space could be: On the same

More information

COMP 202 Java in one week

COMP 202 Java in one week COMP 202 Java in one week... Continued CONTENTS: Return to material from previous lecture At-home programming exercises Please Do Ask Questions It's perfectly normal not to understand everything Most of

More information

Lecture Outline. COOL operational semantics. Operational Semantics of Cool. Motivation. Lecture 13. Notation. The rules. Evaluation Rules So Far

Lecture Outline. COOL operational semantics. Operational Semantics of Cool. Motivation. Lecture 13. Notation. The rules. Evaluation Rules So Far Lecture Outline Operational Semantics of Cool Lecture 13 COOL operational semantics Motivation Notation The rules Prof. Aiken CS 143 Lecture 13 1 Prof. Aiken CS 143 Lecture 13 2 Motivation We must specify

More information

Objective Questions. BCA Part III Paper XIX (Java Programming) page 1 of 5

Objective Questions. BCA Part III Paper XIX (Java Programming) page 1 of 5 Objective Questions BCA Part III page 1 of 5 1. Java is purely object oriented and provides - a. Abstraction, inheritance b. Encapsulation, polymorphism c. Abstraction, polymorphism d. All of the above

More information

API Documentation for PHP Clients

API Documentation for PHP Clients Introducing the Gold Lasso API API Documentation for PHP Clients The eloop API provides programmatic access to your organization s information using a simple, powerful, and secure application programming

More information

C#: framework overview and in-the-small features

C#: framework overview and in-the-small features Chair of Software Engineering Carlo A. Furia, Marco Piccioni, Bertrand Meyer C#: framework overview and in-the-small features Chair of Software Engineering Carlo A. Furia, Marco Piccioni, Bertrand Meyer

More information

Excel4apps Reports Distribution Manager User Guide (SAP) 2013 Excel4apps

Excel4apps Reports Distribution Manager User Guide (SAP) 2013 Excel4apps Excel4apps Reports Distribution Manager User Guide (SAP) 2013 Excel4apps Table of Contents 1 System Requirements... 4 2 Installation and Overview... 4 2.1 Definitions... 4 2.1.1 Report Distribution Manager...

More information

Distributed Systems Recitation 2. Tamim Jabban

Distributed Systems Recitation 2. Tamim Jabban 15-440 Distributed Systems Recitation 2 Tamim Jabban Project 1 Involves creating a Distributed File System (DFS) Released yesterday When/If done with PS1, start reading the handout Today: Socket communication!

More information

Last Updated: 09 December 2016

Last Updated: 09 December 2016 Last Updated: 09 December 2016 System Fields : "Note" : "Imported" General Fields : value : "CustomerID" : value : "JOHNGOOD" Linked Entities

More information

Array. Prepared By - Rifat Shahriyar

Array. Prepared By - Rifat Shahriyar Java More Details Array 2 Arrays A group of variables containing values that all have the same type Arrays are fixed length entities In Java, arrays are objects, so they are considered reference types

More information

CS Internet programming Unit- I Part - A 1 Define Java. 2. What is a Class? 3. What is an Object? 4. What is an Instance?

CS Internet programming Unit- I Part - A 1 Define Java. 2. What is a Class? 3. What is an Object? 4. What is an Instance? CS6501 - Internet programming Unit- I Part - A 1 Define Java. Java is a programming language expressly designed for use in the distributed environment of the Internet. It was designed to have the "look

More information

CSCI 136 Written Exam #2 Fundamentals of Computer Science II Spring 2015

CSCI 136 Written Exam #2 Fundamentals of Computer Science II Spring 2015 CSCI 136 Written Exam #2 Fundamentals of Computer Science II Spring 2015 Name: This exam consists of 6 problems on the following 6 pages. You may use your double- sided hand- written 8 ½ x 11 note sheet

More information

Problems.Net. Обра. Анатолий Крыжановский

Problems.Net. Обра. Анатолий Крыжановский Problems.Net Обра Анатолий Крыжановский ООП 2 class Bar void Foo(object a) Console.WriteLine("object"); void Foo(object a, object b) Console.WriteLine("object, object"); void Foo(params object[] args)

More information

5.4. Events and notifications

5.4. Events and notifications 5.4. Events and notifications Distributed event-based systems extend local event model Allowing multiple objects at diff. locations to be notified of events taking place at an object Two characteristics:

More information

Java and C# in depth

Java and C# in depth Java and C# in depth ETH Zurich Date: 27 May 2013 Family name, first name:... Student number:.. I confirm with my signature, that I was able to take this exam under regular circumstances and that I have

More information

A Performance Tale. The evolution of binding in JavaFX. Robert Field Brian Goetz Sun Microsystems, Inc.

A Performance Tale. The evolution of binding in JavaFX. Robert Field Brian Goetz Sun Microsystems, Inc. A Performance Tale The evolution of binding in JavaFX Robert Field Brian Goetz Sun Microsystems, Inc. Overview This talk will chronicle our ongoing work on making JavaFX Script not only powerful and fun

More information

CS 106B Practice Final Exam #8 (15au) ANSWER KEY

CS 106B Practice Final Exam #8 (15au) ANSWER KEY 1. Linked Lists (write) CS 106B Practice Final Exam #8 (15au) ANSWER KEY // solution 1 void LinkedIntList::partitionSort() { if (!front) { return; // empty list case ListNode* current = front; while (current->next!=

More information

void fun() C::C() // ctor try try try : member( ) catch (const E& e) { catch (const E& e) { catch (const E& e) {

void fun() C::C() // ctor try try try : member( ) catch (const E& e) { catch (const E& e) { catch (const E& e) { TDDD38 APiC++ Exception Handling 134 Exception handling provides a way to transfer control and information from a point in the execution to an exception handler a handler can be invoked by a throw expression

More information

2. (True/False) All methods in an interface must be declared public.

2. (True/False) All methods in an interface must be declared public. Object and Classes 1. Create a class Rectangle that represents a rectangular region of the plane. A rectangle should be described using four integers: two represent the coordinates of the upper left corner

More information

newsletter PGCG EOM News and Views IPP printers (the 50,000 foot view) Issue 46, Winter 2018 Pretty Good Consulting Group

newsletter PGCG EOM News and Views IPP printers (the 50,000 foot view) Issue 46, Winter 2018 Pretty Good Consulting Group newsletter PGCG Pretty Good Consulting Group G o t a p r o b l e m? W e c r e a t e s o l u t i o n s. EOM News and Views IPP printers (the 50,000 foot view) IPP has been around for a long while. The concept

More information

EEE-425 Programming Languages (2013) 1

EEE-425 Programming Languages (2013) 1 2 Learn about class concepts How to create a class from which objects can be instantiated Learn about instance variables and methods How to declare objects How to organize your classes Learn about public

More information

Object typing and subtypes

Object typing and subtypes CS 242 2012 Object typing and subtypes Reading Chapter 10, section 10.2.3 Chapter 11, sections 11.3.2 and 11.7 Chapter 12, section 12.4 Chapter 13, section 13.3 Subtyping and Inheritance Interface The

More information

COMP322 - Introduction to C++

COMP322 - Introduction to C++ COMP322 - Introduction to C++ Winter 2011 Lecture 08 - Inheritance continued School of Computer Science McGill University March 8, 2011 Last Time Single Inheritance Polymorphism: Static Binding vs Dynamic

More information

Programming Kotlin. Familiarize yourself with all of Kotlin s features with this in-depth guide. Stephen Samuel Stefan Bocutiu BIRMINGHAM - MUMBAI

Programming Kotlin. Familiarize yourself with all of Kotlin s features with this in-depth guide. Stephen Samuel Stefan Bocutiu BIRMINGHAM - MUMBAI Programming Kotlin Familiarize yourself with all of Kotlin s features with this in-depth guide Stephen Samuel Stefan Bocutiu BIRMINGHAM - MUMBAI Programming Kotlin Copyright 2017 Packt Publishing First

More information

Equality in.net. Gregory Adam 07/12/2008. This article describes how equality works in.net

Equality in.net. Gregory Adam 07/12/2008. This article describes how equality works in.net Equality in.net Gregory Adam 07/12/2008 This article describes how equality works in.net Introduction How is equality implemented in.net? This is a summary of how it works. Object.Equals() Object.Equals()

More information

Understanding delegates

Understanding delegates Understanding delegates A delegate is a reference to a method. Declaring Delegates The syntax for declaring delegates looks like this: delegate void IntMethodInvoker(int x); delegate double TwoLongsOp(long

More information

Java and C# in Depth Carlo A. Furia, Marco Piccioni, Bertrand Meyer

Java and C# in Depth Carlo A. Furia, Marco Piccioni, Bertrand Meyer Java and C# in Depth Carlo A. Furia, Marco Piccioni, Bertrand Meyer Exercise Session Week 2 Agenda Ø Quizzes Ø More quizzes Ø And even more quizzes 2 Quiz 1. What will be printed? Ø Integers public class

More information

3/31/2016. Spreadsheets. Spreadsheets. Spreadsheets and Data Management. Unit 3. Can be used to automatically

3/31/2016. Spreadsheets. Spreadsheets. Spreadsheets and Data Management. Unit 3. Can be used to automatically MICROSOFT EXCEL and Data Management Unit 3 Thursday March 31, 2016 Allow users to perform simple and complex sorting Allow users to perform calculations quickly Organizes and presents figures that can

More information

GSU Alumni Portal. OPUS Open Portal to University Scholarship. Governors State University. Vemuri Vinusha Chowdary Governors State University

GSU Alumni Portal. OPUS Open Portal to University Scholarship. Governors State University. Vemuri Vinusha Chowdary Governors State University Governors State University OPUS Open Portal to University Scholarship All Capstone Projects Student Capstone Projects Fall 2015 GSU Alumni Portal Vemuri Vinusha Chowdary Governors State University Sairam

More information

Interview Questions of C++

Interview Questions of C++ Interview Questions of C++ Q-1 What is the full form of OOPS? Ans: Object Oriented Programming System. Q-2 What is a class? Ans: Class is a blue print which reflects the entities attributes and actions.

More information

Examination C++ Programming

Examination C++ Programming LUNDS TEKNISKA HÖGSKOLA 1(6) Institutionen för datavetenskap Examination C++ Programming 2016 03 19, 8.00 13.00 Aid at the exam: one C++ book. The copies of the lecture slides are not allowed. You must

More information

What s Conformance? Conformance. Conformance and Class Invariants Question: Conformance and Overriding

What s Conformance? Conformance. Conformance and Class Invariants Question: Conformance and Overriding Conformance Conformance and Class Invariants Same or Better Principle Access Conformance Contract Conformance Signature Conformance Co-, Contra- and No-Variance Overloading and Overriding Inheritance as

More information

Operational Semantics of Cool

Operational Semantics of Cool Operational Semantics of Cool Key Concepts semantics: the meaning of a program, what does program do? how the code is executed? operational semantics: high level code generation steps of calculating values

More information

class Polynomial { public: Polynomial(const string& N = "no name", const vector<int>& C = vector<int>());... };

class Polynomial { public: Polynomial(const string& N = no name, const vector<int>& C = vector<int>());... }; Default Arguments 1 When declaring a C++ function, you may optionally specify a default value for function parameters by listing initializations for them in the declaration: class Polynomial { public:

More information

SILVERPOP API - IMPORTLIST

SILVERPOP API - IMPORTLIST SILVERPOP API - IMPORTLIST June 11, 2015 OVERVIEW 1. Project Background This is an article in a series that can be found at: http://c-l-associates.com/home/silverpop. We are going to do our first real

More information

C# Programming in the.net Framework

C# Programming in the.net Framework 50150B - Version: 2.1 04 May 2018 C# Programming in the.net Framework C# Programming in the.net Framework 50150B - Version: 2.1 6 days Course Description: This six-day instructor-led course provides students

More information

! " # $ % $&' ( ) ( * ) " + "

!  # $ % $&' ( ) ( * )  + !" #$% $&'()(*) " +" / () + ))))' / $%.%0()%% 1%. ( $&'()(*) * + ! " # " (.2 "( (%( 3.. + / (.%%2 + $%. + ()(%%! ($%4)! -5$%4) $%4) / &%$%4) #)$% + "%$%! )$%4) ".2$%4) &*$%4) ($%4) / (*2 $ % ".234) ".*)

More information

The Why? s, Why on Earth? s and Why the Heck? s. Neal Gafter, Microsoft. (thanks to Mads Torgersen)

The Why? s, Why on Earth? s and Why the Heck? s. Neal Gafter, Microsoft. (thanks to Mads Torgersen) Statically Dynamic Typing The Why? s, Why on Earth? s and Why the Heck? s Neal Gafter, Microsoft (thanks to Mads Torgersen) Why? Interop with other object systems: Dynamic languages Iron-this, Iron-that

More information

Object-Oriented Principles and Practice / C++

Object-Oriented Principles and Practice / C++ Object-Oriented Principles and Practice / C++ Alice E. Fischer May 13, 2013 OOPP / C++ Lecture 7... 1/27 Construction and Destruction Allocation and Deallocation Move Semantics Template Classes Example:

More information

Java Class Design. Eugeny Berkunsky, Computer Science dept., National University of Shipbuilding

Java Class Design. Eugeny Berkunsky, Computer Science dept., National University of Shipbuilding Java Class Design Eugeny Berkunsky, Computer Science dept., National University of Shipbuilding eugeny.berkunsky@gmail.com http://www.berkut.mk.ua Objectives Implement encapsulation Implement inheritance

More information

Upcoming Features in C# Mads Torgersen, MSFT

Upcoming Features in C# Mads Torgersen, MSFT Upcoming Features in C# Mads Torgersen, MSFT This document describes language features currently planned for C# 6, the next version of C#. All of these are implemented and available in VS 2015 Preview.

More information

COMP 401 Spring 2013 Midterm 2

COMP 401 Spring 2013 Midterm 2 COMP 401 Spring 2013 Midterm 2 I have not received nor given any unauthorized assistance in completing this exam. Signature: Name: PID: Please be sure to put your PID at the top of each page. This page

More information

Highlighting Intrinsyc s Technologies: Intrinsyc J-Integra Bi-Directional Pure Java-COM Bridge

Highlighting Intrinsyc s Technologies: Intrinsyc J-Integra Bi-Directional Pure Java-COM Bridge WhitePaper Highlighting Intrinsyc s Technologies: Intrinsyc J-Integra Bi-Directional Pure Java-COM Bridge Intrinsyc Software, Inc. 700 West Pender Street, 10 th Floor Vancouver, British Columbia Canada

More information

15CS45 : OBJECT ORIENTED CONCEPTS

15CS45 : OBJECT ORIENTED CONCEPTS 15CS45 : OBJECT ORIENTED CONCEPTS QUESTION BANK: What do you know about Java? What are the supported platforms by Java Programming Language? List any five features of Java? Why is Java Architectural Neutral?

More information

Advanced Programming C# Lecture 13. dr inż. Małgorzata Janik

Advanced Programming C# Lecture 13. dr inż. Małgorzata Janik Advanced Programming C# Lecture 13 dr inż. Małgorzata Janik majanik@if.pw.edu.pl Winter Semester 2017/2018 Project C# 2017/2018, Lecture 13 3 / 24 Project part III Final Date: 22.01.2018 (next week!) Today

More information

STUDENT LESSON A5 Designing and Using Classes

STUDENT LESSON A5 Designing and Using Classes STUDENT LESSON A5 Designing and Using Classes 1 STUDENT LESSON A5 Designing and Using Classes INTRODUCTION: This lesson discusses how to design your own classes. This can be the most challenging part of

More information

JAVA BYTE IPC: PART 4-NON- BLOCKING-NIO-MANAGER. Instructor: Prasun Dewan (FB 150,

JAVA BYTE IPC: PART 4-NON- BLOCKING-NIO-MANAGER. Instructor: Prasun Dewan (FB 150, JAVA BYTE IPC: PART 4-NON- BLOCKING-NIO-MANAGER Instructor: Prasun Dewan (FB 150, dewan@unc.edu) MULTITHREADING ISSUES (LAST SLIDE FROM PREVIOUS PART) Thread that blocks on a select may not be the same

More information

Creating a Class Library You should have your favorite version of Visual Studio open. Richard Kidwell. CSE 4253 Programming in C# Worksheet #2

Creating a Class Library You should have your favorite version of Visual Studio open. Richard Kidwell. CSE 4253 Programming in C# Worksheet #2 Worksheet #2 Overview For this worksheet, we will create a class library and then use the resulting dynamic link library (DLL) in a console application. This worksheet is a start on your next programming

More information