我在计算机科学系教授第三门必修入门课程。 我的一项家庭作业要求学生加快他们为之前的作业编写的代码。 十倍的加速是很常见的; 100 或 1000 的因数并非闻所未闻。 (要获得 1000 倍的加速,您必须在使用 malloc() 时犯过菜鸟错误。)
程序通过一系列小的更改得到改进。 我要求学生记录并描述每一个变化以及由此产生的改进。
当你改进一个程序时,也有可能破坏它。 退出不是很好吗?
您可以看到我的意图:我的学生将从版本控制中受益匪浅。 但有一些警告:
- 我们的计算环境是锁定的。 任何依赖于中央存储库的东西都是可疑的。
- 我们的学生超负荷得令人难以置信。 不仅仅是课程,还有工作、体育、音乐,凡是你能想到的。 对于他们来说,使用新工具必须非常简单并且具有明显的好处。
- 我们的学生大部分工作都是两人一组完成的。 在帐户之间来回传输数据是有问题的。 这个问题是不是也可以通过分布式版本控制来解决呢?
- 复杂性是敌人。 我知道建立一个 CVS 存储库太令人费解了——我自己仍然遇到麻烦,因为我每年只做一次。 我听说 SVN 更难。
以下是我对现有系统的评论:
- 我认为中央版本控制(CVS 或 SVN)被排除,因为我们的学生没有创建可以与其他学生共享的存储库所需的管理权限。 (我们被 Unix 文件权限困住了。)此外,CVS 或 SVN 上的设置太难了。
- darcs 很容易设置,但如何共享内容并不明显。 darcs send(通过电子邮件发送补丁)似乎很有前途,但尚不清楚如何设置它。
- git 的介绍性文档不适合初学者。 就像 CVS 设置一样,我自己也遇到了麻烦。
我正在征求有关初学者应使用哪些源代码控制的建议。 我怀疑我们可以找到资源来为现有系统添加一层薄薄的饰面并简化现有文档。 我们可能没有资源来编写新文档。
那么,什么是真正容易设置、提交、还原以及与合作伙伴共享更改但不具备的功能?易于合并还是大规模工作?
一个关键的限制是编程对必须能够彼此共享工作,并且只能彼此共享工作,并且编程对每周都会更换。 我们的基础设施是带有 netapp 文件管理器的 Linux、Solaris 和 Windows。 我怀疑我的 IT 人员是否愿意为每对学生创建一个 Unix 小组。 有没有我忽略的更简单的解决方案?
(感谢您接受的答案,该答案因其对 Git 的出色引用而击败了其他答案神奇以及有用的评论。)
I teach the third required intro course in a CS department. One of my homework assignments asks students to speed up code they have written for a previous assignment. Factor-of-ten speedups are routine; factors of 100 or 1000 are not unheard of. (For a factor of 1000 speedup you have to have made rookie mistakes with malloc().)
Programs are improved by a sequence is small changes. I ask students to record and describe each change and the resulting improvement.
While you're improving a program it is also possible to break it. Wouldn't it be nice to back out?
You can see where I'm going with this: my students would benefit enormously from version control. But there are some caveats:
- Our computing environment is locked down. Anything that depends on a central repository is suspect.
- Our students are incredibly overloaded. Not just classes but jobs, sports, music, you name it. For them to use a new tool it has to be incredibly easy and have obvious benefits.
- Our students do most work in pairs. Getting bits back and forth between accounts is problematic. Could this problem also be solved by distributed version control?
- Complexity is the enemy. I know setting up a CVS repository is too baffling---I myself still have trouble because I only do it once a year. I'm told SVN is even harder.
Here are my comments on existing systems:
- I think central version control (CVS or SVN) is ruled out because our students don't have the administrative privileges needed to make a repository that they can share with one other student. (We are stuck with Unix file permissions.) Also, setup on CVS or SVN is too hard.
- darcs is way easy to set up, but it's not obvious how you share things. darcs send (to send patches by email) seems promising but it's not clear how to set it up.
- The introductory documentation for git is not for beginners. Like CVS setup, it's something I myself have trouble with.
I'm soliciting suggestions for what source-control to use with beginning students. I suspect we can find resources to put a thin veneer over an existing system and to simplify existing documentation. We probably don't have resources to write new documentation.
So, what's really easy to setup, commit, revert, and share changes with a partner but does not have to be easy to merge or to work at scale?
A key constraint is that programming pairs have to be able to share work with each other and only each other, and pairs change every week. Our infrastructure is Linux, Solaris, and Windows with a netapp filer. I doubt my IT staff wants to create a Unix group for each pair of students. Is there an easier solution I've overlooked?
(Thanks for the accepted answer, which beats the others on account of its excellent reference to Git Magic as well as the helpful comments.)
发布评论
评论(18)
我想说像 Git 这样的东西可能适合这个要求:
看看这个网站 Git Magic
或者,甚至这个提示网站 GitReady
I would say something like Git might fit the bill:
Have a look at this site Git Magic
or, even this tip site GitReady
其次选择 Mercurial
优点
他们的笔记本电脑。 但这种情况永远不会发生。
缺点
已启用。
Second the choice of Mercurial
Advantages
their laptop. Not that that would ever happen.
Disadvantages
enabled.
Subversion 很容易在 Windows、Linux 和 Mac OS X 上安装。 我不知道他们正在使用什么程序进行编程,但是 Eclipse 的 subclipse 插件相当容易安装,并且隐藏了一些存储库的复杂性。
存储库的复杂性? 无论如何,这只是在每个项目中都有一个主干、标签和分支文件夹。 他们可能没有太多时间,但他们应该花时间学习 SVN(或类似的),因为这是一项在他们的简历上看起来很不错的技能。
Subversion is easy to install, on windows, linux and mac os x. I don't know what program they are programming in, but the subclipse plugin for Eclipse is fairly easy to install and hides away some of the repository complexity.
And repository complexity? That's simply having a trunk, tags and branches folder within each project anyway. And they might not have much time, but they should get the time to learn SVN (or similar) because it is a skill that looks good on their CV.
我建议查看 Fossil - 它是一个没有依赖项运行的单个可执行文件,通过 HTTP 操作所有流量,将其所有存储库数据保存在一个文件中,该文件可以命名为任何名称,并且包括版本控制的 wiki、错误跟踪和开箱即用的 Web 服务器。 哦,它是完全分布式的。
I'd suggest looking at Fossil - It's a single executable with no dependencies to run, operates all traffic over HTTP, keeps its all repository data in a single file which can be named anything, and includes version controlled wiki, bug tracking and a web-server out of the box. Oh, and it's completely distributed.
我推荐 Mercurial(也称为“hg”)。 它是一个分布式开源 VCS,不需要中央存储库。 日常使用它很容易。 官方网站上有足够的文档。 例如,查看QuickStart。
对我来说,决定点是一个很棒的 Windows GUI - TortoiseHg。 Linux 上似乎也支持(我自己没有尝试)。 当然,大多数 Linux 版本都有命令行发行版。
当然,从这一面来看似乎很容易,也许对于忙碌的学生来说概念、优点和日常操作不会那么容易习惯。 但最终,即时提交、恢复到任何修订并自动从那里创建新分支的能力以及智能差异/合并都是不可替代的。
希望这可以帮助!
I would recommend Mercurial (also called 'hg'). It is a distributed open-source VCS, and needs no central repository. Using it day-to day is easy. There is enough documentation on official site. For example check out QuickStart.
Deciding point for me was a great GUI for Windows - TortoiseHg. It seems it is also supported on Linux (didn't try myself). And of course there are command-line distributions for most Linux versions.
Of course it seems easy from this side of the fence, maybe for busy students concept, advantages, and everyday operation won't be that easy to get used to. But in the end, instant commits, ability to revert to any revision and create a new branch from there automatically, and intelligent diff/merge are just irreplaceable.
Hope this helps!
为了真正方便学生使用,您可以安装启用自动提交并使用 webdav 共享的 SVN 服务器。 这样他们就可以使用 WebDAV 挂载目录,并且每次点击保存时都会自动提交 - 使用 TortoiseSVN、Eclipse / Visual Studio 插件或某些 Web 访问解决方案(如 ViewVC)可以轻松访问历史记录。 对于您的访问限制需求,您可以使用集成的 Subversion 身份验证(请参阅 此处) - 它使用简单的配置文件进行细粒度的访问控制。
配置变得更加容易(现在有更好的文档 - 请查看 SVN 书籍) ,但如果您需要多个具有访问限制和 Web 界面的独立存储库,可能会有点复杂。
自动提交更像是“我的办公室职员/老板”的解决方案,他们不知道计算机内部发生了什么,需要对 Word 文档进行版本控制。 无论如何,参加编程课程的学生也许还应该学习如何使用像样的 SCM。
Git 和 Mercurial 会很好,因为它们的分布式特性,这使得共享变得容易 - 但这两种工具都缺乏真正易于使用的 GUI 界面(TortoiseHg 看起来很有前途,gitk 是一个非常好的存储库浏览器,但你的学生仍然需要他们热衷于命令行工具以充分利用这些工具)。 此外,分布式 SCM 的概念掌握起来有点复杂。
从专业角度来看,您可以使用 GitHub 等公共托管解决方案,而不必担心服务器设置。 这也使得共享解决方案变得非常容易,但会打破您“只能彼此共享”的要求。 但我想你无论如何都无法阻止他们交换代码,根据我的课程工作经验,我发现查看代码并验证其唯一性是防止复制的唯一方法。
您还可以使用 PlasticSCM,它为许多 IDE 提供了非常好的界面,并且(至少该网站声称)免费教育机构的许可证。
For real ease of use for your students, you could install a SVN server with autocommit turned on, shared using webdav. This way they can just mount their directory using WebDAV and will autcommit every time they hit save - accessing the history is easy with TortoiseSVN, the Eclipse / Visual Studio Plugins or some web access solution like ViewVC. For your access restriction needs you could use the integrated subversion authentication (look here) - which uses a simple configuration file for fine grained access control.
Configuration has become a lot easier (and there is better documention now - have a look at the SVN Book), but could get a bit coplicated if you need multiple separate repositories with access restrictions and a web interface.
Autocommit is more a solution for the "my office worker / boss" who has no clue whats going on inside a computer needs version control for word documents. Students taking a programming course should perhaps also learn how to use a decent SCM anyway.
Git and Mercurial would be nice because of their distributed nature, which makes sharing easy - but both tools lack GUI interfaces which are really easy to use (TortoiseHg looks promising, and gitk is a very good Repository browser, but your students would still have to wrap their heads around the command line tools to make full use of the tools). Also the concept of distributed SCM's is a little more complex to grasp.
On the pro side you could use public hosting solutions like GitHub and wouldn't have to worry about a server setup. This also makes sharing solutions really easy, but would break your "only with each other" requirement. But I guess you won't be able to stop them from exchanging code anyway, in my experience with course work I found looking at the code and verifying that it's unique is the only way to prevent copying.
You could also use PlasticSCM, which has really nice interfaces for a lot of IDE's and (at least the site claims) free licenses for educational institutions.
我认为没有理由处理设置源代码控制系统。 查看使用 google 代码 的条款并深入研究。
我和一位计算机科学同学使用了它去年,它运行得很好,唯一的先决条件是互联网连接:-)
I see no reason for dealing with setting up the source control system. Review the terms for using e.g. google code and dive in.
A fellow CS student and I used it last year and it works great and the only precondition is an internet connection :-)
集市,Mercurial 和 Git 听起来适合您的情况 - 创建起来很简单存储库,所有学生需要共享的只是文件系统上对彼此存储库的读取访问权限。
Bazaar, Mercurial, and Git sound appropriate for your case - trivial to create repositories, and all the students need to share is read access on the filesystem to each other's repositories.
Darcs 是一个优秀的 DVCS,特别是对于较小的项目,例如 CS 课程的项目。 我希望在大学时就向我介绍了 Darcs 或 Git,并且我也赞扬您向您的学生介绍了它们。
我每天都使用 Git。 这是一个非常强大的 DVCS,但对于较小的项目来说可能有点过大了。
任君选择,这两个版本控制系统都非常好。
Darcs is an excellent DVCS, especially for smaller projects such as ones for CS classes. I wish I was introduced to Darcs or Git in college, and I also commend you for introducing it to your students.
I use Git on a daily basis. It's a very robust DVCS, but maybe a bit of an overkill for smaller projects.
Take your pick, either of those version control systems are really good.
darcs send
设置起来很简单 - 当您运行darcs send
时,它会在远程的_darcs/prefs/email
中查找repo 来决定将电子邮件发送到哪里。 如果那里没有任何内容,那么它会提示用户。补丁的接收者只需保存文件并在适当的存储库中运行
darcs apply
即可。因此,每个学生都可以在
_darcs/prefs/email
中拥有自己的存储库和自己的电子邮件地址,并通过电子邮件交换补丁。darcs send
is trivial to setup - when you rundarcs send <remote repo>
, it looks in_darcs/prefs/email
of the remote repo to decide where to sent the email to. If there's nothing there then it prompts the user instead.The receiver of the patch just saves the file and runs
darcs apply <patch file>
in the appropriate repo.So each student can just have their own repos with their own email address in
_darcs/prefs/email
and exchange patches by email.我在Bazaar方面获得了一些非常好的体验。 与 Git/Mercurial 一样,它是分布式的。 它是无服务器的 - 即使您远程访问它,您也不需要在托管存储库的服务器上安装守护程序(即,它可以像 FTP/SFTP 共享一样工作)。
分布式 VCS 最灵活。 您可以从更传统的“中央”存储库中查看分支,并获得能够将自己的小开发与中央服务器等分开的所有好处,然后也许可以将更改推送回来。
还有其他 VCS 的导入工具,例如 Subversion,尽管我还没有尝试过。
I have had some very good experience with Bazaar. Like Git/Mercurial it is distributed. It is serverless - you do not need a daemon installed on the server hosting the repository, even if you are accessing it remotely (ie, it can work just as an FTP/SFTP share).
A distributed VCS is most flexible. You can check out a branch from a more traditional 'central' repository and gain all the benefit of being able to fork off your own little development separate to the central server, etc and then, perhaps, push your changes back up.
There are import tools for other VCSs such as Subversion though I haven't tried them.
关于权限,外部服务不需要您大学 IT 人员的时间。
例如,Bitbucket(使用 Mercurial)现在允许最多 5 个用户进行无限制的私人存储库。 我猜每周每对新的学生都会一起开发一个新项目,这意味着他们只需初始化存储库,添加其他用户,然后就可以离开了。
如果他们不是每周都在开发一个新项目,则必须删除和添加权限,我鼓励他们在 Bitbucket 上拥有多个存储库(每个帐户一个),以便每个学生都可以继续访问。 (无论如何,这都是一个好主意,但对于为期一周的项目,让一个学生帐户拥有存储库,而另一个帐户获得许可可能会更简单。)
关于哪种 VCS,我相信 Mercurial 将是最好的选择,考虑到您的平台—TortoiseHg 特别适合新用户探索,如果他们不熟悉(并且您没有时间让他们学习)命令行界面。
根据您的具体情况,DVCS 的优点是它们在大学服务器(如果有的话)上的副本是一个成熟的存储库。 您可能会发现您或助教访问起来很方便,设置起来应该更简单,并且可以持续整个学期,而不是每周更改一次。
Regarding permissions, an outside service wouldn't require time from your university's IT staff.
For example, Bitbucket (using Mercurial) now allows unlimited private repos with up to 5 users. I'm guessing each new weekly pair of students is working on a new project together, which means they can just initialize the repository, add the other user, and away they go.
If they are not working on a new project every week, permissions would have to be removed and added, and I'd encourage them to have multiple repos (one per account) on Bitbucket so each student has continued access. (This would be a good idea anyway, but for only week-long projects, it may be simpler to just have one student account own the repo and the other with permission.)
Regarding which VCS, I believe Mercurial will be best given your platforms—TortoiseHg being particularly good for new users to explore, if they're unfamiliar with (and you don't have time for them to learn) command-line interfaces.
Specific to your situation, the advantage of DVCS is their copy on the university server (if there is one) is a fully-fledged repo. You may find it convenient for you or TAs to have access, which should be simpler to setup and would last all semester instead of change weekly.
设置颠覆存储库很简单; 我经常为小型项目设置一个一次性的东西(例如为 Stack Overflow 上的答案开发代码!),并且我怀疑任何其他能够学习 SCM 系统的人都会遇到任何麻烦。
也就是说,共享当然是一个问题。 如果学生们同时工作时总是在一起工作,他们可以使用U盘,因为他们需要时只需拔掉它并来回传递,而稍后单独编程的人可以挂在上面它。 但这并不完全方便。
另一个选择是,因为它们似乎都在共享的 Unix 系统上工作,所以创建一个目录,为组的其余部分(或所有用户)设置执行但不读取位,并为该目录下的存储库使用 s3cr3t 名称,只有两个学生知道。 将这个秘密名称传递给教授也可以让他随时检查学生的存储库。 (“所以你按时提交了作业,但电子邮件系统丢失了它?让我看看提交的时间......”)脚本可以帮助设置此功能。
事实上,我想得越多,我就越开始喜欢它。 在某些方面,它比 git 解决方案更简单,因为学生不必处理传递补丁(或忘记这样做),并且学生将被迫在提交之前处理合并,而不是在事情完成后处理存储库(随后能够无限期地延迟处理)。
Setting up a subversion repository is trivial; I frequently set one up as a one-off thing for small projects (such as developing code for an answer on Stack Overflow!), and I doubt anybody else who could learn an SCM system at all would have any trouble with it.
That said, sharing is certainly an issue. If the students always work together when they work simultaneously, they could use a USB drive, since they can just unplug it and pass it back and forth when one needs to comit, and the person who's going to program alone later can just hang on to it. That's not entirely convenient, though.
Another option, since they all appear to be working on a shared Unix system, is to create a directory with the execute but not read bit set for the rest of the group (or all users) and use a s3cr3t name for the repo under that, one that only the two students know. Passing that secret name on to the prof would allow him to examine student's repos at any time, as well. ("So you submitted the assignment on time, but the e-mail system lost it? Let me just look at the time of that commit....") A script could help set this up.
In fact, the more I think about that, the more I'm beginning to like it. In certain ways, it's simpler than the git solution because the student doesn't have to deal with passing patches around (or forgetting to do so) and the student will be forced to deal with merges before he commits, rather than once things are in the repository (with the subsequent ability to delay dealing with that indefinitely).
更新:六年后,我再也不会考虑使用 subversion 来做任何事情了。 Git 是必经之路。 所以,虽然我仍然认为 SVN 有点“简单”,但它甚至不值得再教了。
我使用过 CVS、SVN、Bazaar 和 Git(按介绍顺序),我不得不对学生说 SVN 是最好的选择。 事实上,当我担任首席助教时,我们实施了 SVN 作为旧的“提交脚本”的替代品,“提交脚本”是一个 tar 和电子邮件脚本。 Labstaff 设置了一个基于 Apache SVN-DAV 的存储库,并使用 authz 文件,助教和讲师可以在非常细粒度的级别上控制每个学生目录和组项目的权限,从而为学生提供非常简单的第一次提交路径。 请参阅我的教程(凭据被最近的助教撕掉了..嗯..)
关于在没有系统管理员干预的情况下使用 subversion,我也在一个小组项目设置中做到了这一点,其中我的小组成员以前都没有使用过 subversion,而且他们中的大多数人在提交时都没有什么困惑(所有但一个)。 我还编写了一个教程,用于设置这样一个仅具有基本 SSH 访问权限的安全共享存储库 此处。
我绝对不同意认为,对于初学者来说,git 是最好的 VCS,因为在提到任何 VCS 系统时都经历过空白,更不用说由 Linus 自己编写的 mac-daddy 编写的 VCS 之王 git 。 说 git 并不比 svn 更复杂是不正确的,而且缺乏成熟的工具就足以成为在这种情况下不使用它的理由。 我刚刚开始在 Netbeans 中开发的一个新项目中使用 git,并且已经遇到了 Netbeans 集成的严重限制。 在一个学期内你不会使用 svn 不提供的任何功能,所以 git 有点过分了。
UPDATE: Six years later I would never consider using subversion for anything ever again. Git is the way to go. So, while I still think SVN is a bit "simpler", it is just not even worth teaching anymore.
I've used CVS, SVN, Bazaar and Git (in that order of introduction) and I'd have to say for students that SVN is the way to go. In fact, while I was lead TA we implemented SVN as a replacement for the old "submit script" which was a tar and email script. Labstaff setup an Apache SVN-DAV based repository and using the authz file the TAs and instructor could control permissions for per-student directories and group projects at a very fine-grained level leaving students with a very simple path to their first commit. See my tutorial (credentials ripped out by the most recent TAs.. hmm..)
Regarding the use of subversion without intervention by sys admins, I've done this as well in a group-project setting where none of my group members had ever used subversion before and most of them were committing with very little confusion (all but one). I also wrote a tutorial for setting up such a secure shared repository with only basic SSH access here.
I definitely disagree that git is the best VCS for beginners having experienced the blank looks enough at the mention of any VCS system, let alone the mac-daddy-written-by-Linus-himself VCS king, git. It is simply not true that git is no more complex than svn, and the lack of mature n00b tools alone is enough of a reason not to use it in this scenario. I just started using git for a new project that I am developing in Netbeans and already ran into serious limitations with the Netbeans integration. In a single semester you are not going to use any functionality that svn doesn't provide so git is overkill.
Windows 上的 Subversion 就像设置 TortoiseSVN 一样简单。 使用它有一点学习曲线(特别是如果您以前从未使用过版本控制),但是您可以通过专门用半节课来介绍它并提供一些幻灯片供他们下载,从而有所帮助。
至于集中化——我听说过一些网站提供免费的 SVN 项目托管。 在 Google 上进行快速搜索后,就出现了此页面,但肯定还有更多页面。
Subversion on Windows can be as simple as setting up TortoiseSVN. There is a bit of a learning curve for using it (especially if you've never used a version control before), but you might help that by dedicating half a lesson to it and providing some powerpoint slides for them to download.
As for centralization - I've heard of websites that offer free SVN project hosting. A quick Google search turned up this page, but there are certainly more.
如果您正在寻找非常容易设置的东西,那么为什么不选择免费的 SVN 托管选项,您无需设置任何东西!
遗憾的是,每个人都会指出您是 Assembla 和 Unfuddle 的两个较旧的托管服务已经放弃了对其免费托管的支持(或者至少如果您希望它们私有),但您仍然可以使用 Origo 这为您提供开放式和封闭式托管。
这样做的好处是,您可以拥有所有项目并关注它们,并轻松控制有权访问的人员,并且您不必担心创建存储库的权限。
如果你确实走这条路,并且你想消除复杂性,那么你必须使用 GUI svn 应用程序来使学习变得几乎微不足道(因为我怀疑是否会进行很多合并)。 我推荐 tortoisesvn,直接滑入 Windows 资源管理器上下文菜单。
If you are looking for something that is really really esay to set up, then why not go for the free SVN hosting option, you don't have to set up a thing!
Sadly the two older ones that everyone would have pointed you to being Assembla, Unfuddle, have dropped support for their free hosting ( or at lest if you want them to private ), but you can still use Origo this give you both open and closed hosting.
The advantage of this is that you can own all the projects and follow them all, and easily control the people who have access, and you don't have to worry about right for creating repos.
If you do go this route, and you want to eliminate complexity then you must use a GUI svn application to make learning near trivial ( since I doubt there will be much merging going on ). I would recommend tortoisesvn, slips right into your windows explorer context menu.
我想说,最好的选择是尝试与 IT 部门合作,为您的学生建立一个系统/方法,以便轻松创建新的 SVN/CVS 存储库。
也许您可以让 IT 部门授予您为学生创建存储库所需的权限,即使他们不会向学生本身授予权限。 您可能可以很容易地编写一些脚本来在学期开始时从学生列表中批量创建存储库。
I would say your best bet will be to try to work with your IT department to set up a system/method for your students to easily create new SVN/CVS repositories.
Probably you could get the IT department to give you the privileges necessary to create repositories for your students even if they won't give the priveleges to the students themselves. You could probably pretty easily write a few scripts to mass-create repositories from lists of students at the beginning of the semester.
适用于 Linux 的 RCS。
我发现没有什么比 RCS for Widows 更简单的了,但并不是所有的 RCS 端口都工作得很好,所以你必须尝试它们,这使它变得不简单。 Windows 对于开发人员来说并不简单。
Windows 端口来自 http://www.cs.purdue.edu/homes/trinkle/ RCS/ 相当不错。
RCS for linux.
I've found nothing simpler than RCS for Widows but not all the RCS ports work well so you have to try them which makes it non-simple. Windows just isn't simple for developers.
The windows port from http://www.cs.purdue.edu/homes/trinkle/RCS/ is pretty good.