吱吱工作流程

发布于 2024-11-16 04:56:11 字数 575 浏览 3 评论 0原文

我是 Squeak 和 Smalltalk 的新手,但一般不会编程(我有一些 Python 经验)。

我了解 Squeak 环境中存在的各种工具,例如工作区、系统浏览器以及 Smalltalk 语言结构。我理解他们如何孤立地工作,但是 我不确定它们将如何作为一个整体使用。

我的问题是在 Squeak 中开发时的典型工作流程是什么。 据我了解,

I open squeak.
I create a Class in the System Browser.
I then write/test/execute code in the Workspace, adding methods 
to my class based on the code I tried out in the Workspace.
Rinse and repeat for other classes.

以上内容是闲聊者通常遵循的内容还是有一些内容 我错过了。其他一般提示/陷阱(如果有)也将不胜感激。

谢谢。

顺便说一句,我确实搜索了这个并阅读了一些教程,但没有得到任何令人满意的答案,所以没有 lmgtfy 链接 请 ;)

I'm new to Squeak and Smalltalk but not programming in general(i've some Python experience).

I understand the various tools present in the Squeak environment like the Workspace, System Browser and also the Smalltalk language constructs. I understand how they work in isolation but
i'm not sure how they are to be used as a whole.

My question is what is the typical workflow when developing in Squeak.
As far as I understand it

I open squeak.
I create a Class in the System Browser.
I then write/test/execute code in the Workspace, adding methods 
to my class based on the code I tried out in the Workspace.
Rinse and repeat for other classes.

Is the above typically what smalltalkers follow or are there things that
i've missed. Also other general tips/gotchas(if any) will be appreciated.

Thanks.

BTW, I did search about this and read some tutorials, but did not get any satisfying answers, so no lmgtfy links
please ;)

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

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

发布评论

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

评论(3

辞别 2024-11-23 04:56:11

你所描述的我称之为个人发展风格。由于没有明确的方式应该如何发展,所以很难说。

但你所描述的是可行的选择。特别是如果不清楚这些东西是如何真正组合在一起的。 Smalltalk 的优势在于您手边拥有所有对象。所以可以在工作区尝试一下。如果您了解了它应该如何工作,那么就可以将代码放入方法中了。同时编写测试是个好主意。在工作区中,您使用示例值测试了代码。这正是一个考验。当您将不带值的代码放入方法中时,您可以将该方法与示例值的用法放入测试中。测试可以帮助您识别在构建整个事物时是否改变了一些基本的东西。

我使用的另一种开发风格是使用检查器。特别是如果你从网上获取东西,这很容易做到。假设您从网络上的 Web api 检索 xml。在工作区中,我发出 url 获取命令并打开结果检查器。在检查器中,我开始解析结果,并在每个单独的处理步骤中,我对结果打开另一个检查器,直到得到我想要的结果。从那时起,所有检查员都互相堆叠在一起。您只需从最后一步开始从每个检查器创建方法,然后关闭检查器,获取下一个检查器并从中创建方法,等等。

最后,很多开发人员喜欢使用调试器进行开发。您只需编写代码就好像它已经存在一样。您可以在调试器中更改代码,并且可以重新启动当前方法的当前执行。执行它会给你下一个调试器。您添加下一个需要的方法,然后继续执行该程序。您将获得下一个调试器等。

您会看到有很多可能的样式。但哪一种最好是您个人的意见。

What you describe I would call personal style of development. As there is not a definitive way how you should develop it is hard to say.

But what you describe is viable option. Especially if it isn't clear about how the things really fit together. Smalltalk has the strength that you have all the objects at hand. So it is possible to try it in the workspace. If you get a clue about how it should work it is time to put your code into methods. At the same time it is a good idea to write a test. In the workspace you tested your code with example values. That is exactly a test. As you put the code without the values in a method you could put the usage of that method with the example values into a test. Tests help you to recognize if you change something fundamental while you are constructing the whole thing.

Another style of development I use is using the inspector. Especially if you are fetching things from the net this quite easy to do. Let's say you retrieve a xml from a web api from the net. In the workspace I issue the url fetching command and open an inspector on the result. In the inspector I start to parse the result and on each individual processing step I open another inspector on the result until I have a result I wanted to have. From that point all inspectors are stacked upon each other. You just create methods from every inspector beginning from the last step then close the inspector, take the next inspector and create a method from it, etc.

Finally a lot of developers like to develop with the debugger. You just write code as if it would already exist. You can alter the code while in the debugger and you are able to restart the current execution of the current method. Executing it gets you the next debugger. You add the next needed method and then proceed with the program. You get the next debugger etc.

You see there are plenty of possible styles. But which one is best is your personal opinion.

舞袖。长 2024-11-23 04:56:11

我通常打开三个窗口:两个浏览器和 TestRunner。我编写了一个测试来弄清楚我想如何与对象交谈 - 它的 API,如果你愿意的话。然后我运行 TestRunner,确保测试因我预期的原因而失败。

然后我将做两件事之一 - 要么直接在调试器中编写我需要的新方法,然后重新启动测试直到它变绿,要么转到第二个浏览器并编写我需要的方法。

我偶尔会使用工作区,主要作为一种便签本,就像使用 Python 的 REPL 一样。如果您编写了类端 #initialize 方法,您可能希望从工作区重新初始化您的类。

I usually work with three windows open: two Browsers, and the TestRunner. I write a test to figure out how I want to talk to the object - its API, if you like. Then I run the TestRunner, making sure the test fails for the reasons I expect.

I'll do one of two things then - either write the new method I need directly in the Debugger, and restart the test until it's green, or go to the second Browser and write the method I need.

I'll occasionally use the Workspace, mainly as a kind of scratchpad, like one might use Python's REPL. If you've written a class-side #initialize method, you'll probably want to re-initialise your class from a Workspace.

若无相欠,怎会相见 2024-11-23 04:56:11

TDD 也是开发 Smalltalk 的一种选择。 Squeak 随 SUnit 一起提供。

您可以通过运行测试来组合 TDD 和调试器(由于您尚未编写该方法,该测试会失败),因此您使用调试器创建该方法,然后单步执行该方法并编写足够的代码以使测试通过。

TDD is also an option for developing Smalltalk. Squeak comes with SUnit.

You can combine TDD and the debugger by running the test - which fails because you haven't yet written the method - so you use the debugger to create the method, then step into the method and write just enough code to get the test to pass.

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