避免代码合并冲突_避免合并冲突-情节提要版

2023-12-27 14:40

本文主要是介绍避免代码合并冲突_避免合并冲突-情节提要版,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

避免代码合并冲突

情节提要参考和交流可以节省一天 (Storyboard References and Communication Save the Day)

I recently worked on a 1-week quick prototype project with a few junior developers. Most of the developers on the team preferred that we use storyboards because it’s what they’re most familiar with.

我最近与几个初级开发人员一起进行了为期1周的快速原型项目。 团队中的大多数开发人员更喜欢我们使用情节提要,因为这是他们最熟悉的。

Though I’m one that prefers working in storyboards, I was not looking forward to the incessant merge conflicts. Meeting after meeting of “which side do I pick?” — storyboards are written in XML if you didn’t know (right-click a storyboard file -> Open As -> Source Code if you want to see for yourself). This makes it difficult for some developers who aren’t familiar with XML to decipher what’s what.

尽管我是一个更喜欢在情节提要中工作的人,但我并不希望不断出现合并冲突。 “我选哪一边? —如果您不知道,情节提要是以XML编写的(如果要自己查看,请右键单击情节提要文件-> 打开方式->源代码 )。 对于一些不熟悉XML的开发人员来说,这很难解释什么。

好消息是……在一周结束时,我们……合并冲突。 只有一个。 这是我们的工作方式… (The Good News Is… At The End Of The Week, We Had… One Merge Conflict. Just one. Here’s how we did it…)

One thing you’ll notice throughout this story is you’re going to hear a lot of “we” as opposed to “I”. That’s because teamwork is paramount to avoiding merge conflicts, and we truly worked as a unit. That’s not to say someone wasn’t the lead — a team needs a leader, after all, someone to provide direction.

在整个故事中您会注意到的一件事是,您将听到很多“我们”而不是“我”。 这是因为团队合作对于避免合并冲突至为重要,而我们确实是一个整体。 这并不是说某人不是领导者–团队需要领导者,毕竟,有人需要提供指导。

When I say we had one merge conflict related to storyboards, I don’t mean one merge conflict that we couldn’t figure out. I mean one merge conflict. Period. We had more merge conflicts related to what I refer to as “greedy” lines of code. That is to say lines of code we don’t agree with others on, and change or lines we change to shortcut something for our own development experience and forget to change back before merging into a common branch.

当我说我们有一个与情节提要相关的合并冲突时,我并不是说我们无法弄清一个合并冲突。 我的意思是合并冲突。 期。 与我所说的“贪婪”代码行有关的合并冲突更多。 就是说,我们不同意的代码行,或更改或更改我们的行来为自己的开发经验捷径,而在合并到公共分支之前忘了更改。

每个开发人员都有自己的分镜脚本,每个开发人员都有自己的分支 (Each Developer Gets Their Own Storyboard, Each Developer Gets Their Own Branch)

The size of the storyboards is up to you and your team, but the less that’s going on in each storyboard, the less of a chance there is for a merge conflict. Two of our storyboards only had one View Controller each!

故事板的大小取决于您和您的团队,但是每个故事板中发生的事件越少,合并冲突的机会就越少。 我们的两个情节提要板每个只有一个View Controller!

We may have gone a little overboard with branches, but the strategy worked. We had a master branch, a common develop branch, and each of us had personal branches. I organized my personal branches by feature, some went by day, some seemed to have no coherent strategy for their personal branch strategy. One thing we all agreed on was that the common branches needed to remain as clean and up to date as possible.

我们可能在分支机构方面有些过分,但是该策略有效。 我们有一个主分支,一个公共开发分支,每个人都有个人分支。 我按功能组织了我的个人分支机构,有的是日常工作,有的似乎对其个人分支策略没有统一的策略。 我们都同意的一件事是,公共分支机构需要保持尽可能干净和最新的状态。

