学习和“唱歌” Ruby 与西纳特拉

发布于 2024-09-02 17:01:15 字数 302 浏览 3 评论 0原文

您好,我正在尝试通过阅读《Ruby 编程语言》一书来提高我的 Ruby 知识。在阅读工作中的编码员时,我看到很多受访者建议深入研究项目源代码

  • 以学习最佳实践
  • ,以意识到坏习惯
  • ,当然还可以为如何做事获得新的灵感。

我决定选择一个尽可能独立的项目。我的选择是 Sinatra,因为它有 1000 LOC。

这是一个值得学习的好项目吗? 您是否建议另一种更简单的(即更少的 LOC)?

我以前曾尝试过参观铁路机械,但结果让我感到害怕。

Hello I'm trying to improve my ruby knowledge by reading The Ruby Programming Language book. Reading Coders at work I saw that lot of the interviewees suggest to dive into a project source code

  • to learn best practices
  • to be aware of bad habits
  • and of course to take new inspirations for how to do things.

I decided to pick a project as more self contained as I could find. My choice was Sinatra since It's 1000 LOC.

Is It a good project to learn?
Do you suggest another one more simple (i.e. less LOCs)?

I've tried to see rails machinery before but I came out scared from It.

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

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

发布评论

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

评论(3

标点 2024-09-09 17:01:15

我对 Ruby 不太感兴趣(虽然我玩过一点 Sinatra),但我想说,Coders at Work 建议应该被解读为“不仅从一个项目中读取源代码,而且从多个项目中读取源代码”。 ”。通过比较,我们学得最好。这也是我们能够发现模式并将其抽象出来的方式。

所以也许你可以从 Sinatra 中选择一些主题,看看它是如何实现的,然后将它与 Rails 中的实现方式进行比较。

您考虑的来源越多,您对特定主题的理解就越深入。

I'm not that much into Ruby (although I've played a little bit with Sinatra), but I want to say that the Coders at Work advice should rather be read as "read source code not only from one project, but from many". We learn best by comparison. That's also how we're able to spot patterns and abstract them away.

So maybe you can choose some topic from Sinatra, see how it is implemented, then compare it with the way it's done in Rails.

The more sources you consider the better you understand a particular subject.

小瓶盖 2024-09-09 17:01:15

阅读 Sinatra 代码是一个好的开始。您可能还想阅读 Sinatra 使用的 HTTP 接口 Rack。不一定用于编码实践,而只是为了了解 Sinatra 如何适应整个堆栈。

添加到 Ionuş 的答案中,Rails 还使用 Rack,因此如果您决定同时查看 Sinatra 和 Rails,您可以比较它们如何使用 Rack。

Reading the Sinatra code is a good start. You might also want to read up on Rack, the HTTP interface Sinatra uses. Not necessarily for coding practices but just to understand how Sinatra fits in the whole stack.

Adding to Ionuț's answer, Rails also uses Rack, so if you decide to look at both Sinatra and Rails, you can compare how they use Rack.

二智少女 2024-09-09 17:01:15

尝试输入 gem list 以列出您已安装的所有 gem。选择与您的域相关的一个。

Try typing in gem list to list all the gems you've installed. Pick one that's relevant to your domain.

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