К содержанию
Вся база

Java Developer

$12 000 / мес

14 вопросов · 2 ч 25 мин · сложность высокая

00:002:24:44

Запись — после входа.

О чём разговор

Event-driven design, PostgreSQL locks, CompletableFuture, ticket waitlist, SQL indexes

Этапы

  1. 1Техническое
  2. 2Лайв-кодинг
  3. 3Системный дизайн

Все вопросы

  1. 00:00

    If you wake up at 3 a.m. and must build an end-to-end proof of concept, what is your most comfortable stack?

    Технический
  2. 08:49

    If an error happens on the consumer side, how does handling differ between a blocking REST API and an event-driven system?

    Технический
  3. 12:59

    If you must ensure messages are processed exactly once on the consumer side, is there any way to do that?

    Технический
  4. 15:07

    Do you remember why we need foreign keys, and how do they affect insert speed?

    Технический
  5. 19:00

    How can we make the read, increment and write-back of a counter atomic?

    Технический
  6. 22:44

    What is optimistic locking, and how does it differ from pessimistic locking under the hood?

    Технический
  7. 28:54

    If you submit a future and call Future.get(), what will happen?

    Технический
  8. 35:26

    How would you design a ticket booking system with a 10-minute reservation and a waitlist?

    Системный дизайн
  9. 49:20

    How do you make sure the tickets stay limited, so that no more are sold than exist?

    Системный дизайн
  10. 51:48

    What if I create a reservation and do not pay in 10 minutes?

    Системный дизайн
  11. 54:13

    When do you know that you have to pick the first user from the waitlist?

    Системный дизайн
  12. 1:07:10

    Write an SQL query for the top three highest-paid employees, with a filter by department ID, and suggest indexes.

    Код
  13. 1:25:28

    Implement a method that gets the user profiles of an organization, using CompletableFuture and Either.

    Код
  14. 1:50:34

    Implement a function that checks whether a string can be segmented into words from a given dictionary.

    Код

Ключевые моменты

  1. 35:26

    Task: design a ticket booking system

  2. 1:07:10

    Live coding: SQL query and indexes

  3. 1:25:28

    Task: CompletableFuture and Either

  4. 1:50:34

    Task: word segmentation

  5. 59:18

    Candidate's questions about the work and hiring

Отрывок из разговора

28:54
Interviewer

So, I submitted a future and I call get. What will happen?

28:59
Candidate

You will either get the result. Well, you will get the result anyway. You can get either exception or you can get the result you were expecting to get. But you will get something.

29:10
Interviewer

Okay. What will happen is that the client thread the caller thread will be blocked until the underlying future completes. And then when it completes you will get the result.

29:22
Candidate

I think there should be some there is a timeout by default for the future. So it will not be stale there. But, okay, I see what you mean. There is a scenario where it will still wait for the response.

29:36
Interviewer

If you don't pass the timeout, it's indefinite timeout.

Что вынести

A technical interview for a Java backend role in four blocks: theory (event-driven design, PostgreSQL, concurrency, Future), live coding (SQL with indexes, a CompletableFuture task with Either), ticket-booking system design with reservations and a waitlist, and a word-segmentation task. The candidate reasoned through the design questions step by step but needed hints on PostgreSQL locking and CompletableFuture types. The greedy word-segmentation approach failed a counterexample and no working solution was reached in time; the interviewer promised feedback and no outcome is stated in the recording.

Разбор собран по записи разговора.

Расшифровка

00:00
Interviewer

Let's imagine hypothetically you wake up at 3 a.m. and you need to implement a proof of concept where it's an end to end application. What is your most comfortable stack for such a task?

00:16
Candidate

I'm more comfortable with Java. I'm a little bit less comfortable with Kotlin, but...

00:22
Interviewer

Look, it's not a trick question. If you are comfortable with Java, then it's Java. It's not Java and a little bit of Kotlin. It's one or another. So for the languages, it's Java.

