/
Comparing and Contrasting C#, Scheme, and Comparing and Contrasting C#, Scheme, and

Comparing and Contrasting C#, Scheme, and - PowerPoint Presentation

karlyn-bohler
karlyn-bohler . @karlyn-bohler
Follow
405 views
Uploaded On 2015-11-14

Comparing and Contrasting C#, Scheme, and - PPT Presentation

TSQL Joseph P Mohr C Overview Scheme Overview TSQL Overview Language Comparisons Conclusions Outline ObjectOriented Language TypeSafe Evolved from C Main application is serverside scripting in the NET Framework ID: 193032

scheme sql language data sql scheme data language system type languages types common cell programs pros query object overview

Share:

Link:

Embed:

Download Presentation from below link

Download Presentation The PPT/PDF document "Comparing and Contrasting C#, Scheme, an..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Slide1

Comparing and Contrasting C#, Scheme, and T-SQL

Joseph P. MohrSlide2

C# Overview

Scheme Overview

T-SQL OverviewLanguage ComparisonsConclusions

OutlineSlide3

Object-Oriented LanguageType-SafeEvolved from C

Main application is server-side scripting in the .NET Framework

Developed in 2001Current version is 4.0C# OverviewSlide4

C# is designed for component-oriented programmingSoftware ComponentsIncreasingly used in modern software design

Self-contained and self-describing

Have their own documentationC# AdvantagesSlide5

VersioningAllows the language to evolve without breaking programs in older versions.

Supports

virtual and override modifiers. Method overloading that supports versioning.Explicit interface member declarations.

C# AdvantagesSlide6

Virtual and Override

If a method is declared

virtual, then the implementation evokes is determined at run-time.Non-Virtual methods have the implementation determined at compile-time.The override modifier can be used to provide another implementation for an existing virtual method.

C# AdvantagesSlide7

C# programs are comprised of the following:ProgramsNamespaces

Types

MembersAssembliesC# Program StructureSlide8

Consist of one or more source filesSource files contain the other structural elements of the program

C# ProgramsSlide9

Declared at the top of the source file with the using directiveAvoid having to use the fully qualified names in the source code.

C# NamespacesSlide10

Most common types:ClassesInterfaces

Can contain members and namespaces

Either reference or valueWith reference type, two variables can affect the same object.C# TypesSlide11

Most common members:FieldsMethods

Properties

EventsC# MembersSlide12

Made up of Intermediate Language (IL) and metadataUse Just-In-Time (JIT) compilingImplement applications or libraries and have the .exe or .

dll

file extension respectivelyC# AssembliesSlide13

Using System;Class Hello

{

Static void Main() {Console.Out.WriteLine(“Hello, World”);}}

C# Hello World ProgramSlide14

C# uses two different grammars, the Lexical grammar and the syntactic grammar.Lexical grammar defines line terminators, white space, comments, tokens, and preprocessing directives.

Syntactic grammar defines how the tokens from the lexical grammar are combined into programs.

C# GrammarsSlide15

Compiled language results in fast execution.High performance is a result of being derived from the C family.

Boxing and Unboxing operations are the most common detriments to performance.

Can be avoided by declaring as ObjectC# PerformanceSlide16

Pros:Clearly defined data typesFamiliar, well designed syntax

Cons:

Feature multiplicityOperator OverloadingC# Readability Slide17

Pros:Excellent support for abstractionStrong expressivity with control sections

Cons:

Large number of different contstructsC# WritabilitySlide18

Classes derived from the base Object Class, which includes implementation of the primitives, can be simply combined to create very robust and diverse data structures.

C#

OrthogonalitySlide19

Type-Checking:C# is considered a type-safe language and the compiler can catch type errors in almost all cases.

There are pointers supported by the language which can prevent the compiler from catching type-errors.

Exception Handling:Highly functional and similar to JavaC# Reliability ProsSlide20

Aliasing:Reference types can be referring to the same memory location and is considered a detriment to reliability.

C# Reliability ConsSlide21

The modular design considerations of C# makes the code highly portable.Self-contained documentation in all the modules makes for easier portability amongst different software developers.

C# PortabilitySlide22

MS Visual C#MS Visual Studio

C# Tools and CompilersSlide23

using System;using

System.Collections.Generic

;using System.Linq;using System.Web;using

System.Web.UI

;

using

System.Web.UI.WebControls

;

namespace WebApplication2

{

public partial class _Default :

System.Web.UI.Page

{

protected void

Page_Load

(object sender,

EventArgs

e)

{

}

protected void Calendar1_DayRender(object sender,

DayRenderEventArgs

e)

{

EventDataContext

edc

= new

EventDataContext

();

var

query = from

ev

in

edc.Events

where

ev.Date

==

e.Day.Date

select

ev

;

C# Personal ExampleSlide24

e.Cell.VerticalAlign

=

VerticalAlign.Top; e.Cell.BorderColor = System.Drawing.Color.Teal; e.Cell.BorderWidth

= 1;

e.Cell.BorderStyle

=

BorderStyle.Solid

;

foreach (var ev in query)

{

HyperLink

link = new

HyperLink

();

link.ForeColor

=

System.Drawing.Color.Teal

;

link.NavigateUrl

= "~/

EventInfo.aspx?event

=" +

ev.EventNo

;

link.Text

=

ev.Name

;

Button but = new Button();

e.Cell.Controls.Add

(new

LiteralControl

("<p>"));

e.Cell.Controls.Add

(link);

e.Cell.Controls.Add

(new LiteralControl("</p>")); } }

}

}

C# Personal Example Contd.Slide25

www.myjaxcalendar.com

C# DemoSlide26

Functional programming languageEvolved from LISPCreated in 1975 at MIT by Guy L. Steele and Gerald J.

Sussman

