# oop filosofie ## simula vs small talk https://upload.wikimedia.org/wikipedia/commons/2/25/Genealogical_tree_of_programming_languages.svg ## le 4 cose della oop - Astrazione - Incapsulamento - Ereditarita - Polimorfismo https://www.youtube.com/watch?v=Ly9dtWwqqwY&t=1s https://wiki.c2.com/?ObjectOrientedProgramming interfaces? ## polymorphism - parametric - ad hoc - subtyping - runtime / compile time - row/structural polymorphism https://www.uiua.org/ https://wiki.haskell.org/Polymorphism https://blog.knoldus.com/polymorphism-and-its-types-in-scala/ https://www.geeksforgeeks.org/ad-hoc-inclusion-parametric-coercion-polymorphisms/ ## encapsulation not work at fine grained level? https://www.youtube.com/watch?v=QM1iUe6IofM ## object as experts gli oggetti rappresentano cose umane, modellano la nostra realtà. l’approccio è empirico non matematico. - all models are wrong but some are useful https://wiki.c2.com/?AlanKaysDefinitionOfObjectOriented la perduta arte degli oggetti: https://www.youtube.com/watch?v=jO6Z3wOdfWc ## https://en.wikipedia.org/wiki/Composition_over_inheritance https://kotlinlang.org/docs/delegated-properties.html ## data and behaviours - accoppiamento e coesione Data is not the problem domain https://www.dataorienteddesign.com/dodmain/node3.html#SECTION00310000000000000000 https://gamesfromwithin.com/data-oriented-design data is not problem domain https://www.dataorienteddesign.com/dodmain/node3.html#SECTION00320000000000000000 ## liskov - quadrato rettangolo problem il tipo è accoppiato con lo stato paper sulla mutazione: https://aip.vse.cz/pdfs/aip/2016/01/03.pdf - all models are wrong but some are useful pinguino uccello canarino piccione asino cavallo pomodoro, sedile auto https://thevaluable.dev/guide-inheritance-oop/ le categorie sono basate sullo use case, cultura: https://www.youtube.com/watch?v=LNi0vy7GAaI oop è rotta ## expression problem The Expression Problem is a new name for an old problem. The goal is to define a datatype by cases, where one can add new cases to the datatype and new functions over the datatype, without recompiling existing code, and while retaining static type safety (e.g., no casts). https://arstechnica.com/science/2020/10/the-unreasonable-effectiveness-of-the-julia-programming-language/2/ https://www.tzcl.me/posts/expression-problem/ https://discourse.julialang.org/t/claim-false-julia-isnt-multiple-dispatch-but-overloading/42370/81?page=5 black boxes vs white boxes https://alexn.org/blog/2022/05/13/oop-vs-type-classes-part-1-ideology/ ## banana jungla … Because the problem with object-oriented languages is they’ve got all this implicit environment that they carry around with them. You wanted a banana but what you got was a gorilla holding the banana and the entire jungle. “ —Joe Armstrong, creator of Erlang progamming language I invented the term Object-Oriented, and I can tell you I did not have C++ in mind. alan key joe amstrong and alan kay video: https://www.youtube.com/watch?v=fhOHn9TClXY&pp=ygUZYWxhbiBrYXkgYW5kIGpvZSBhbXN0cm9uZw%3D%3D ![image](https://hackmd.io/_uploads/SyczUGiR6.png) ## cosa è un linguaggio? - languages are experiments - languages are community - languages are tools - languages are materials - languages are identity ![image](https://hackmd.io/_uploads/SyBc_MoAT.png) https://killalldefects.com/2020/12/27/how-programming-languages-change-how-you-think/ https://deprogrammaticaipsum.com/on-the-influence-of-programming-language-paradigms/ [PROGRAMMING IS A GOOD MEDIUM FOR EXPRESSING POORLY UNDERSTOOD AND SLOPPILY­FORMULATED IDEAS](https://web.media.mit.edu/~minsky/papers/Why%20programming%20is--.html) ## error handling ![image](https://hackmd.io/_uploads/SJ4PvfjAa.png) Make illegal states unrepresentable: https://fsharpforfunandprofit.com/posts/designing-with-types-making-illegal-states-unrepresentable/ ## design patterns vs languages features ![image](https://hackmd.io/_uploads/HJSne7jAT.png) - https://wiki.c2.com/?AreDesignPatternsMissingLanguageFeatures - https://refactoring.guru/design-patterns/criticism https://www.youtube.com/watch?v=srQt1NAHYC0 ## languages paradigms - rust - golang - julia - array language - ocaml ## paradigms? declarative & procedural procedural & functional object oriented & imperative object oriented & functional why oop is bad: https://www.youtube.com/watch?v=QM1iUe6IofM