00:33
Candidate

I got it. Yeah, for the languages, it's Java. For the rest of the text tag, it depends what problem I'm trying to solve.

00:41
Interviewer

It's 3am. You don't have time to think.

00:43
Candidate

Yeah, but if I don't know what's the problem, I don't know if I need SQL or non-SQL.

00:48
Interviewer

You know that you need to implement a proof of concept.

00:51
Candidate

Okay, well, then just picking the easiest, text-tack probably doing something on cloud just to not bother with local deployment. I'm more familiar with AWS, I would go for there. Okay. Databases? Databases as well, for the SQL, Postgres, for non-SQL, MongoDB.

01:18
Interviewer

SQL, it's BRC.

01:21
Candidate

but it depends on the problem like if i need ic transactions it's a very strange request because i wouldn't do something if i don't have problem to solve but okay let's speak postgres because it's classic um any message brokers well kafka by default and unless i'm interested in some as slow latency as possible then probably

01:49
Interviewer

name. Okay. Okay. And if you join us and you have the freedom to introduce the best practices, to reuse something that you found useful in the past, assume that we don't have it, what would you try to reuse? It's quite a tricky question. It's not a tricky question. What do you think is the best practice? What would you like to reuse?

02:19
Candidate

I think every problem has its own best practice. So that's the problem for me. Because if we are speaking about, this is data, I think this project is data injection pipelines, right? And even sourcing. So message brokers most probably Kafka.

02:35
Interviewer

Because Kafka is not the best practice. Kafka is just a tool, I would say.

02:41
Candidate

Oh, okay. Well, from the architectural perspective, of event-driven architecture is the best long-term solution, microservices is the best long-term solution. I want to say it depends, but okay, well, what else?

03:01
Interviewer

Yeah, look, it's not a trick question. Yeah, it's an open-ended question, but I give you the constraints. Yeah, you have the freedom to pick anything that you think is the best practice. And I'm just curious to hear what you would like to reuse. So event-driven microservices, okay. If it's all, we can move on. It's not a problem.

03:28
Candidate

Okay. Well, if you are speaking about classic backend architecture for a traditional SaaS company, it's Kubernetes, like containerized applications.

03:42
Interviewer

It's not a best practice. I would say it's an architectural decision. If your application is small, you don't need Kubernetes. If it's huge, it's not the best practice. That's what I'm saying.

03:54
Candidate

Well, exactly. Like, it depends on the problem. Even monolith can't be best practice if your application is really small and you need to just build it at 3am.

04:03
Interviewer

There are extremely high intensive applications which are monoliths and they run on huge MySQL databases. and they don't use event-driven or microservices and they are outperforming everyone there. It's not the best practice. It's just your architecture.

04:25
Candidate

Well, that's what I was trying to tell you, that there is no universal best practice. It's just a problem. And from there, you have the best solution. And then there are also trade-offs. So it's a question that has no answer, to be honest.

04:39
Interviewer

Okay. Okay. And talking about event-driven design, what is the advantage of going event-driven?

04:48
Candidate

The advantage is decoupling of the components. And usually we want that when we have a very, very high queries per second and we just cannot afford having transactional synchronous ecosystem. So we want to go for asynchronous approach and that means that many services have to call each other and in order to decouple them in order so that we don't have cascading failures where one service causes another to fail we have to use even during the architecture where you just have the events and we can easily replay them in case of failure. And what do you mean by decoupling? By decoupling I mean that well coupling is when we have two services one calls another in order to do some operation whatever if this service fails this service depends on it because it's called it so it requires some response this is synchronous calling and decoupling means that it can call this service without depending on it so it just throws away some requests it's designed in a way that it just throws away some event it tells that it happened and it just hopes that other services that are interested in this event to happen will react to it.

Дальше — после входа. Это бесплатно и займёт минуту.

Войти и читать

Похожие собеседования