解决通用系统设计问题有哪些好方法?

发布于 2025-01-12 18:40:02 字数 1004 浏览 1 评论 0原文

最近,我正在复习系统设计问题,以测试我的知识,只要 这个问题结构良好,与我的日常工作相同,我们首先编写完整的规范,然后开始设计。

因此,我在互联网上发现的一些采访问题确实让我感到困惑。 我发现leetcode中报告了以下问题:

设计一个应用程序,允许用户使用以下方式查找新服装 他们衣柜里已有的衣服

现在我试着想象自己正在接受这样的采访,我应该如何应对这样的问题?甚至没有基本规范,它似乎太通用了。

我想与您分享我对如何解决这个问题的想法,如果我遗漏了什么,请听听您的想法。

当我看到没有规范的通用问题时,我会做我们在工作中所做的事情,并且更多地谈论该功能。 因此,在这种情况下,如果队友建议这是我们需要设计的应用程序,我会首先要求他向我展示一个示例,甚至可能是一个说明为什么需要它的用例。然后,我们将构建功能需求并创建一个汇合文档,在其中准确描述问题所在,并展示可以指出解决方案的用例。 然后我们会去讨论非功能性需求。

因此,如果我与面试官交谈,我会首先尝试了解该应用程序应该为谁服务,以及我们应该期望有多少用户使用我们的应用程序。

基本上解决这个问题,抛开非功能性需求不谈,我会设置一个 HTML 网站,用户可以在其中发送 HTTP 请求,并以他们拥有的衣服作为参数,然后在服务器端我将使用 SQL 查询新服装。像这样的东西:

select DISTINCT o.name
from 
    outfits o
    inner join cloths_index i
    on o.cloth_id = r.cloth_id
where i.cloth_id IN ([SOMERANGE]);

其中outfits是包含所有服装的表,clothing_index是包含outfit列和cloth列的表,其中对于每件服装,我们将指定所需的布料,以便我们有这个匹配。

但如果面试官告诉我 SQL 不足以满足非功能性需求,因为我们可能需要同时支持大量用户,那么接下来我应该建议什么呢?

我觉得这个悬而未决的问题让我很困惑,我无法整理我的思绪。

Lately I was going over system design questions in order to test my knowledge and things went pretty smooth as long as
the question is well structured, same as in my day job, we first write full specification and then start a design.

With that, some of the questions I've found on the internet that came from interviews were really confusing to me.
I've found the following question reported in leetcode:

Design an application that allows users to find new outfits using
clothes they already have in their closet

Now I am trying to imagine myself being in such interview, how should I react to such a question? It seems way too generic without even basic specification.

I want to share with you my thoughts on how I would tackle this question and hear your thoughts if I am missing anything.

When I see generic problems without specification, I do what we do in our job and I talk more about the feature.
So in this case if a teammate was suggesting this is the application we need to design I would ask him first to show me an example, maybe even a use-case of why it is needed. Then we would build the functional requirements and create a confluence document where we describe exactly what is the problem and show use-cases where we can point a solution.
Then we would go and talk about the non functional requirements.

So if I were talking to an interviewer I would try to understand first who this application should serve and how much users should we expect using our application.

Basically solving this problem, leaving non functional requirements aside, I would setup an HTML website where the user can send HTTP request with clothes they have as argument and then in the server side I would use SQL to query new outfits. something like this:

select DISTINCT o.name
from 
    outfits o
    inner join cloths_index i
    on o.cloth_id = r.cloth_id
where i.cloth_id IN ([SOMERANGE]);

where outfits is the table containing all the outfits and clothes_index is a table containing outfit column and cloth column where for each outfit we would specify the required cloth so that we have this matching.

But if the interviewer would tell me that SQL is not enough to fill the non functional requirements because we may need to support a large amount of users simultaneously, then what should I suggest next?

I feel this open question confuses me and I'm not able to arrange my thoughts.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦归所梦 2025-01-19 18:40:02

我个人发现以相同的方式开始架构/系统设计非常有用。也就是说,要问:

  1. 该系统的基本目标是什么?为什么我们需要它?最重要的用例是什么?
  2. 利益相关者有哪些?谁使用它?谁想要它?谁做决定?谁提供意见?
  3. 范围是什么?什么是系统的一部分,什么是外部/外部系统?什么是超出范围的?
  4. 什么是最重要的功能性和非功能性需求?
  5. 是否存在团队规模/技能、语言、监管或合规规则等限制?

这几乎是 arc42 的初始章节 - 一个用于记录和交流架构的模板。当然,这只是一个起点,但根据我的经验,这些基本问题至少对我很有帮助。

I personally find it very useful to start an architecture / system design always the same way. That is by asking:

  1. What is the fundamental goal of the system? Why do we need it? What is the top use case?
  2. What are the stakeholders? Who uses it? Who wants it? Who makes decisions? Who provides input?
  3. What is the scope? What is part of the system, what is outside / external systems? What is out of scope?
  4. What are top functional and non-functional requirements?
  5. Are there constraints like team size/skill, languages, regulatory or compliance rules?

This is pretty much the initial chapters of arc42 - a template to document and communicate architectures. Of course this is just the starting point, but in my experience these basic questions served at least me well.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文