Tiantian Ma
@matianti.bsky.social
5 followers 7 following 15 posts
Posts Media Videos Starter Packs
matianti.bsky.social
Reactivity in Observable notebooks is kind of similar to Makefiles: cell values update based on dependencies, but more automatic. You see visualized results immediately, but also the wrong ones. Forces you to write clean code, or crash visibly.
#ProgrammingParadigms @northeasternu.bsky.social
matianti.bsky.social
The classic Rails demo shows how it uses templates to auto-generate controller, model, and view files - setting up MVC instantly. The framework feels declarative. With little code, one can build a lot of functionality. It still feels like magic today. #ProgrammingParadigms @northeasternu.bsky.social
matianti.bsky.social
HTTP vs WebSocket is like texting vs calling. HTTP sends messages and waits at a time, while WebSocket enables real-time bi-directional talks. But WebSocket first connects via HTTP that upgrades to WebSocket, like texting "Let's talk" before a call. #ProgrammingParadigms @northeasternu.bsky.social
matianti.bsky.social
One challenge in programming is the risk of regressing existing bugs when developing new features. With TDD, the existing test suite serves as a safety net, helping catch regressions early and reducing the risk of last-minute surprises in testing! #ProgrammingParadigms @northeasternu.bsky.social
matianti.bsky.social
Jest is a testing tool that works across many JavaScript environments, but it’s not a panacea. When using it with ESLint, don’t forget to import Jest’s global helpers or configure the ESLint environment ahead. A small setup makes all the difference! #ProgrammingParadigms @northeasternu.bsky.social
matianti.bsky.social
The communication of shared workers in JavaScript is like a transport layer protocol in networking: it uses ports (MessagePort) to enable messaging between the main script and the worker with multiple connected scripts (like different processes). #ProgrammingParadigms @northeasternu.bsky.social
matianti.bsky.social
JavaScript: Promises are great for avoiding callback hell and support chaining, but .then() always hands me another Promise. await, on the other hand, feels more like synchronous code and lets me access the actual data directly. Prefer it now! #ProgrammingParadigms @northeasternu.bsky.social
matianti.bsky.social
Asynchronous programming in JavaScript is like multi-threaded programming in C - but without threads 🤔. With ’Promise‘ implementation, 'then' brings success, and 'catch' handles failure. Straightaway! #ProgrammingParadigms @northeasternu.bsky.social
matianti.bsky.social
To achieve purity, functional programming use more memory and sacrifice some performance. In return? More deterministic results. Compared to OOP, which excels in modularization, I think functional programming's strength lies in making debugging easier #ProgrammingParadigms @northeasternu.bsky.social
matianti.bsky.social
/**
* What I learned about JSDoc (with JSDoc documention)
* @param {string} msg - a note from me
* @return {void}
*/
function learn(msg) {
console.log(`I learn: ${msg}`);
}
learn("Using JSDoc makes JavaScript feel a bit more strongly typed"); #ProgrammingParadigms @northeasternu.bsky.social
matianti.bsky.social
Does a UML diagram help with refactoring? Not really. Refactoring requires examining the code to reduce redundancy. But does refactoring result in a better UML diagram? Yes! A good refactor leads to a clearer UML with more fields in the abstract class #ProgrammingParadigms @northeasternu.bsky.social
matianti.bsky.social
Building a 3D scene in browser with Three.js is like an ad shoot:
1. Set the stage with a Scene and place the objects
2. Pick a wonderful angle with a Camera
3. Finally, produce the picture with a Renderer
Declarative, and see it instantly with Vite!
#ProgrammingParadigms @northeasternu.bsky.social
matianti.bsky.social
JavaScript handles OOP inheritance with prototype chain, which is conceptually like a linked list. Using a property? It’s like asking each person in a line from the beginning, 'Hi, are you X?🙋' until you find one, or hit the end of the line.
#ProgrammingParadigms @northeasternu.bsky.social