svn显示更改代码行数_示教时显示代码更改

svn显示更改代码行数

A key – but challenging – part of learning to program is moving from writing technically-correct code “that works” to writing high-quality code that is sensibly decomposed into functions, generically-applicable and generally “good”. Indeed, you could say that this is exactly what Software Carpentry is about – taking you from someone bodging together a few bits of wood in the shed, to a skilled carpenter. As well as being challenging to learn, this is also challenging to teach: how should you show the progression from “working” to “good” code in a teaching context?

学习编程的一个关键(但具有挑战性)部分正在从编写技术上正确的代码“起作用”到编写高质量的代码,该代码被合理地分解为功能,通常适用并且通常为“良好”。 的确,您可以说这正是Software Carpentry所要解决的问题-将您从棚子里扎几根木头的人带到熟练的木匠那里。 学习不仅具有挑战性,而且教学也具有挑战性:您应该如何在教学环境中显示从“工作”到“良好”代码的发展?

I’ve been struggling with this recently as part of some small-group programming teaching I’ve been doing. Simply showing the “before” and “after” ends up bombarding the students with too many changes at once: they can’t see how you get from one to the other, so I want some way to show the development of code over time as things are gradually done to it (for example, moving this code into a separate function, adding an extra argument to that function to make it more generic, renaming these variables and so on). Obviously when teaching face-to-face I can go through this interactively with the students – but some changes to real-world code are too large to do live – and students often seem to find these sorts of discussions a bit overwhelming, and want to refer back to the changes and reasoning later (or they may want to look at other examples I’ve given them). Therefore, I want some way to annotate these changes to give the explanation (to show why we’re moving that bit of code into a separate function, but not some other bit of code), but to still show them in context.

作为我一直在做的一些小组编程教学的一部分,我最近一直在为此而苦苦挣扎。 简单地显示“之前”和“之后”最终会一次轰炸学生太多的变化:他们看不到你如何从一个人到另一个人,所以我想要某种方式来显示随着时间的推移代码的发展事情逐步完成(例如,将代码移到一个单独的函数中,在该函数中添加一个额外的参数以使其更通用,重命名这些变量,依此类推)。 显然,当面对面授课时,我可以与学生进行互动式交流-但是对真实世界代码的某些更改太大而无法进行直播-并且学生似乎常常发现这类讨论有些让人不知所措,并且想要请稍后再参考更改和推理(或者他们可能想看看我提供的其他示例)。 因此,我想要某种方法来注释这些更改以给出解释(以说明为什么将那部分代码移到一个单独的函数中,而不是其他一些代码中),但仍在上下文中显示它们。

Exactly what code should be used for these examples is another discussion: I’ve used real-world code from other projects, code I’ve written specifically for demonstration, code I’ve written myself in the past and sometimes code that the students themselves have written.

这些示例究竟应该使用什么代码,这是另一个讨论:我使​​用了其他项目中的真实代码,为演示而专门编写的代码,过去自己编写的代码以及有时由学生自己编写的代码已经写了。

So far, I’ve tried the following approaches for showing these changes with annotation:

到目前为止,我已经尝试了以下方法来使用批注显示这些更改:

  1. Making all of the changes to the code and providing a separate document with an ordered list of what I’ve changed and why.Simple and low-tech, but often difficult for the students to visualise each change
  2. The same as above but committing between each entry in the list.Allows them to step through git commits if they want, and to get back to how the code was after each individual change – but many of the students struggle to do this effectively in git, and it adds a huge technological barrier…particularly with Git’s ‘interesting’ user-interface.
  3. The same as above, but using Github’s line comments feature to put comments at specific locations in the code.Allows annotations at specific locations in the code, but rather clunky to step through the full diff view of commits in order using Github’s UI.
  1. 对代码进行所有更改并提供一个单独的文档,其中包含我已更改内容及其原因的有序列表。技术简单,技术含量低,但学生通常很难直观地看到每个更改
  2. 与上面相同,但是在列表中的每个条目之间进行提交。允许他们在需要时逐步执行git commit,并返回每次更改后的代码显示方式-但是许多学生都难以在git中有效地做到这一点,这增加了巨大的技术障碍……尤其是Git的“有趣”用户界面。
  3. 与上面相同,但是使用Github的行注释功能将注释放置在代码中的特定位置,允许在代码中的特定位置添加注释,但是笨拙地使用Github的UI逐步查看提交的完整差异视图。

I suspect any solution will involve some sort of version control system used in some way (although I’m not sure that standard diffs are quite the best way to represent changes for this particular use-case), but possibly with a different interface on it.

我怀疑任何解决方案都将涉及以某种方式使用的某种版本控制系统(尽管我不确定标准差异是表示此特定用例更改的最佳方式),但是可能具有不同的接口。

Is this a problem anyone else has faced in their teaching? Can you suggest any tools or approaches that might make this easier – for both the teacher and students?

这是其他人在教学中遇到的问题吗? 您能为老师和学生们提供任何可能使此操作变得更容易的工具或方法吗?

翻译自: https://www.pybloggers.com/2016/07/showing-code-changes-when-teaching/

svn显示更改代码行数

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值