Skip to content
0:00 / 0:00

#boundaries#functionalcoreimperativeshell#tdd

Ruby Conf 12 - Boundaries by Gary Bernhardt

Confreaks

42K subscribers • 85 videos on Hallway • Conference channel

YouTube
  • Recommended by 8 people: 8 on Hacker News.
  • A classic. People kept recommending it from 2015 to 2021.
  • Presented by Gary Bernhardt
  • An opinion. It argues one side of a question engineers disagree on.

Intermediate. Assumes working knowledge.

57K views13 years ago8 recommendations

Software designTools and practiceSoftware architectureTestingFunctional programming

Gary Bernhardt explores software boundaries, comparing isolation testing with mocking against a functional core and imperative shell architecture.

Some people test in isolation, mocking everything except the class under test. We'll start with that idea, quickly examine the drawbacks, and ask how we might fix them without losing the benefits. This will send us on a trip through behavior vs. data, mutation vs. immutability, interface vs. data dependencies, how data shape affords parallelism, and what a system optimizing each of these for natural isolation might look like. Help us caption & translate this video! amara.org/v/FGeb/

Why it's here

8 people recommend this

What people say. Highly recommended for its influential concept of functional core, imperative shell and its practical approach to unit testing.

pmarreckon Hacker News • Recommends

On “Have Software Developers Given Up?”

…d, extremely hazardous risks to save a little time, like reading your phone while driving" I've not found a programming task in at least 5 years that wasn't waaaay better-written when done via TDD. Some things, like IO, can be a challenge to unit-test, but that's why we have great ideas to solve that like Gary Bernhardt's awesome "Boundaries" talk link to this video…

dnauticson Hacker News • Recommends

On “Elixir v1.10”

if you are a rubyist, I can't more strongly recommend watching this video, which has nothing to do directly with Elixir (in fact it precedes elixir by a couple of years) but if the topics that Bernhart (of wat fame) brings up resonate with you, then you will really like Elixir. link to this video

dnauticson Hacker News • Recommends

On “I Don't Use Classes”

…hat Alan Kay imagined it, than what the OP and GP talk about, and I don't consider that to be OO in the contemporary, colloquial sense of "everything that happened after Bjarne Soustroup invented C++" I highly recommend this video for a more philosophical take on how to do "impure FP" without OO that is informed by a decade of industry experience: link to this video which is by Gary Bernhardt (of WAT fame) > I look for the right tool for the job rather than some idealistic purity This is all about right tool for the job. IMO, FP code is easier to read, easier to reason about,…

AaronFrielon Hacker News • Recommends

On “A Theory of Software Architecture”

…makes it so easy to mutate in place that it's known for libraries that "monkey patch" base classes and can change the definition of operators and functions at runtime! Fantastic talk, fantastic presentation. I now share it with my new engineering colleagues too. Here's the talk where he talks about imperative shell, functional core, "Boundaries": link to this video…

zachroseon Hacker News • Recommends

On “Ask HN: Front-end “design patterns”?”

Forgive me for being vague and brief, but I've been trying to test my UIs for the last year or so and this is what I've come up with. I've found the ideas in Gary Bernhardt's talk, Boundaries (1), to be very helpful in figuring out how to test interactive web UIs. The basic idea is that DOM manipulation can be an "imperative shell" with as little logic and as few conditionals as possible. Derive the state of your UI component with separate functions and methods that return plain values (a "functional core"), and write tests for those because testing for values is easy. So no, don't test for the presence of classes and IDs. Test your imperative shell once, maybe even manually or with an integ…

lectrickon Hacker News • Recommends

On “The microservices cargo cult”

Many of the advantages of microservices can be achieved by refactoring your monolith code to be less monolithic. I would suggest using functional styles wherever possible, plenty of isolated unit testable code, and a hexagonal architecture link that pushes all the I/O, mutation, side effects, etc. to the very boundary of your code. Also see Gary Bernhardt's "Boundaries" talk for more interesting thought in that vein link to this video

itsmemattchungon Hacker News • Recommends

On “How to avoid brittle code”

I recommend watching this talk: link to this video Both, unit and integration tests, are imperative. Integration tests point in the general direction of where an issue might be but unit tests are more precise.

