November 2019
Beginner
804 pages
20h 1m
English
Now, start with the base skeleton of the controller implementation:
class TodoIt implements TodoListController {
private readonly _todoList: TodoList = new TodoList();
constructor(private _todoListView: TodoListView) {
console.log("TodoIt");
if(!_todoListView) {
throw new Error("The todo list view implementation is required to properly initialize TodoIt!");
}
}
addTodo(): void {
// TODO
}
filterTodoList(): void {
// TODO
}
removeTodo(identifier: string): void {
// TODO
} }
As you can see earlier, our controller implementation requires TodoListView to be provided, but it does not care about which specific implementation. This is how you usually want to work with interfaces: by programming against them ...
Read now
Unlock full access