We each picked an MVP feature to own. None of the MVP features resided in just one storyboard, so occasionally, it was necessary to delve into someone else’s storyboard file. That said, each file had an “owner”. This person was responsible for knowing what should be going on with that storyboard. That doesn’t mean whatever they said was what happened, it just means that was the point of contact for working in that file.

我们每个人都拥有一个MVP功能。 MVP功能没有一个驻留在一个情节提要中,因此偶尔需要深入研究其他人的情节提要文件。 也就是说,每个文件都有一个“所有者”。 此人负责了解该故事板应如何处理。 这并不意味着他们说的是发生了什么,仅意味着这是处理该文件的联系点。

Image for post

So if Developer A wanted to work in Developer B’s storyboard file, Developer A would shoot them a message on Slack, and say “Hey, I’m working on feature X, and I need to work in your storyboard file. Is that ok?” Then they would wait for Developer B to respond before even starting to work in the storyboard file in their own branch.

因此,如果开发人员A要使用开发人员B的情节提要文件,则开发人员A会在Slack上向他们发送一条消息,然后说:“嘿,我正在使用功能X,我需要处理您的情节提要文件。 那样行吗?” 然后,他们将等待开发人员B响应,甚至开始在自己分支的情节提要文件中工作。

This is key takeaway number 1. Developer B owns the file and should know if Developer C is working on it (or obviously if they’re working on it). They can then let Developer A know to hold off because someone else is making changes to that file.

这是关键要点编号1。开发人员B拥有文件,并且应该知道开发人员C是否正在处理该文件(或者显然他们是否正在处理该文件)。 然后他们可以让开发人员A知道推迟执行,因为其他人正在对该文件进行更改。

Let’s say Developer C was working on this particular storyboard file at the time. When they’re done, what they’re going to do is commit their work, pull down from the main develop branch, handle any conflicts (if there were any) in their own branch, then push up to the common develop branch. If there were any question whatsoever about what line of code to pick in a conflict, a meeting would be held between any involved parties, but normally we’d already have it figured out beforehand because we talked about it.

假设开发人员C当时正在处理此特定的故事板文件。 完成后,他们要做的是提交工作,从主开发分支中撤出,在自己的分支中处理任何冲突(如果有),然后向上推进到通用开发分支。 如果对在冲突中选择哪种代码行存有任何疑问,将在任何相关方之间举行会议,但是通常我们已经事先弄清楚了,因为我们已经讨论过了。

Before they push up though, they’d let everyone know that their changes were being pushed up to the common develop branch so everyone had an opportunity to review their changes if they wanted to — though we rarely needed to.

但是,在推销之前,他们会让每个人都知道他们的更改已被推到通用开发部门,因此每个人都有机会(如果我们愿意)查看他们的更改-尽管我们很少需要这样做。

At the end of the day, we’d review the common develop branch together and decide if it was clean enough to push up to Master.

归根结底,我们将共同审查通用开发分支,并确定它是否足够干净以提升到Master。

Image for post

You may be wondering, “ if there’s as little as possible going on in each storyboard, and sometimes a storyboard only has 1 View Controller, how do you handle segues?”

Ÿ欧可能会想,“如果有尽量少在各个分镜图下去,有时一个故事板只有1视图控制器,你如何处理塞格斯?”

We didn’t handle any segues programmatically except for a conditionally presented login view. We used Storyboard references for the rest of the project

除了有条件显示的登录视图外,我们没有以编程方式处理任何问题。 我们在项目的其余部分中使用了Storyboard参考

Image for post
An example of a project using Storyboard References
使用情节提要参考的项目示例
Image for post
Image for post
Image for post

清晰的沟通+情节提要参考+合并策略=轻松解决冲突 (Clear Communication + Storyboard References + Merge Policy = Easy Conflict Resolution)

Is all of this necessary to avoid merge conflicts? Honestly, probably not.

所有这些都是必要的,以避免合并冲突吗? 老实说,也许不是。

