the pain points of c#
DESCRIPTION
TRANSCRIPT
![Page 1: The Pain Points of C#](https://reader033.vdocuments.us/reader033/viewer/2022061302/54907a6ab47959fd158b48bc/html5/thumbnails/1.jpg)
Object Oriented Programming Pain Points
![Page 2: The Pain Points of C#](https://reader033.vdocuments.us/reader033/viewer/2022061302/54907a6ab47959fd158b48bc/html5/thumbnails/2.jpg)
General Architecture(Simplified)Database
Data Access (O/R)
Domain Model
Business Logics Service layer
User Interface Logics
User Interface Data Model
User Interface
Debug
![Page 3: The Pain Points of C#](https://reader033.vdocuments.us/reader033/viewer/2022061302/54907a6ab47959fd158b48bc/html5/thumbnails/3.jpg)
Needed Changes in Maintenance
New Business-need• Domain changes
Bug• Surprising side effects
![Page 4: The Pain Points of C#](https://reader033.vdocuments.us/reader033/viewer/2022061302/54907a6ab47959fd158b48bc/html5/thumbnails/4.jpg)
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
![Page 5: The Pain Points of C#](https://reader033.vdocuments.us/reader033/viewer/2022061302/54907a6ab47959fd158b48bc/html5/thumbnails/5.jpg)
Object
![Page 6: The Pain Points of C#](https://reader033.vdocuments.us/reader033/viewer/2022061302/54907a6ab47959fd158b48bc/html5/thumbnails/6.jpg)
vs. function-parameter
![Page 7: The Pain Points of C#](https://reader033.vdocuments.us/reader033/viewer/2022061302/54907a6ab47959fd158b48bc/html5/thumbnails/7.jpg)
“Generic/common” objects
Base class cause problems
Leads to reflection• Runtime exceptions to the user• Performance hit
![Page 8: The Pain Points of C#](https://reader033.vdocuments.us/reader033/viewer/2022061302/54907a6ab47959fd158b48bc/html5/thumbnails/8.jpg)
The pain points of C#
![Page 9: The Pain Points of C#](https://reader033.vdocuments.us/reader033/viewer/2022061302/54907a6ab47959fd158b48bc/html5/thumbnails/9.jpg)
Immutable propertypublic class MyObject{ private readonly string myproperty; public string MyProperty { get{ return myproperty; } } public MyObject(string prop) { myproperty = prop; }} 19 words + 10 brackets!
![Page 10: The Pain Points of C#](https://reader033.vdocuments.us/reader033/viewer/2022061302/54907a6ab47959fd158b48bc/html5/thumbnails/10.jpg)
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));
![Page 11: The Pain Points of C#](https://reader033.vdocuments.us/reader033/viewer/2022061302/54907a6ab47959fd158b48bc/html5/thumbnails/11.jpg)
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!
![Page 12: The Pain Points of C#](https://reader033.vdocuments.us/reader033/viewer/2022061302/54907a6ab47959fd158b48bc/html5/thumbnails/12.jpg)
Generics Parameter Constructor
![Page 13: The Pain Points of C#](https://reader033.vdocuments.us/reader033/viewer/2022061302/54907a6ab47959fd158b48bc/html5/thumbnails/13.jpg)
void is not a type
Func and Action are separate classes
![Page 14: The Pain Points of C#](https://reader033.vdocuments.us/reader033/viewer/2022061302/54907a6ab47959fd158b48bc/html5/thumbnails/14.jpg)
There is no “either-or”-type
Not without interface• Switch takes const parameter?
Leads to Reflection or casting• Performance• Runtime exceptions