Clojure开发:IDE或REPL? [英] Clojure Development: IDE or REPL?

查看:176
本文介绍了Clojure开发:IDE或REPL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用Clojure一段时间,并想创建一些比玩具更大,更复杂的项目。我过去几年一直在使用Java,并且已经习惯于IDE为我做什么 - 编译大量的类,将它们打包在jar中,创建批处理文件供用户使用。



当我看到Clojure中的开发示例时,他们似乎沿着加载文件到REPL中,看看它们是如何工作,编辑文件,重新加载,重复。 Nary在任何地方生成的类或jar。在Stuart Halloway的了不起的编程Clojure中,我找不到一个:gen-class的例子。我使用的Clojure IDE(ClojureBox和enclojure NetBeans插件)似乎促进了相同的工作流程。



这是有意的吗?工具是否太不成熟,或者我只是不得到它?



我想听听一些工作流程的例子,从谁创造了一些非平凡的程序感谢您分享自己的意见。

>解决方案

我认为这里真有两个问题:



A)如何部署(构建和管理依赖项)。所有我可以说的是看看具有相似目标/域名的其他项目,并复制它们。



B)工作流程:



我的工作流程如下:


  1. 打开一个文件,



2.5在我创建它们时将函数定义复制到REPL


  1. 打开另一个文件并写一些基本测试来检查函数工作

3.5将这些复制到REPL


  1. 在构建测试的两个缓冲区之间循环,直到一个示例,程序朝向最终目标。


现在当我在一个月回来,我可以运行我的测试,并开心!保存REPL缓冲区可以提供一些价值,不费吹灰之力。



对于IDE和REPL的选择,大多数IDE都有一些插件,这些插件有REPL,所以我不知道它的一个或另一个选择 - 真正它只是关于哪个文本编辑器你是有效的,以及你想如何管理你的项目结构。没有任何这样做结构预制的AFAIK,所以在这一点,它是更容易看看特定的项目(如Clojure本身,半影或compojure或任何在主网站上列出的库。 p>

I've been using Clojure for a little while and want to create some projects that are bigger and more complicated than toys. I've been using Java for the past few years and have become accustomed to what IDEs do for me -- compile lots of classes, package them up in jars, create batch files for users to start them with.

When I look at examples of development in Clojure they seem to be along the lines of load files into the REPL, see how they work, edit the file, reload, repeat. Nary a class or jar being generated anywhere. In Stuart Halloway's terrific "Programming Clojure" I couldn't find a single example of ":gen-class", for example. The Clojure IDEs that I have used (ClojureBox and the enclojure NetBeans plugin) seem to promote that same work flow.

Is this intentional? Are the tools too immature or do I just not "get it"?

I'd like to hear some work flow examples from folks who have created some non-trivial programs to be used by regular users (not other devs) if possible.

Thanks for sharing your opinions.

解决方案

I think there are really 2 questions here:

A) how to deploy (and build and manage dependencies). All I can say to that is look at other projects with similar goals/domains and copy them.

B) Workflow:

My work-flow is like this:

  1. open a file and write some high level wishful thinking declarations

  2. start writing some functions to support it

2.5 copy the function definitions to REPL as I create them

  1. open another file and write some basic tests to check the function works

3.5 copy these to the REPL

  1. iterate between the two buffers building the tests up to an example and the program toward an end goal. These eventually become similar activities and I know I’m done.

  2. wrap the secondary file up in deftest

Now when I come back in a month, I can just run my tests and be happy! Saving your REPL buffers can provide some value with little effort. That’s just what works for me at present, and I’m happy to be educated to better approaches.

As for selection of IDE vs REPL - most IDEs have plugins which have REPLs so I'm not sure its a one or the other choice - really its just about which text editor you are productive in, and how you want to manage your project structure. There aren't any 'do it this way' structures pre-made AFAIK so at this point it is easier to look at specific projects (like Clojure itself, or penumbra or compojure or any of the libraries listed on the main site.

这篇关于Clojure开发:IDE或REPL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