the pain points of c#

Post on 17-Dec-2014

1.013 Views

Category:

Entertainment & Humor

1 Downloads

Preview:

Click to see full reader

DESCRIPTION

 

TRANSCRIPT

Object Oriented Programming Pain Points

General Architecture(Simplified)Database

Data Access (O/R)

Domain Model

Business Logics Service layer

User Interface Logics

User Interface Data Model

User Interface

Debug

Needed Changes in Maintenance

New Business-need• Domain changes

Bug• Surprising side effects

The shape of objects have to be specified before the functionality

Natural?• “I and the bird, in the field, run and fly away”• “I run in the field and the bird fly away”

Mandatory “bottom-up” design

Object

vs. function-parameter

“Generic/common” objects

Base class cause problems

Leads to reflection• Runtime exceptions to the user• Performance hit

The pain points of C#

Immutable propertypublic class MyObject{    private readonly string myproperty;    public string MyProperty {         get{            return myproperty;        }    }    public MyObject(string prop)    {        myproperty = prop;    }} 19 words + 10 brackets!

Type Definitionsvar list = new List<List<int>>{                new List<int>{1,2,3},                new List<int>{4,5,6},};

Ok!Noise!

Func<Func<int, List<int>, string>, Func<int, List<int>>, int, string> S = (x, y, z)=> x(z, y(z)); 

F# Syntaxtype MyObject(prop:string) =     member x.MyProperty = prop

7 words + 2 brackets!

let list = [[1;2;3];[4;5;6]]

let S x y z = x z (y z) Ok!

Generics Parameter Constructor

void is not a type

Func and Action are separate classes

There is no “either-or”-type

Not without interface• Switch takes const parameter?

Leads to Reflection or casting• Performance• Runtime exceptions

top related