US Gov breaking apart Facebook?
We talk about Data Models. Also, the US Government is expected to sue Facebook for antitrust violations. They allege that Facebook broke antitrust law by acquiring WhatsApp and Instagram.
Hi Everyone!
Hope you’re all having a fantastic day!
Tech Dive
No tech dive for today! Our last tech dive was on Database Sharding!
Snippets
MIT course on trends in Fintech. Covers areas like Open Banking APIs, AI in finance, challenger banks, and cryptocurrencies. -> here.
Awesome blog post on designing 2D graphics in the Japanese gaming industry. A must-read if you’re into computer-generated graphics. -> here.
Interview with a Senior Software Engineer at Microsoft on how Microsoft does Automated Testing. -> here.
Industry News
US Government will file antitrust lawsuits against Facebook on Wednesday
The U.S. Government is preparing to file antitrust lawsuits against Facebook, alleging that the tech giant engaged in unlawful, anticompetitive tactics to buy or kill off its rivals and solidify its dominance in social networking.
The lawsuits revolve around Instagram and WhatsApp. The attorneys general will ask a judge to force Facebook to sell off some of the business to address competition concerns.
State officials are also expected to petition a judge to require Facebook to inform them before proceeding with any significant future transactions.
If you’re interested in learning more about antitrust politics around Big Tech, the best analysis is usually from Ben Thompson of Stratechery. You can check out his pieces on antitrust here.
Apple shifts leadership of Self-Driving Car Unit to AI Chief
Project Titan is Apple’s self-driving car unit, consisting of hundreds of engineers. It was started in 2014 when Apple wanted to take on Tesla and other manufacturers but was pared back in 2016. The project was struggling with direction, leadership, and technical challenges at the time.
Apple has tested its technology on public roads across the San Francisco Bay Area since 2017. Last year, Apple’s vehicles drove an average of 118 miles before disengagements by the human safety driver. The company has 66 cars in its fleet.
Leadership of Project Titan has now been shifted to John Giannandrea. Giannandrea joined Apple in 2018 as the vice president of AI Strategy and Machine Learning. Prior to that, he ran Google’s machine learning and search teams. In addition to Project Titan, Giannandrea is in charge of Siri and machine learning tech across Apple’s products.
Interview Question
Given two strings word1 and word2, return the minimum number of operations required to convert word1 to word2.
You have the following three operations permitted on a word:
Insert a character
Delete a character
Replace a character
We’ll send a detailed solution tomorrow, so make sure you move our emails to primary, so you don’t miss them!
Gmail users—move us to your primary inbox
On your phone? Hit the 3 dots at the top right corner, click "Move to" then "Primary"
On desktop? Back out of this email then drag and drop this email into the "Primary" tab near the top left of your screen
Apple mail users—tap on our email address at the top of this email (next to "From:" on mobile) and click “Add to VIPs”
Previous Solution
As a refresher, here’s the previous question
What are Data Models in Software Engineering?
What is the Relational Model and what is the Document Model?
What are some of the tradeoffs and benefits when comparing the models?
Solution
What are Data Models?
Data Models are one of the most important parts of software engineering. They form the core on how you think about the problem being solved.
A data model is an abstract model that organizes elements of your data and standardizes how they relate to each other. The best-known data model is the relational model, which forms the basis of SQL. With the relational model, your data is organized into relations (SQL tables) and each relation is a collection of unordered tuples (rows).
Applications can be thought of as layering one data model on top of another. For each layer, you’re thinking about how is your data model represented in the next lower layer? Here’s an example from Designing Data-Intensive Applications.
As an application developer, you look at the real world and create a data model in terms of objects or data structures, and APIs which manipulate those data structures. The data models are specific to your application.
When you store those data models, you express them in the form of a general-purpose data model, like JSON documents, tables in a relational database, or a graph model.
The engineers who built your database software decide on a way of representing the JSON/relational/graph data in terms of bytes in memory or on disk.
Hardware engineers have figured out a data model of representing bytes in terms of electrical currents, pulses of lights, magnetic fields, and more.
There are many different data models and they all make tradeoffs based on assumptions around how they’re going to be used.
Relational Model vs. Document Model
As we mentioned earlier, the best-known data model is the relational model. Your data is organized into relations, where each relation is an unordered collection of tuples.
The relational model was first proposed in the 1970s, and there were many doubts over whether it could be implemented efficiently. That changed by the mid-1980s, with relational database management systems (RDBMS) and SQL.
Relational databases generalize very well and the majority of the data on the internet is represented using a relational data model.
However, in the 2010s, another data model emerged as a competitor. NoSQL is the main term used to refer to these competitors, although they can also be thought of as non-relational databases. The driving forces behind the adoption of NoSQL are
Specialized query operations that are not well supported by the relational model
Frustration with the restrictiveness of relational schemas
A need for greater scalability than relational databases can easily achieve
Application development today is mostly done with object-oriented programming languages, which leads to an obvious criticism of the SQL data model: if data is stored in relational tables, then there’s an awkward translation layer between objects in application code and tables and rows in the relational model.
This has led to the document model, which has been adopted by NoSQL databases like MongoDB, RethinkDB, CouchDB, and others.
However, one issue with the document model is how to represent many-to-many relationships. Many to many relationships are an example of a relationship between two entities where they both might have many relationships between each other. An example is a Book that was written by many Authors. At the same time, an Author may have written many Books. Modeling many-to-many relationships in document databases is difficult without duplicating data or performing complex joins.