RSSAmplifier

Blog

The Coded Self

thecodedself.comRSS feed ↗18 posts

Latest posts

Perfect is the Enemy of the Good

How the Wrong Architecture Can Cripple Development A couple of years ago, I was working on a side project with a few friends. We thought that it would be the next big thing. We put our collective best efforts into it; I worked long, hard hours fleshing out the scaffolding of the perfect architecture. Little did I know that my effort would doom the project to join the abyss of failed projects as…

UI Testing the Clean Way

I write software, and sometimes I write bugs. But, when I do, I catch them early with testing. I do manual tests before I commit, I write unit tests as I write my code. Lately, I’ve also been getting into writing UI tests. One critique of UI testing is how messy and brittle it can be. Building the tests can be complicated. You might spend hours on a test just for a design to change that breaks the…

Creating a macOS Action (Gear) Button Programmatically in Swift

For a list of actions on macOS, the standard control is an action button as defined in the macOS Human Interface Guidelines . Here’s the definition from that page: An action button (often referred to as an action menu) is a specific type of pull-down button that operates like a contextual menu, without the disadvantage of being hidden, providing access to app-wide or table-specific commands. An…

Autoresizing Masks and You

You’re an Autolayout Wizard. You know Interface Builder like the back of your hand. Then, one day, you create a simple UIView, add it as a subview with some elegantly crafted constraints, and.. it blows up in your face. What gives? Take a look at this code example that tries to create a UILabel and center it in the view. let centerLabel = UILabel() centerLabel.text = "Perfectly centered!"…

Functions Deserve Injection, Too

Lately, I’ve been taking advantage of Swift’s functional abilities where it makes sense to help me write concise and clear code that’s easy to test. I’d like to share one technique that has helped me to eliminate repetition and breakages of encapsulation in tests: function injection . In traditional dependency injection , an object that is dependended on is passed to the method that depends on it.…

Staying Sane with Cuckoo and Code Generation

Please note that this post won’t go over the basics of Cuckoo, as the README provides a great introduction to the library. Do you write unit tests? You should. Writing mocks for my tests seemed to be a lot easier in Objective-C. OCMock makes great use of Objective-C’s dynamic nature and it makes mocking a breeze. However, the OCMock website has this to say : Disappointing. Accurate. Alright, off…

Lessons learned from Systems Thinking

I was lucky enough to attend my first meetup in Poland this month: Agile Poznan . The talk was on Systems Thinking , a topic that bored me in college but fascinated me when I entered the real world. Applying systems thinking can reveal the origins behind events and behaviors we see every day. Using this clarity can make you a better software developer, and a better asset to your organisation in…

iOS: Animating your own toast view

A toast view is a small, short-lived popup provides a small bite of information (see what I did there?) to the user. It’s an Android paradigm, but if you’re working on an iOS app that has an Android component, the chances are high that you have been or will be asked to implement one at some point. So you might as well learn how to make one simply without having to pull in a 3rd-party dependency,…

iOS: Working with Images from a Server

If you’re a mobile app developer, at some point in time you’re going to need to interact with a backend. One of the tasks you might need to do is to retrieve and display images from a server, or submit an image to that server. What format should the image be in when you’re submitting it? How do you convert bytes received from a service call into an image? Let’s build the entire stack from the…

Vim and Swift: Development in a post-apocalyptic world

Disclaimer: I don’t advocate using Vim seriously as your primary development environment. As powerful as it is, Vim remains a text editor, not an IDE . I ran into some Xcode problems the other day where I lost syntax highlighting and code completion in Swift files. What should we do when Xcode just doesn’t work? I joked that at this point, it might be easier to just use Vim for my Swift…

Your Other Job

You are the CEO of a company. There is no board of directors. The fate of the company lies solely on you. Every day, you make decisions that determine the success of the company. Some days you might make good decisions, and some days you won’t. You might have some trusted advisors that guide you in your role as CEO. But it’s not their job to lead the company to success, it’s yours. You can take…

Half-Baked Solutions to Common RxSwift Problems

I’ve been using RxSwift in some of my latest iOS projects. While I feel that it’s provided elegant UI binding and a natural feel to asynchronous programming, I have to admit that it came with numerous growing pains. I struggled to find documented solutions to some of the challenges I was facing, as RxSwift is not as widely adopted as its more affluent Java and .Net counterparts. Here are some of…

Lessons Learned From The Entelect Way

Software engineering and coding are two very different concepts. As a software engineer, I write code on a daily basis, but the value that a good software engineer provides to a business is so much more. This is emphasised by The Entelect Way. What is The Entelect Way? I’m a software engineer at Entelect , a software engineering and solutions company based in South Africa. The Entelect Way is a…

Android Development Through the Eyes of an iOS Developer

I’ve recently dipped my toes into Android development to see the differences in environment and tooling as compared to iOS development. While I haven’t done much as of yet, I hope to ship some Android apps in the future alongside some iOS ones. I figured it was time to understand the platform so that I can better relate to the woes of Android development. Disclaimer Note that this is entirely…

Using Multiple Author Identities With Git

How do you manage git credentials for different organizations? You may have some projects you work on at work that has a pre-push hook to ensure that your email is part of the correct domain. You might have your own personal projects, some of which might also use difference email addresses. Or, just maybe, you have a secret identity that you don’t want your other repositories to know about. How…

The Difference Between An Adapter And A Wrapper

The adapter pattern and wrappers each solve common but distinct problems. Their common usage and similarities in implementation, however, can lead to confusion. Both terms seem to be used interchangeably when in fact there are a few key differences. The adapter pattern and wrappers are two very useful tools and you can benefit from having them properly labeled in your toolbox. Definition Adapter:…

Server Side Swift With Kitura And Bluemix

IBM Bluemix is a cloud Platform as a Service solution that enables you to concentrate on writing your application while Bluemix handles most of the DevOps-y stuff like the networks, servers, storage, and software dependencies. It supports several programming languages, including Swift. It’s also easy to use - all you’ll need to manage your service is a web browser. You can even write your Swift…

A Caution On Superfluous Code

The line of code that the developer can write the fastest, the line of code that the developer can maintain the cheapest, and the line of code that never breaks for the user, is the line of code that the developer never had to write. - Steve Jobs Superfluous code is code that is written unnecessarily. It is code that has all the added complexity of valuable code, but it adds no value of its own.…