# Draft 1 - Entry/Mid Level (2h)
## Presentation (10min)
- Thank you for your time!
- We present ourselves and our roles/projects and tecnologies we work with
- Candidate presents himself.
## Warm up (10min)
1. What programming languages are you comfortable working with? / What is your favourite language and why?
2. What are you working on now? (Side project?)
3. What language and tools will you use to develop a project from scratch? Tell me about some project you have worked on. How did you select the tools and technologies involved?
4. What would you say was your best implementation experience till date?
5. How do you keep up-to-date on new technologies and trends in this industry and career?
## Tech questions (1h30)
### REST API and FE (00h20)
1. Imagine that we want to build a REST API, and we want to Create, Read, Update and Delete invoices.
- What do you do?
- Endpoints? Methods? Error Codes?
- How do you document the API?
2. How do you handle if you have millions of invoices (pagination and how to implement it)?
3. Imagine that we want to build an application (FRONTEND) to consume the API already done. How do you do it?
- Explorar ferramentas e tooling
4. Now that we have this frontend to manage invoices, how would you deploy it to production?
- Minify? - if not answered here, it will probably be brought back in question 5
- Bundler?
- CDN?
5. Imagine that customers complain that the frontend application is slow and takes a considerable amount of time to load. How would you reduce load time of this web application? (optional)
- Minimize HTTP requests
- When visiting a new web page, most of the page-loading time is spent downloading components of that page (e.g. images, stylesheets, and scripts). By minimizing the number of requests a web page needs to make, it will load faster.To reduce HTTP requests for images, one thing you can do is to use CSS sprites to combine multiple images. If you have multiple stylesheets and JavaScript libraries, consider combining them to reduce the number of HTTP requests.
- Optimizing images
- Reducing Redirects
- Enabling browser cache
- Minifying code (already answer in 4)
- References for stylesheet at the top (head)
- Script references at the bottom
- Use JavaScript and CSS in External Files
- Other examples not related to FE (loadbalancer?, db? Server Side Cache?)
6. How do you ensure that everything is working properly in your web application? (API and FE)
- Manual tests? (Please don't answer only this one)
- Unit tests?
- Integration Tests?
- Snapshot tests?
- E2E? Postman
7. How do you deal with multiple accounts? (an account only can access the invoice created by itself)
- Autorização? (BASIC AUTH, OAUTH, ....)
- HEADERS? Query parameters?
8. Explain CORS? (optional)
- https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
### Databases (00h20)
1. What DBMS could you use to store the information relative to invoices?
- SQL vs NoSQL? When do you considered one or the other?
- Tables (invoices, invoice-items, users, products, etc?)... and Views
2. Imagine that the invoices table is storing information of a lot of customers and it's growing fast. How would you make it efficient to quickly retrieve all the invoices of one given customer?
- Use of indexes
3. Imagine that you are creating a new invoice with some invoice-items. How do you ensure that the entire invoice is atomically registered in the database, if the price of the products are always changing?
- Transactions :D
- What are the two phases committed in the database? Explain
4. Even with indexes, your application is growing fast and one database is not enough to handle all requests (Optional)
5. What is database replication? (Optional)
6. Do you know what is the CAP theorem? (Optional)
### Architectural (00h20)
1. Imagine that now we need to create some statistics about the invoices.
- Should this new service be implemented in the already existing service that manages invoices?
- Monolith vs Micro Services. Advantages and Disadvantages
- If using a micro service:
- How does this new service access the invoice information?
- Accesses the DB directly?
- If yes, how can we scale it for new usecases? (imagine we will have a new billing service that needs the number of invoices to charge the customer, ...)
- Consumes the invoices API?
- The invoices service uses a message broker to communicate new invoices?
### Programming (00h20)
1. What is multithreading?
2. What is inversion of control? Or differences between IoC and DI.
3. What is an event loop in Node.js? (optional)
4. How do you structure your code if you want to develop the API we asked above?
- Any framework that the candidate knows about? MVC?
### Algorithm (00h10)
Given an array of ids where every element represents an invoice id, determine the id of the most frequently used. If more than 1 type has been spotted that maximum amount, return the smallest of their ids.
> Possible Solution O(N) N = array length
```js
function fetchMaximum(arr) {
const halfSize = arr.length / 2; // NOT NECESSARY!
let max = { value: 0, counter: 0 };
const acc = {}
for (const value of arr) {
acc[value] = (acc[value] || 0) + 1;
if (acc[value] > max.counter || (acc[value] == max.counter && value <= max.value)) {
max = { value, counter: acc[value] }
}
if (acc[value] > halfSize) { // NOT NECESSARY!
return value;
}
}
return max.value;
}
```
## End (00h10)
- Do you think we could do other questions about topics you might feel more comfortable with?
- What would you like to have at Talkdesk that you do not have now? What are your expectations for the position you are applying?
- Time for the candidate to make questions
-----
## Topics (Greenhouse)
### Tech Knowledge
- **Application architecture** (trade-offs, advantages of: ORMs, Repository pattern, MVC, Dependency Injection / IoC
- **Functional Programming** (what is a Monad, pure-function, composition/flow, immutability and side-effects)
- **Message Queues** (amqp, kafka, mqtt - features, consistency trade-offs, failure scenarios, latency/throughput)
- **Microservices Architecture** (trade-offs vs monolith, independent deployment with forward/backward compatibility, event-driven/event-sourced architecture vs SOA)
- **NoSQL** (MongoDB, Cassandra, Redis, consistency trade-offs, cost of joins, cost of scan operations)
- **Programming principles** (SOLID, DRY, KISS, Composition vs Inheritance, YAGNI)
- **Resiliency principles** (error handling, circuit-breaking, bulkheads, exponential backoff, exception handling, systems monitoring, application monitoring, alerting)
- **REST** (API design, put vs post vs patch, RPC operations over resources - and try to transform the operation into a resource)
- **Scalability Principles** (single points of failure, caching, horizontal vs vertical scalability, CAP theorem, async vs sync, partitioning)
- **SQL** (inner joins vs outer joins vs left joins, foreign keys - benefits, costs -, cascade 💥, indexes - types, costs-, debugging performance - describe, explain, explain analyse)
- **Test Driven Development** (component tests, unit tests, integration tests, test pyramid, mock vs stub)
### Development process
- **Agile** (scrum vs kanban, estimation practices, velocity, scope changes, interaction with team/product)
- **Development workflow** (local environment, pull requests, code review)
- **Version Control** (SVN, Git, CVS - comparison, most complicated operation used, important features)
### Language / Frameworks Mastery
- **Elixir** (Genserver, Actor model and message exchange, Swarm, Erlang/OTP, Macros/Metaprogramming, Distribution (node clusters, node-to-node system design), knowledge about BEAM and runtime (processes, how scheduling works, memory mgmt, GC, limitations and common bottlenecks))
- **Javascript** (ES6, transpilers, code bundling, dependencies management)
- **Java** (Streams API, JPA, Spring, Concurrency, Networking, Memory Management, GC, JIT)
- **Kotlin** (Spring details, Sequences API, Functional APIs, Concurrency, DSLs, Language Extensions, Networking, Memory Management, GC, JIT)
- **Python** (generators, itertools/functools, context managers, yield, decorators, django details, flask details, concurrency)
- **React** (React internals & lifecycle, State management (React/Mobx), Advanced patterns (e.g. HOC, render props, Container vs Presentational components), Routing)
- **Ruby** (rspec details, rails details, concurrency, Enumerable.lazy, meta-programming, DSLs)
- **Programming Skills** - Challenge Evaluation
- **Code Style**
- **Correctness**
- **Documentation** (README, solution description, instructions on how to build/run, relevant comments)
- **Optimized code** (Algorithmics, Error Handling, Scalability, Resiliency)
- **Proficiency with chosen language** (Also look for advanced language features, usage of package Manager, language best practices)
- **Unit Tests + Test Coverage**
- **Well structured project**