Refactoring Legacy Code: Replace Free Function in Tests, Even Swift’s Own Functions

Teaser image

Refactoring Legacy Code is hard. There are a few safe refactorings you can do with caution. But most chirurgical cuts require you to put the code in a test harness first to guard against regression. With C and Swift, you can create free functions as part of your app. To verify your objects use that function, you need to find a way to insert a test double.

Continue reading …

Support the Word Counter With a Review

Teaser image

I’m working hard on the Word Counter. By October, I’m going to finish a really big feature: file and folder monitoring. It’s a pretty tough ride till then to get it done.

Since the Word Counter is not on the Mac App Store, please show your support and leave a ★★★★★ rating on MacUpdate.

You don’t have to write a full review in order to leave a rating. Just click the five stars at the very top of the page – but a review is much appreciated, of course!

As always: if you experience any hiccups on Yosemite or El Capitan, please tell me so I can fix the bugs.

“Exploring Mac App Development” Updated for Swift 2.0 + Coupon to Save 50%

Teaser image

It’s a good time to update my book for Swift 2: guard clauses improve readability, and do-try-catch error handling shows problem points. Protocol extensions are huge, but I had no use for them in the sample code, yet. The update is live now. If you haven’t bought the book in the past, grab it until August 1st to save more than 50%: use the coupon Swift2Yay. The coupon is good for 10 copies, so be quick.

Continue reading …

Clean Coding is a Programming Misnomer for a Software Engineering Principle

Teaser image

I found a cute info-graphic on how to become an iOS developer by John Kim. This study guide contains a passage with a very interesting distinction between programming and engineering. Thanks to it, I found out a detail about what it means to write “clean code.”

Citing from the graphic:

Programming is like building the bridge. You need to know how to use the tools to get your end result. In this way, you need to know the programming language to build your “bridge”

Software engineering is like knowing how to design a bridge. You need to know the proven industry design rules to make a long lasting and reliable “bridge”. In this way you need to learn software engineering to design great software

Learning the Syntax and grammar of a programming language is pretty straight foward [sic!]

Understanding software engineering is the hard part about becoming an iOS developer

Learn BOTH but focus on Software Engieering [sic!]

Software engineering is about the design principles. It’s the necessary condition to plan the components of object-oriented projects like those for iOS and Mac. It is required to write clean code.

Programming itself is about API knowledge, understanding the language grammar and the like.

Of course we write clean code, but we’re able to write it only because we’re able to make a clean design up in the first place. So there’s not much clean coding, but a lot more clean design.