By communicating clearly, you can avoid merge conflicts before they even start. If everyone knows their role, and no two people have a conflicting role or people who do have conflicting roles discuss who will be owning what, a lot of merge conflicts are prevented.

通过清楚地沟通,您可以避免合并冲突甚至开始。 如果每个人都知道自己的角色,并且没有两个人有冲突的角色,或者确实有冲突的人讨论谁将拥有什么,那么可以避免很多合并冲突。

By using multiple storyboards, and again, each person knowing their role — a lot of conflict is avoided.

通过使用多个情节提要板,每个人都知道自己的角色,避免了很多冲突。

By having a clear merge policy that everyone agrees on and utilizes as it should be, we all have the confidence that what we’re about to push up to a common branch isn’t going to cause catastrophic changes to the project.

通过制定清晰的合并政策,每个人都应同意并利用它,我们所有人都有信心,我们将要推进到一个公共分支的项目不会对项目造成灾难性的变化。

I’m not saying if you do all of these things I mentioned in this article, you won’t have any merge conflicts, but I’m willing to bet you’ll have a whole lot less.

我并不是说,如果您执行了本文中提到的所有这些操作,则不会有任何合并冲突,但是我敢打赌,您的工作量会少很多。

I’d love to hear what you think in the comments.

我很想听听您在评论中的想法。

翻译自: https://medium.com/swlh/avoid-merge-conflicts-storyboard-edition-2a02ceadaf6c

避免代码合并冲突


http://www.taodudu.cc/news/show-8403641.html