magicpat2010on Hacker News • Recommends

On “Ask HN: Organization of Layered Software?”

This isn't an article but reading your post reminds me of the presentation by Gary Bernhardt titled "Boundaries", link to this video I would be interested in looking at the article(s) if you can find them again.

aszenon Hacker News • Recommends

On “Prefer Fakes over Mocks”

…calling other functions and doesn't need to be tested. Several other ideas that relate to this are hexagonal architecture, Domain Driver Design, clean architecture and functional core with an imperative shell. Some resources to further explore these ideas: Clean Architecture in Python - link Why integrated tests are a scam - link Boundaries - link to this video…

dnauticson Hacker News • Recommends

On “Onboarding to Elixir”

> Jose has really thread a needle with Elixir I feel. There was kind of something in the zeitgeist ready for this... This was a video by Gary Bernhardt in 2012 (that's like, Elixir -2 years?). I've queued it up to where he talks about basically wanting to go live on a cruise ship, fork rubinius, and rebuild ruby on top of erlang. The main chunk of the talk is about the software pattern that Phoenix and Elixir really tries to get you to adopt. link to this video

u/dnauticsin r/elixir • Mentions

On “Choosing between Akka and Elixir”

…sks, which are implemented as actors under the hood in the BEAM (and honestly async-as-wrapped-by-actors is probably the best choice in the bestiary of async strategies, just as "webserver-wrapped-in-actors" is the best choice in the bestiary of webserver strategies ;-) If you want to get philosophical about it, I strongly recommend this video: [video which is by Gary Bernhardt (of WAT fame) which outlines, from years of experience, what are best practices around state and why state is hard problem. The video precedes Elixir by about 2 years but it's almost as if Elixir was built around the precepts of it. \> hot-code swap You probably don't need this, the use case (on-metal deploymen…

u/Inconstant_Mooin r/functionalprogramming • Mentions

On “Functional State Management”

This. It's called "functional core/imperative shell". You *ex*capsulate the impurities by putting them all as close to the root of the call tree as they can go, and then everything else is nice clean pure functions.

u/philly_fan_in_chiin r/elixir • Mentions

On “State of `Elixir` ecosystem?”

I haven't gone through this book, but it's from plataformatec, so it's going to be excellent. The mental shift you need to have is the mantra "data > functions > macros" that the Lisp community has. Rather than structuring your application around your database, your database exists to support your application logic, and the data is the king for interacting with your ACTUAL application. Ideally, you should be able to unit test your entire code base by just shoving structs into all your business logic, with it not ever having to touch the database; it should be an implementation detail that you should be able to swap to flat files or whatever as you discover your app boundaries. Look into s…

u/dnauticsin r/elixir • Mentions

On “Elixir seems cool. How would I go about learning it as my first ever functional programming language?”

…k for software documentation). If you're looking for a place to start, and have some $ to drop, I strongly recommend "programming phoenix" by geoffrey lessel with is fantastic soup-to-nuts on how to build a wep app. Since you have some webdev experience If you want something fun to pique your interest, I recommend playing with Phoenix LiveView ([video 1. install elixir: https://elixir-lang.org/install.html 2. follow the getting started in phoenix guides: https://hexdocs.pm/phoenix/installation.html#content 3. follow these instructions line by line: https://hexdocs.pm/phoenix\_live\_view/installation.html#content Not directly related to the above, I also recommend watching this video…

jrvarela56on Hacker News • Mentions

On “Total Functional Programming (2004) [pdf]”

This talk 1 made me conclude something along these lines. You need side-effects to make anything useful, just make sure they're segregated in a specific place in your program. This makes it easier to make most of the program pure and make it clear where the dangerous stuff happens. 1 Boundaries by Gary B. from Destroy All Software link to this video

maxbondon Hacker News • Mentions

On “The two factions of C++”

…n was impossible to test. In general, side effects and global state are the enemies of testability.) You end up with functions that take a lot of arguments (10+), which can feel wrong at first, but it's worth it, and IDEs help enormously. This pattern is called dependency injection. link See also, the "functional core, imperative shell" pattern. link to this video…