Inheritance

Difference between Inheritance and Subtyping We say that a subclass is inheritance and subtyping. We have studied subtyping in Typing and Subtyping and it entails mainly two things: Liskov Substitution Polymorphism of the types While inheritance is just the code reuse and specialization. Another example of code reuse can be the “has-a” relation composition, which couples two objects together. With aggregations, we can also see delegation calls, when you have a class, and call a method of that class. ...

October 9, 2025 · Reading Time: 10 minutes ·  By Xuanqiang Angelo Huang

Typing and Subtyping

We first start with some design goals for the language Language Design Principles Simplicity Syntax and semantics can easily be understood by users and implementers of the language Expressiveness: Language can (easily) express complex processes and structures, conflicting with simplicity. Safety: Language discourages errors and allows errors to be discovered and reported, ideally at compile time Modularity: Language allows modules to be type-checked and compiled separately Performance: Programs written in the language can be executed efficiently Productivity: Language leads to low costs of writing programs like Python. Backwards Compatibility: Newer language versions work and interface with programs in older versions (dependency injection for examples helps for this.) ...

September 25, 2025 · Reading Time: 11 minutes ·  By Xuanqiang Angelo Huang

Bayesian Optimization

While Active Learning looks for the most informative points to recover a true underlying function, Bayesian Optimization is just interested to find the maximum of that function. In Bayesian Optimization, we ask for the best way to find sequentially a set of points $x_{1}, \dots, x_{n}$ to find $\max_{x \in \mathcal{X}} f(x)$ for a certain unknown function $f$. This is what the whole thing is about. Definitions First we will introduce some useful definitions in this context. These were also somewhat introduced in N-Bandit Problem, which is one of the classical optimization problems we can find in the literature. ...

January 18, 2025 · Reading Time: 8 minutes ·  By Xuanqiang Angelo Huang

Datacenter Hardware

We want to optimize the parts of the datacenter hardware such that the cost of operating the datacenter as a whole would be lower, we need to think about it as a whole. Datacenter CPUs Desktop CPU vs Cloud CPU Isolation: Desktop CPUs have low isolation, they are used by a single user. Cloud CPUs have high isolation, they are shared among different users. Workload and performance: usually high workloads and moving a lot of data around. They have a spectrum of low and high end cores, so that if you have high parallelism you can use lower cores, while for resource intensive tasks, its better to have high end cores, especially for latency critical tasks. ...

June 4, 2025 · Reading Time: 19 minutes ·  By Xuanqiang Angelo Huang

Systems for Artificial Intelligence

At the time of writing, the compute requirements for machine learning models and artificial intelligence are growing at a staggering rate of 200% every 3.5 months. Interest in the area is being quantified as 10k papers per month on the topic, while dollar investments on compute (energy, cooling, sustainability of compute in general) have had a hard time keeping up with the continuous new requests. Image from here ...

June 4, 2025 · Reading Time: 12 minutes ·  By Xuanqiang Angelo Huang

Architecture of the Brain

First, the brain is organized into functionally specific areas, and second, neurons in different parts of the vertebrate nervous system, indeed in all nervous systems, are quite similar. Small comparison with Computers A gross observation between computer’s transistors and human neurons is that there a big difference of numbers: trillions of transistors vs billions of neurons. 6 orders of magnitude frequency difference (Ghz versus 1kHz for neurons). Many many neural types and different types of connections. And the digital vs analog and chemical modes of communication. Parallel processor abilities. Fixed vs plastic architectures But this is comparing with transistors with one higher level object, so this comparison might not be completely fair. They are very different from this point of view. And only some brain areas are similar to real neural networks. ...

August 26, 2025 · Reading Time: 19 minutes ·  By Xuanqiang Angelo Huang

Classi OOP

Introduzione a OOP Per la definizione di classe andare a guardare Object Orientation, però lo ripeto in questa occasione, è solamente un modello su cui andare a costruire degli oggetti. Capisaldi Incapsulazione (con interfaccia, base per la documentazione) Astrazione Ereditarietà Dispatch dinamico Inheritance to avoid code duplication Subtyping to express classification Overriding to specialize methods Dynamic binding to adapt reused algorithms Costruttori Il costruttore è un codice utilizzato per inizializzare correttamente lo stato interno. Le regole sono le stesse dei metodi sovraccaricati (dinamica per la chiamata, statica per il numero dei parametri che prende in input). ...

September 26, 2025 · Reading Time: 6 minutes ·  By Xuanqiang Angelo Huang

Object Orientation

Il Tipo di Dato Astratto Introduzione Per questi tipi di dato non ci interessa di sapere cosa ci sia sotto (storato come bit? storato come sabbia boh), ci interessa solamente che abbia quei metodi, che possiamo in un certo senso identificare come la sua capsula, opaca in questo caso. Quando si può andare a modificare solamente attraverso questo metodo potrei dire che sia safe collegato alla Algebra dei tipi, nel senso che vengono soddisfatte sempre le proprietà del tipo. ...

August 28, 2024 · Reading Time: 5 minutes ·  By Xuanqiang Angelo Huang

Polimorfismo

Introduzione Monoforfo Quando non posso utilizzare un tipo come parametro. Ossia non possiamo definire una funzione generica. Polimorfismo Polimorfismo, come dice il nome, significa avere tante forme, in questo caso tanti tipi. Ma avere tanti tipi non è una cosa ambigua? Questa cosa si risolve solitamente a compile time (facendo checks di sottotipo, oppure dispatch della funzione corretta). A program part is polymorphic if it can be used for objects of several classes ...

August 28, 2024 · Reading Time: 7 minutes ·  By Xuanqiang Angelo Huang

Teoria dei Tipi

Introduzione alla Teoria dei Tipi History of Languages Research The root of languages research are in: in logic and computations (even before computers!). Artificial intelligence (Lisp, constrained solvers, the original logical AI we studied in (Russell & Norvig 2009)). Algebra and symbolic reasoning. Definizione di Tipo Un metodo sintattico praticabile per dimostrare l’assenza di determinati comportamenti del programma, fatto classificando le unità sintattiche in base ai tipi di valore che assumono ...

September 28, 2025 · Reading Time: 14 minutes ·  By Xuanqiang Angelo Huang