相关文章:

  • rest_REST /使用提要发布事件
  • 敏捷场景和情节提要
  • atom创建文件_在PHP中创建Atom提要
  • rss atom_有效的XML,提供更友好的RSS和Atom提要
  • Ajax知识点提要
  • wpf 情节提要有什么用_将情节提要对象连接到代码
  • wordpress本地开发_WordPress提要开发人员指南
  • 电气工程学科规划提要(征求意见稿)
  • 【数据库/MySQL】MySQL三大日志提要
  • WordPress初学者入门教程-RSS提要
  • FPGA 仿真与实际不一样,仿真没有打拍,仿真时钟问题。
  • 【程序设计】Matplotlib运行错误的解决方法
  • 自动化工具-在保留白名单文件的前提下,删除剩余文件
  • Linux Shell 学习笔记二
  • 【Rust 易学教程】学前准备:Cargo, 你好
  • 『亚马逊云科技产品测评』活动征文|基于亚马逊EC2云服务器部署Gogs服务
  • 基于Arduino的GPS与单片机通信 GPS与PC机的通信
  • 企业工业网络搭建
  • C#工业生产MES上位机工具 新能源转子生产线 完整工程代码 串口 RFID通信 PLC
  • 探究MES系统:工业生产数字化转型的必需品
  • Python 在工业生产规划中的应用
  • Ubuntu16配置caffe和faster RCNN
  • [VB.NET]单元七 图形图像处理1
  • 现代opengl 设计入门,画图第一个三角形
  • 一些vbs和bat的小脚本 好戏总是在后面哦 大佬您第一次来吧?是不是都进来看看吧=w=
  • 第N+1次踩坑Caffe小计
  • VB检测硬件信息
  • 【原创】Linux环境下的图形系统和AMD R600显卡编程(10)——R600显卡的3D引擎编程...
  • ubuntu16安装tensorflow gpu加速(包括cuda8及NVIDIA显卡安装)
  • 获取windows显卡使用率,并写入txt文档
  • 这篇关于避免代码合并冲突_避免合并冲突-情节提要版的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



    http://www.chinasem.cn/article/543459

    相关文章

    Python使用python-can实现合并BLF文件

    《Python使用python-can实现合并BLF文件》python-can库是Python生态中专注于CAN总线通信与数据处理的强大工具,本文将使用python-can为BLF文件合并提供高效灵活... 目录一、python-can 库:CAN 数据处理的利器二、BLF 文件合并核心代码解析1. 基础合

    Java中调用数据库存储过程的示例代码

    《Java中调用数据库存储过程的示例代码》本文介绍Java通过JDBC调用数据库存储过程的方法,涵盖参数类型、执行步骤及数据库差异,需注意异常处理与资源管理,以优化性能并实现复杂业务逻辑,感兴趣的朋友... 目录一、存储过程概述二、Java调用存储过程的基本javascript步骤三、Java调用存储过程示

    Visual Studio 2022 编译C++20代码的图文步骤

    《VisualStudio2022编译C++20代码的图文步骤》在VisualStudio中启用C++20import功能,需设置语言标准为ISOC++20,开启扫描源查找模块依赖及实验性标... 默认创建Visual Studio桌面控制台项目代码包含C++20的import方法。右键项目的属性:

    MySQL数据库的内嵌函数和联合查询实例代码

    《MySQL数据库的内嵌函数和联合查询实例代码》联合查询是一种将多个查询结果组合在一起的方法,通常使用UNION、UNIONALL、INTERSECT和EXCEPT关键字,下面:本文主要介绍MyS... 目录一.数据库的内嵌函数1.1聚合函数COUNT([DISTINCT] expr)SUM([DISTIN

    Java实现自定义table宽高的示例代码

    《Java实现自定义table宽高的示例代码》在桌面应用、管理系统乃至报表工具中,表格(JTable)作为最常用的数据展示组件,不仅承载对数据的增删改查,还需要配合布局与视觉需求,而JavaSwing... 目录一、项目背景详细介绍二、项目需求详细介绍三、相关技术详细介绍四、实现思路详细介绍五、完整实现代码

    Go语言代码格式化的技巧分享

    《Go语言代码格式化的技巧分享》在Go语言的开发过程中,代码格式化是一个看似细微却至关重要的环节,良好的代码格式化不仅能提升代码的可读性,还能促进团队协作,减少因代码风格差异引发的问题,Go在代码格式... 目录一、Go 语言代码格式化的重要性二、Go 语言代码格式化工具:gofmt 与 go fmt(一)

    HTML5实现的移动端购物车自动结算功能示例代码

    《HTML5实现的移动端购物车自动结算功能示例代码》本文介绍HTML5实现移动端购物车自动结算,通过WebStorage、事件监听、DOM操作等技术,确保实时更新与数据同步,优化性能及无障碍性,提升用... 目录1. 移动端购物车自动结算概述2. 数据存储与状态保存机制2.1 浏览器端的数据存储方式2.1.

    基于 HTML5 Canvas 实现图片旋转与下载功能(完整代码展示)

    《基于HTML5Canvas实现图片旋转与下载功能(完整代码展示)》本文将深入剖析一段基于HTML5Canvas的代码,该代码实现了图片的旋转(90度和180度)以及旋转后图片的下载... 目录一、引言二、html 结构分析三、css 样式分析四、JavaScript 功能实现一、引言在 Web 开发中,

    Python如何去除图片干扰代码示例

    《Python如何去除图片干扰代码示例》图片降噪是一个广泛应用于图像处理的技术,可以提高图像质量和相关应用的效果,:本文主要介绍Python如何去除图片干扰的相关资料,文中通过代码介绍的非常详细,... 目录一、噪声去除1. 高斯噪声(像素值正态分布扰动)2. 椒盐噪声(随机黑白像素点)3. 复杂噪声(如伪

    Java Spring ApplicationEvent 代码示例解析

    《JavaSpringApplicationEvent代码示例解析》本文解析了Spring事件机制,涵盖核心概念(发布-订阅/观察者模式)、代码实现(事件定义、发布、监听)及高级应用(异步处理、... 目录一、Spring 事件机制核心概念1. 事件驱动架构模型2. 核心组件二、代码示例解析1. 事件定义