Originally called Schemer to mimic the naming convention used by other languages evolved from LISP, such as ConniverConsiderably more minimalist than Common Lisp, but supports tools for language extension.

Scheme OverviewSlide27

Most commonly used for lambda calculus and as an educational tool by introductory level computer science classes.Lambda calculus is a logical system of computation through the use of binding and substitution.

Scheme ApplicationsSlide28

Scheme programs are interpreted.Program Elements:K

eywords

VariablesStructured forms Constant data (numbers, characters, strings, quoted vectors, quoted lists, quoted symbols, etc.)W

hitespace

C

omments

Program expressions are known as s-expressions

Scheme ProgramsSlide29

S-expressions are made up of structured forms and lists.S-expressions are delineated by matching sets of opening and closing parentheses.

Scheme SyntaxSlide30

List-processing primitives:car – the first element in a list

cdr

– all the other elements in the listcons – constructs listsFirst-class functions (functions can be assigned to variables)Scheme Primitives and VariablesSlide31

Only the inner-most binding of a variable is visible in an expression.Inner bindings are said to “shadow” the outer bindings.

This type of scoping is known as “lexical scoping”.

Scheme Variable ScopingSlide32

Expression:(cdr

(car ‘((1 2 3) 4 5)))

Result:(2 3)Scheme Example ExpressionSlide33

Scheme executes faster and more efficiently than Common LISP as a result of its minimalist design.

Scheme PerformanceSlide34

Pros:Overall Simplicity of the language, including a lack of feature multiplicity, improves the readability of the language.

Identifiers are not restricted in length.

Cons:The dynamic variable types which aren’t explicitly declared to be of a certain data type.Scheme ReadabilitySlide35

Pros:The overall simplicity of the language, especially over that of Common LISP

Cons:

Weak support for abstractionLacking expressivityScheme WritabilitySlide36

Simply supports the most commonly used data structures including Strings and Enums.

Lacking in the ability to combine primitives in to complex data structures.

Scheme OrthogonalitySlide37

Pros:Lack of aliasingPerforms run-time type checking

Cons:

Does not have a good system for exception handling.Scheme ReliabilitySlide38

Scheme programs are highly portable between the same version of Scheme.The very high number of versions of Scheme in use is major stumbling block to the portability of Scheme.

Scheme PortabilitySlide39

Some of the many flavors of scheme are:SISC – runs off of the JVM

DrRacket

– Student friendly interfaceMIT Scheme – very widely usedScheme FlavorsSlide40

Scheme DemoSlide41

Query LanguageUses statements that are interpreted by the database server.Used with relational databases

Relational databases are based off of first order predicate logic.

Used by MS SQL Server database and Sybase database.Main application is the construction and manipulation of enterprise databases.T-SQL OverviewSlide42

History:Evolved from SEQUEL.SEQUEL (Structured English Query Language) is a query language developed by IBM in the 1970’s and they later renamed it to SQL (Structured Query Language)

T-SQL (Transact SQL) is an extension to SQL developed by a partnership between Microsoft and Sybase.

T-SQL OverviewSlide43

Data in relational databases are comprised of entity typesEntity Types are collections of the of the entities and thought type and are represented as TABLES.

Each instance of that entity is a

record or tuple and is represented as a row in the table.Records are comprised of different attributes, and they are represented as columns in the table.

T-SQL OverviewSlide44

T-SQL is technically a data-sublanguageThe T-SQL sublanguage is comprised of the following:

Data Definition Language (DDL)

Data Manipulation Language (DML)T-SQL OverviewSlide45

The DML is used to define database structure, integrity rules, and user privileges.Includes the following commands:

CREATE TABLE, DROP TABLE, ALTER TABLE

CREATE VIEW, DROP VIEWCREATE INDEX, DROP INDEXT-SQL DMLSlide46

The DML is used to manipulate the data within the database.DML Commands Include:

SELECT

INSERTUPDATEDELETET-SQL DMLSlide47

T-SQL extends SQL to include:Procedural ProgrammingLocal Variables

Support functions for processing various data types

The extensions included in T-SQL grant it equivalent capabilities to other programming languages.T-SQL ExtensionsSlide48

Flow control in T-SQL:BeginEnd

Break

ContinueGOTOIFELSERETURNWHILEWAITFOR

T-SQL ExtensionsSlide49

T-SQL contains try-catch blocks, unlike SQLExample:

BEGIN TRY

//STATEMENTSEND TRYBEGIN CATCH//STATEMENTS TO HANDLE EXCEPTIONEND CATCH

T-SQL Exception HandlingSlide50

T-SQL DemoSlide51

T-SQL performs queries and data manipulation very efficiently across a wide variety of data types.

T-SQL EfficiencySlide52

Readability:High overall simplicity. Lack of multiplicity and overloading.

Excellent facilities for defining data types

Form indicates meaningWritability:More expressive than SQLPoor Abstraction

T-SQL SimplicitySlide53

T-SQL supports a wide variety of primitive data typesThe primitive data types can be easily combined in tables to easily create new data structures.

T-SQL

OrthogonalitySlide54

Type-Checking:Data must be of the appropriate type for a statement to execute.

Exception-Handling:

T-SQL provides for exception handling, unlike SQL.T-SQL ReliabilitySlide55

Modularity and portability are a common and touted attribute amongst the languages, but C# achieves this goal to a greater extent than the others.C# does not support shadowing like Scheme does.

All three languages are supported cross-platform.

Language ComparisonsSlide56

I drew the following conclusions my research in to these three languages:Studying different types of languages increased my ability to select an appropriate language for a given task.

As I learned more languages, I was able to pick up new languages faster.

Due to the similarities between the languages, studying C# improved my knowledge of Java.Many projects are best implemented through the use of multiple languages.

Concluding Remarks