When it comes to choosing web development technologies, we now have more options than ever. And while that’s a good thing, it also poses a problem. Answering the question, “What is the ideal technology for this new project?” is not as easy as it used to be. In this post, I briefly highlight the most popular full-stack web frameworks, and why you might want to choose each of them.Continue reading “Modern Full-Stack Web Frameworks: When to use What and Why”
Category: Ruby on Rails
GitOps with GitHub Actions
Today we’re going to talk about GitOps with GitHub Actions, including an example of this workflow:
A developer team creates a new branch, with a Pull Request (PR), which triggers a GitHub Action, which runs AWS CodeDeploy, which deploys the application code update from GitHub to a web application on an Amazon EC2 instance.
Originally presented at Beezwax’s internal “Developer Show & Share”, this video presentation covers “GitOps with GitHub Actions” by Victor Olivo, Beezwax DevOps Engineer.Continue reading “GitOps with GitHub Actions”
The Benefits of Automated Testing
Software changes over time. Your company’s web site this year does things you had no idea you needed two years ago. How can we keep the cost of change manageable?
Automated testing is one way. Especially for large software projects, the practice of automated testing can dramatically reduce the cost of adapting software to new business necessities.
OOP Fundamentals: Quick and Dirty Guide to Testing
There are entire books written on testing. And it surely feels more an art than a science. My approach is similar to Kent Beck’s:
I get paid for code that works, not for tests, so my philosophy is to test as little as possible to reach a given level of confidence (I suspect this level of confidence is high compared to industry standards, but that could just be hubris). If I don’t typically make a kind of mistake (like setting the wrong variables in a constructor), I don’t test for it. I do tend to make sense of test errors, so I’m extra careful when I have logic with complicated conditionals. When coding on a team, I modify my strategy to carefully test code that we, collectively, tend to get wrong.https://stackoverflow.com/a/153565/1015566
He goes on to add that different people will have different strategies and, at the end of the day, you just have to do what works best for you and your team. Extremely practical, and the approach I personally follow.
This won’t be a detailed post on every possible topic on tests and testing in Object-oriented Programming (OOP). There are many books about that already. Instead, this article will cover the basics of testing, so you understand how and why we test, and you can adapt it to your own needs.Continue reading “OOP Fundamentals: Quick and Dirty Guide to Testing”
Integrating FileMaker’s Data API and Ruby with the fmrest-ruby gem
We often work on projects that intersect two technologies near and dear to us: FileMaker and Ruby. This allows us to build robust web applications in Ruby on Rails, integrated with data sources from FileMaker solutions. When Claris introduced the FileMaker Data API we were naturally curious to try it out. At the time there was no off-the-shelf Ruby library for us to simply
gem install, so we decided to roll up our sleeves and build one. Thus, fmrest-ruby was born.
This article will walk you through setting up and using fmrest-ruby in a Ruby on Rails project. Some level of familiarity with Ruby/Rails and FileMaker’s Data API is advised, although much of the content covered here is applicable to any Ruby project, Rails or not.Continue reading “Integrating FileMaker’s Data API and Ruby with the fmrest-ruby gem”
OOP Fundamentals: The Decorator Pattern
The decorator pattern is one of my favorite patterns. It is simple, extensible and powerful. It feels like it follows the essence of object oriented programming beautifully. Sadly though, it is also easy to be misused or misunderstood. So, in this post I will show you the essence of the decorator pattern, illustrated with a few examples.Continue reading “OOP Fundamentals: The Decorator Pattern”
OOP Fundamentals: The Dependency Inversion Principle
The dependency inversion principle is one of the cornerstones of object-oriented programming. Without it, there is no object-oriented design. It’s that important.Continue reading “OOP Fundamentals: The Dependency Inversion Principle”
Something out of Nothing: Null Object Pattern
What is nothing?
undefined? A vast void of emptiness that fills your soul with dread? Oh sorry, that’s just my stomach.
We often think of nothing as… well, nothing. It’s when something doesn’t exist and therefore cannot be interacted with. So in our code, we try account for having nothing. No
User? No problem.
Ruby’s Safe Navigation Operator &. and is it a Code Smell?
Ruby devs are probably all too familiar with seeing this error:
NoMethodError (undefined method `foo' for nil:NilClass)
Most of the time, it’s probably due to a typo, but every now and then we end up having to do something like:
defined?(bar) && bar.foo # returns nil if bar is nil
If you’re on Rails, or are using ActiveSupport, you can use
Common Code Smells in OOP
Over years of reviewing Ruby code, the same things tend to come up over and over. In this post, I’d like to address some of the most common code smells I find when reviewing OOP code (and Ruby code in particular).Continue reading “Common Code Smells in OOP”
A Ruby-ish Xmas
Ruby-ish, rubbish… Get it? Anyways, not like Ruby-ish means bad! Quite the opposite!
It’s the day after Xmas and because Ruby is awesome and delivered 2.6.0, we’ll get to play with some of our new Xmas gifts:
ePubber – generating ePub files with Ruby
ePub is a digital book format which is pretty common nowadays. It’s supported natively by Windows and Android and it’s one of the official formats for digital books in the Apple Books store.
In this post I’ll talk about generating ePub files with Ruby and how to painlessly integrate this feature to your application. I’ll be using a Ruby gem I created called ePubber, which I created to help manage ePub content.
Continue reading “ePubber – generating ePub files with Ruby”
Writing a Markdown Compiler – Part 3
Have you ever wanted to make your own programming language? Maybe a template engine? A JSON parser? If you have ever built any of those, you might have noticed it’s not exactly easy to get started. We’d like to help with that.
Welcome to Part 3, the final in this series on Writing a Markdown Compiler!
Continue reading “Writing a Markdown Compiler – Part 3”
Writing a Markdown Compiler – Part 2
Hello, and welcome to the second part of the Writing a Markdown Compiler series! In case you’ve need it, here is Part 1, Intro/Tokenizer and Part 3, Code Generation.
In this part we’ll talk about the second step in compiling: Parsing – also known as Syntactic Analysis. This part has a bit more theory, so it might take some time to digest. Sip some coffee, relax, take yout time, and as long as you don’t rush it you’ll find it’s not hard at all. 🙂
Writing a Markdown Compiler – Part 1
Have you ever wanted to make your own programming language? Maybe a template engine? A JSON parser? If you have ever built any of those, you might have noticed it’s not exactly easy to get started. There are a lot of concepts to digest before you get going. That’s why lots of devs just give up. We’d like to help with that.
Writing DSLs: The joy of human consumable APIs
A well-designed Domain Specific Language (DSL) can help you be more productive as a developer, thus making you, your team and your clients happier. In this post, I’ll guide you through the design and creation of a simple DSL to create EPUB files. We’ll start with a regular API and refactoring until we get to a DSL solution.
Continue reading “Writing DSLs: The joy of human consumable APIs”
Avoid nil-checks. Code confidently. Be happy.
This post is about pretty code (with examples in Ruby), plus how to get nil out of the way and be more confident.
Does this code look familiar?
user && user.ask_for_email
Continue reading “Avoid nil-checks. Code confidently. Be happy.”
What is Dependency Injection
If you are a developer, chances are very good that you know what Object-Oriented (OO) code is. You might have also heard about OO Design Patterns, things like single responsibilities, decoupled code, and my subject here: Dependency Injection (DI).