News for hackers. Stuff that matters.
Re:Trunk-Based Development by nhumrich on Sunday January 29, 2017 @10:29AM (#13514492)
You must not understand what CD really means then, because full CD is impossible with feature branches. CD means every commit gets built and delivered all the way prod if it passes all tests. The key word is "continuous" as in, every single commit. Branch based means you only deliver once you merge. Merging is a manual step, so your not doing full-CD. The merge is basically your "trigger" and your doing "delivery when I am ready"
Re:Trunk-Based Development by joneholland on Sunday January 29, 2017 @10:32AM (#13514512)
We deploy every commit in master and use short lived feature branches and pull requests.

I would still consider this continuous delivery.

Re:Trunk-Based Development by hashkb on Sunday January 29, 2017 @10:36AM (#13514538)
Yes, this is what I think of as CD. Hiding work that isn't ready (or work that may never make it in front of users) behind a flag on prod sounds like extra work for no gain, to me.
Re:Trunk-Based Development by nhumrich on Sunday January 29, 2017 @10:43AM (#13514569)
The gain is early integration. If you have more than one branch going on at the same time, they can diverge quite significantly, and merging can cause bugs, or sometimes more work. If you only ever have one feature branch at a time, you might as well be doing trunk based with manual deploys to prod.
Re:Trunk-Based Development by hashkb on Sunday January 29, 2017 @10:49AM (#13514607)
Rebase early and often and this isn't an issue. Some see this as a chore, but I view it as taking advantage of the tool's power. You resolve the same set of conflicts as you would merging, but (as you say) earlier.

Edit: I don't think anyone was trying to imply a single allowed feature branch at a time; we can probably all easily agree that's basically no different than working on master.

Re:Trunk-Based Development by nhumrich on Sunday January 29, 2017 @10:58AM (#13514667)
Yes, rebase early and often works great. But if your branch includes a major refactor, your going to find yourself editing others code to get your rebase to work. That just increases your own scope. But yes, rebase often is often a very viable strategy. In practice though, I find very few that actually do it because it becomes painful when your branch lives too long simply because business isn't ready to ship something
Re:Trunk-Based Development by notarealdoctor on Sunday January 29, 2017 @11:15AM (#13514796)
Rebase is evil.
Re:Trunk-Based Development by angry_octet on Monday January 30, 2017 @07:40AM (#13520670)
Can you explain how a repo with dozens of feature flags triggering greatly different code paths, and invisible to the source code management system, is an improvement on feature branching?

How would I use git bisect with a bunch of flags to a composite of build systems?

Re:Trunk-Based Development by nhumrich on Sunday January 29, 2017 @10:39AM (#13514553)
By "short lived", how short lived? Is the branch only for one developer? Or is it shared? How do you enforce "short lived"? If the branches are not collaborated on, you might be doing trunk based without realizing it.
Re:Trunk-Based Development by joneholland on Sunday January 29, 2017 @11:05AM (#13514721)
Holy shit. Just admit that TBD is a fad instead of trying to define every successful methodology into it.

Branches tend to be solo devs and tend to live less than a day. But nobody develops in master. It's actually locked down to just merges from pull requests.

Re:Trunk-Based Development by hashkb on Sunday January 29, 2017 @10:45AM (#13514579)
>you might be doing trunk based without realizing it.

Then trunk based is poorly named and apt to start a fruitless holy war. Nobody wants too many people on a feature branch, or for one to live too long. (But it happens, like rebranding an entire app or rewriting all the auth code, which is a good thing to be able to do. )

Is there a threshold of time/collaboration that makes it not-CD?

Re:Trunk-Based Development by nhumrich on Sunday January 29, 2017 @10:52AM (#13514622)
My point is that the article says that branches for the purpose of WIP and code review is OK as long as you don't share the branches. Trunk based is trunk "based" as in your git "base". Your based on trunk, not a branch. It's not called "commit directly to trunk only" development.
Re:Trunk-Based Development by clusmore on Sunday January 29, 2017 @05:50PM (#13517267)
Why do we have this obsession with religiously following methodologies rather than focusing on the goals they attempt to achieve?

>CD means every commit gets built and delivered all the way prod if it passes all tests. The key word is "continuous" as in, every single commit.

In my experience one of two things happen with this approach. Either the functionality is hidden behind flags and intentionally doesn't impact prod, in which case there's no point in it being there. Or you only commit when the feature is complete, which is effectively the same "delivery when I am ready" as with merges.

The goal of CD is not to push every commit to prod -- this is merely the process. If the goal achieved by the process of pushing every commit to prod can be achieved via a different process, we shouldn't be so quick to criticise the other process. We should instead discuss the tradeoffs between the two, because in reality there is no best option, only tradeoffs.

Re:Trunk-Based Development by hamandcheese on Sunday January 29, 2017 @11:11AM (#13514768)
How does code review fit in to such a workflow? That's also a manual step, but one I and many others consider good and necessary.
Re:Trunk-Based Development by nhumrich on Sunday January 29, 2017 @11:14AM (#13514789)
According to the article, and my personal experience, you don't commit directly to trunk. Trunk based means that you don't "collaborate" on a branch. So you write your code based off of trunk, once it's ready you commit in a branch, simply for purpose of code review. It gets reviewed, and probably runs an automated build. Once both pass, you merge and it goes through your deployment pipeline. Yes the merge/code review are manual, but your not merging to say, "I'm ready for this feature to be on prod now" your simply saying it looks good. The biggest difference is that if developer B wants to use your new method, he has to wait for it to be on trunk rather than branching off of your branch, etc.
Re:Trunk-Based Development by gaastonsr on Sunday January 29, 2017 @12:30PM (#13515302)
It really is the same. He very much could branched off your branch and once merged just start syncing with master. And I see that better than waiting for your PR to be merged.
Re:Trunk-Based Development by biehl on Sunday January 29, 2017 @01:39PM (#13515782)
So, like squashed feature branches?
Re:Trunk-Based Development by jessaustin on Sunday January 29, 2017 @11:00AM (#13514682)
So write the tests first; isn't that what we're supposed to do anyway? That way the branch doesn't move to prod on commit, because it isn't passing the tests yet.

BTW "commit" is also a "manual step".

Re:Trunk-Based Development by nhumrich on Sunday January 29, 2017 @11:10AM (#13514761)
I'm kind of lost by your comment.

> Write tests first

What does this have to do with TBD vs branch based? Should be that way either way. In fact TBD breaks down if you don't write your tests.

> A branch doesn't move to prod on a commit

Are you saying your shipping branches to prod regardless as to if it's on trunk or not?

Or perhaps your whole comment is just saying how TBD is supposed to work and your agreeing with me?

Re:Trunk-Based Development by jessaustin on Sunday January 29, 2017 @11:22AM (#13514829)
Ah, never mind, I was confused.
Re:Trunk-Based Development by hashkb on Sunday January 29, 2017 @10:39AM (#13514550)
Anyway the article mentions Continuous Delivery, not Continuous Deployment. Neither means what you say, according to a Puppet Labs blog post, but the latter sometimes does to some people. But that's not what the article says, and so it's not what I'm countering in my comment.
Re:Trunk-Based Development by geocar on Sunday January 29, 2017 @10:31AM (#13514505)
CD is not impossible with feature branches.

My live system looks up the branch name in the URL or in a (signed) cookie and checks out the appropriate branch then and there. This is possible because my development system is integrated into my live system.

Re:Trunk-Based Development by perlgeek on Sunday January 29, 2017 @10:35AM (#13514534)
If push to two feature branches, A and B, which one lands in production? both? if so, how? or the last one you pushed? Or the one that finished its build later?
Re:Trunk-Based Development by geocar on Sunday January 29, 2017 @10:47AM (#13514600)
My specific implementation uses the git commit id. Only the tool for signing cookies actually knows about branches.
Re:Trunk-Based Development by nhumrich on Sunday January 29, 2017 @10:35AM (#13514526)
So your delivering all commits on all branches to prod? That sounds hairy
Re:Trunk-Based Development by geocar on Sunday January 29, 2017 @10:52AM (#13514618)
How many commits do you do in a day?

The hardest part is figuring out how to do this without a map.

Re:Trunk-Based Development by nhumrich on Sunday January 29, 2017 @11:00AM (#13514692)
On a big team, potentially 100's. But if your delivering all commits regardless of branches, why even have branches?
Re:Trunk-Based Development by geocar on Sunday January 29, 2017 @11:36AM (#13514910)
Because they're still useful? A branch is a useful tool for the developers who know their development process includes pushing to and pulling from branch "xyz" while they develop whatever feature they're tasked to develop. That they don't solve every problem doesn't bother me.
Re:Trunk-Based Development by notarealdoctor on Sunday January 29, 2017 @11:13AM (#13514786)
> CD means every commit gets built and delivered all the way prod if it passes all tests.

I always wondered why a company would allow code to go straight to production, live, affecting customers, without a human giving the OK to release.

Re:Trunk-Based Development by dpark on Sunday January 29, 2017 @12:29PM (#13515288)
Because you should be able to automate that OK. There is generally no verification that a human can do on a computer system that cannot be automated. The only question is whether you're willing to invest enough to fully automate the go/no go decision.
Re:Trunk-Based Development by alkonaut on Sunday January 29, 2017 @04:40PM (#13516865)
So the person that has an opportunity to misunderstand the specification (the developer) is given the task of writing the tests to OK them, even though the test is based on the same misunderstanding?

That's terrifying. After 15 years in the same field I still don't have half the business knowledge as those writing the specs I implement. I would never ever want a nontrivial feature I wrote to hit a customer without manual testing by an expert in the area.

Re:Trunk-Based Development by dpark on Sunday January 29, 2017 @05:16PM (#13517091)
Where do you work that software engineers write code and then hand off their code to non-software-engineer "experts" for testing? That sounds like a really broken process.
Re:Trunk-Based Development by alkonaut on Sunday January 29, 2017 @05:58PM (#13517298)
I implement a program used by structural engineers. So basically the user is a structural engineer and I'm a software engineer. They typically find nuances of program behavior that I never thought of because I'm not an expert in structural engineering.

I think the same would be true if I made a trading platform, an x-ray machine UI or whatever. When the expert uses it to do what they are experts in, they will invariably find issues (bugs, omissions, simple improvements) that weren't obvious to begin with.

One can argue that if the spec was 100% perfect then I can always test it myself and hopefully even do so with automated tests - but I have never seen a spec like that (perhaps more importantly - if you have in house "end user like testers" for expert software then it's likely more economical to have expert testing and iterate than spend the time on more detailed upfront specs)

Re:Trunk-Based Development by dpark on Sunday January 29, 2017 @06:14PM (#13517401)
For a huge chunk of the industry, the consequences of broken software are limited to annoyed users and lost revenue. In cases like that, the benefits of shipping quickly often outweigh the value of "expert testing". Further, in many cases the software engineers have as much expertise as the customers, making the handoff for testing simply a way of abdicating responsibility for quality.

For your structural engineering example, I'm not sure you couldn't benefit from continuous, automated release. If the only risks are missing "bugs, omissions, simple improvements", you could fix those in the next release (which could be the next day). Delaying valuable features so that the customers can tell you that a tweak would be even better doesn't seem to be a net gain. The only reason to hold the release would be if you're catching dangerous bugs this way.

You could also build new features under a "flighting" system (pick your favorite name; there are several) where you don't expose new features to most customers until they are "baked" with your internal customers and/or customers who've opted into early features. This allows you to release constantly so your customers get bug fixes quickly and features as soon as they're ready without the complexity of separate branches and versions maintained in parallel.

Re:Trunk-Based Development by alkonaut on Sunday January 29, 2017 @06:37PM (#13517528)
We can't ship often for the same reason all of the big and complex software packages (IDE:s, spreadsheets etc) on your machine don't ship very often. Documentation needs to be produced and specific to a version. The application needs to be a consistent whole with UI changes, file format changes etc not happening too often.

I don't think it will ever be a good practice for large complex apps to change a tiny bit every day (Facebook might be challenging my theory, but their app is relatively simple they don't produce training docs, and most importantly they don't have to have the latest app compatible with all Facebook data from the beginning of time - instead they keep their data on their servers and modify it to the latest programs when necessary)

I agree you could have more feature gating, but large backwards compatible file formats are a complex business already with 10 releases over a decade - I can only imagine what it would be like supporting reference-rich documents with many more releases and the additional complexity of the sender and receiver having to agree on a feature set (unless you make the feature set/flight implicit from the data - but that's a new kind of headache). We already have tons of code in new versions dealing with loading malformed data in old formats because of bugs closed years ago! Every document we wrote we must also be able to read.

Lots of challenges in this area, but they are pretty fun to work with tbh.

Re:Trunk-Based Development by dpark on Sunday January 29, 2017 @10:56PM (#13518516)
> We can't ship often for the same reason all of the big and complex software packages (IDE:s, spreadsheets etc) on your machine don't ship very often. Documentation needs to be produced and specific to a version. The application needs to be a consistent whole with UI changes, file format changes etc not happening too often.

The only reasons Excel and Visual Studio don't update constantly are 1) the update mechanism is too heavy with gigabytes packaged into an MSI, 2) it's easier to sell licenses with big updates, and 3) inertia.

With people migrating to Office 365, I wouldn't be surprised if the ship cadence of Excel (etc.) become more service-like, with frequent feature releases and only big redesigns or massive features getting released as "major version" releases.

(Disclosure: I work for Microsoft. These are my opinions and not based on any inside knowledge of Excel or Visual Studio dev/release processes.)

The issues around UI, documentation, etc are solvable. You can build and release features regularly without changing the UI significantly. The UI as a whole should be consistent but small tweaks are fine and big changes can be built behind a feature flag and left dormant until the next "big" release if necessary.

Documentation doesn't need to be locked to a specific version, or to the extent it does, you could automate that. From version to version, the changes that impact existing documentation are minimal. So your doc system needs to know how to render V1 and V2 and understand the delta between the two. Not free but not overwhelming either.

With all that said, I understand that sometimes "major version" releases and the associated "big bang" testing and signoff and release can make sense. But it's rare that continual release cannot work.

> I don't think it will ever be a good practice for large complex apps to change a tiny bit every day (Facebook might be challenging my theory, but their app is relatively simple they don't produce training docs, and most importantly they don't have to have the latest app compatible with all Facebook data from the beginning of time - instead they keep their data on their servers and modify it to the latest programs when necessary)

Chrome is getting close to this. They release major versions on something like a monthly cadence and smaller updates more often.

Obviously, the closer you get to a service model like Facebook, the easier and more appropriate it will be to ship updates very frequently. Over time, the number of devs involved in projects like this seems to be trending distinctly upwards, though. I wonder in 10 years what percentage of software will be shipped in a way that looks like "shrink-wrapped" software.

> I agree you could have more feature gating, but large backwards compatible file formats are a complex business already with 10 releases over a decade - I can only imagine what it would be like supporting reference-rich documents with many more releases and the additional complexity of the sender and receiver having to agree on a feature set (unless you make the feature set/flight implicit from the data - but that's a new kind of headache). We already have tons of code in new versions dealing with loading malformed data in old formats because of bugs closed years ago! Every document we wrote we must also be able to read.

I would think that binary formats would be pretty stable even if you released very frequently. I don't mean that it would naturally happen. I mean that it should probably be mandated. You shouldn't need to modify the binary format constantly in order for other work to happen. It would be a maintenance nightmare if every little release modified the file format. But this is kind of like shipping a binary client. You wouldn't ship the client as often specifically because of the maintenance cost (namely compatibility testing). Obviously if you couldn't do any work without changing the file format, then this would become problematic. But then I would wonder why your file format is so brittle and so tightly coupled with the rest of the app, and if I wanted to release rapidly, I'd invest first in fixing that.

Re:Trunk-Based Development by UK-AL on Monday January 30, 2017 @05:49AM (#13520026)
What do you think unpushed/uncommited changes on your local machine. They are basically feature branches.