Expressiveness

In a reflective post yesterday Manton Reece of the Core Intuition podcast precisely summed up the concerns I’ve had since Apple’s announcement of Swift at WWDC 2014:

I also believe that a programming language can either encourage or discourage clever code based on the syntax it allows. I saw it with Ruby — programmers intent on fitting as much logic into a single line of code as possible. I think I see it with Swift as well, in operator overloading and maybe even a kind of rejection of Objective-C’s notorious verbosity. We’ll know for sure if we eventually see a Swift book in the pattern of JavaScript: The Good Parts.

Ruby developers like to call this fit-all-my-logic-in-one-line code “expressive.” Type less, do more; I would see the appeal 30 years ago when everyone was hacking on an 80-column terminal in emacs or vi. Today, we have powerful IDEs with code completion, snippets, and refactoring tools. I can write hundreds of characters of code in a handful of keypresses; and due to the beautiful verbosity of the Objective-C/Cocoa code we’re used to, it’s self documenting and easy to read by somebody new to the language/frameworks/app.

Don’t get me wrong, I enjoy the syntax of Swift, and I’m very happy with the way Apple is writing it in all of their WWDC 2015 slides. However, it’s the factions of the community at large that want to take it in a more “expressive” direction that worry me.

We’re half-way through this year’s WWDC I’ve finally resigned myself to the fact that after the Xcode 7 official release in the fall, I will be learning and using Swift in production code. Personally, I’m going to try and do it like a Objective-C developer, with self-documenting and beautifully-verbose syntax, but I hope I’m not alone.

8 Patterns to Help You Destroy Massive View Controllers

I’m a little late to the party on this one, but it has a few tips for creating smaller, more unit-testable view controllers.

View controllers become gargantuan because they’re doing too many things. Keyboard management, user input, data transformation, view allocation — which of these is really the purview of the view controller? Which should be delegated to other objects? In this post, we’ll explore isolating each of these responsiblities into its own object. This will help us sequester bits of complex code, and make our code more readable.

I’m a huge fan of smaller view controllers, and this objc.io article was always my go-to starting point. However, Soroush Khanlou’s 8 Patterns to Help You Destroy Massive View Controller is my new favorite step two. It covers 8 design patterns that help you break up your code into smaller, easier-to-understand chunks.

(I’ve just discovered Soroush’s site and his articles all look great; I think I’ll be spending a little time in his archives!)

CareEvolution is Hiring Devs and DevOps!

If you’d like to work with me and the other amazing people at CareEvolution, we have some new job postings up on StackOverflow Careers:

Open to US Residents. The core codebase is C# but there’s a lot of JavaScript using Angular.js and a little iOS work as well. CareEvolution scores 11/12 on the Joel Test.

At some point in the process you may think to yourself, “Self, this is too good to be true. It can’t possibly be real.” I did the same thing. I expected a “but” for weeks, pinching myself every day. Now, I’m three-months in and I still haven’t found a “but” and I’m thrilled to go to work every day! (Oh, and by “go to work” I mean put on my slippers and wonder into my home office.)

Organic UITableViews

I came across this nifty project on GitHub: mamaral/Organic.

A UITableViewController subclass designed with efficiency and maintenance in mind, and tries its best to handle just about everything for you.

No more if-statements and switches in every table view dataSource and delegate method. No more splitting up all the logic for each row and section into a dozen different methods, making addition, removal, or minor alterations to format and layout a headache. We feel your pain, we know the struggle. Moving one section of cells below another, moving cells between sections, adding new cells to existing sections, etc., with a decently-complex table view can be a nightmare, but with Organic it’s as simple as changing the order of objects in an array.

I’ll have to play with it to see if it fits in my current Interface Builder workflow; but looking at the sample code, it looks promising.

Illustrator for iOS Design

I’ve recently been working through a Lynda.com tutorial on Illustrator. It covered most of the tips in this article, but I found it to be a nice summary of how to setup your AI documents for pixel-perfect design.

If you want your designs to be tight and clean on device or on the web, then you’ll want to start your AI documents with these settings.

When you create a new document, make sure you are working in pixel units and have Align New Objects to Pixel Grid checked.

Then, in your General Settings, make sure your grid and keyboard increments line up to individual pixels.

Then if your keyboard increment is every 1px, you can be sure that you’re nudging on the pixel grid.

That’s not all. If you want things to be pixel perfect, you MUST make sure that Snap to Grid is checked. This is very important. If this isn’t checked, you may still get objects that sit on half a pixel (which will cause a fuzzy edge).

Read the full article “Designing with Illustrator: Tips and Tricks, Part I” over at the Big Nerd Ranch.

Relaunch on Jekyll

I guess Wordpress finally got fed up with me not updating my theme to the latest version; so the last upgrade finally killed the site. Luckily, a few months ago I had already re-started a Jekyll redesign I actually started a few years ago, back when Jekyll was new and popular. So, with a little polish and brand-new deploy script, here we are! (I’m not technically finished, but if I waited until I was, there’d still be a broken Wordpress install sitting here.)

If you haven’t noticed the header yet, I’m not really much of a web developer anymore, I’ve been concentrating mainly on iOS for the past 4 years or so, so that’s the new topic for this site. Like last time, I’m still most-interested in UI development, so expect to find articles about Interface Builder, Autolayout, Storyboards, and Animation. That is, if I actually manage to write anything.

This time around the site is fully-static, which means no comments. I kept any interesting comment threads from the past, but killed the rest. Sorry. (Not really.) If you’re interested, see the Colophon for details on what makes this site tick. There’s also an updated “About” page and a brand new “Projects and Code” page as well.

Fixing the Gist Embed Widget when Using Bourbon, Neat, and Bitters

As an avid user of Gist embeds, when I added the thoughtbot Sass frameworks Bourbon, Neat, and Bitters to this site, I was a bit disappointed when the widget display was a bit broken:

Incorrectly-rendered gist embed.

A bit of debugging and I found that the culprit was table-layout: fixed, which was included by Bitters. A quick patch in my main.scss file and we were all fixed: (As you can see by this working gist!)

Hope it helps somebody else. If you’d like to use progressively-enhanced Gist embeds in Jekyll like this site, check out my jekyll-gist-tag on Github! (Turn off javascript to see what this does.)

Hammering Screws: Programmers and Tool Blindness

Disclaimer: Check the date! This post was written way back in 2008. If there are technical things in here, they may be outdated, or there may be better ways to do them by now. You've been warned.

screws.jpg In my last post I told a half-truth by ending with If you need me I’ll be uninstalling Eclipse. Honestly, I only removed it from my laptop because I rarely do any real Java development directly on my laptop, and should I need a quick code editor I have TextMate which handles most of my coding needs pretty simply. However, the commotion that the statement caused is what I’m going to address in this post.

If all you have is a hammer, everything looks like a nail.
Bernard Baruch

To continue with my tools theme I’m going to address what I’ll call “tool-blindness,” the mentality that the tools you have and know how to use are perfect for every situation. In other words, if the tools you have require you to hammer screws then by-god you’re going to hammer screws.

Recently there has been a grass-roots, developer movement at my employer to switch from Ant to Maven. I love Maven, it’s leaps and bounds better than the way we were using Ant. (Notice I didn’t say Ant in general, I’m only planning on starting one holy-war with this post!) My last four projects have used Maven, and it makes the build and deploy process significantly easier, especially when it comes to dependancy management. However, everyone’s favorite Java IDE does not play well with Maven because Maven’s standard directory layout is significantly different from Eclipse’s convention. People have attempted to alleviate this problem by using the M2 plug-in and following the instructions here, but the result still feels like you’re forcing Eclipse to do something it doesn’t want to. Add that to the fact that the version of Eclipse we’re using crashes at least once a day, and you should be able to see why I’m looking for alternatives.

In short, our metaphorical hardware (the build process) has changed from nails to screws and our hammer (Eclipse) is no longer the best tool for the job. However, we’re still using the hammer because it’s what everyone knows how to use and only a few of us are not tool-blind enough to look for something else. It also doesn’t help that the alternatives that play nicely with Maven, namely IntelliJ IDEA and Textmate-and-a-shell are not “free as in beer.”

As I mentioned in the comments of my last post, Eclipse has been feeling a little more like this tool than this one. So maybe it’s time to ask which tool you really want on your tool belt.

In an interesting turn of events, Alex Vazquez over at Wufoo/Particletree is going through the same process with a different perspective. Alex is moving, based in part by recommendation and in part by language choice, from Java on Eclipse to PHP on Textmate, and he seems to be liking it so far. Alex does, however, sum up Eclipse rather nicely, and coincidentally within my theme:

The right development environment can save a programmer countless hours and is like a hammer in the carpenter’s tool belt. Since my background was in Java, my preference was for large sledge hammers and my development environment of choice was the de facto Java IDE Eclipse. It has a number of amazing features like autocomplete, refactoring and hundreds of plugins for every task imaginable. It’s no secret Java requires mountains of code, but Eclipse was made to move mountains.
Alex Vazquez

I think Alex really nails (pardon the pun) the fact that if you’re going to be doing Java Enterprise development you need an IDE that can handle it. You need something that generates the code and provides the re-factoring tools and autocompletion to make it possible to move mountains. However I’d like to pose a question to all Java developers who use Eclipse; how much of Eclipse do you really use? Besides re-factoring, code completion/generation, and cvs/svn/scm integration, is there anything else you couldn’t live without? Anything else that Textmate doesn’t do? (Besides run on Windows, we’ll save that tool for a different day.) Look at all of the stuff Eclipse does that you don’t use, is the added bulk really worth it? How much memory is your Eclipse process using right now? (Mine’s got ~254MB, 5x more than the next largest memory footprint, and my Eclipse process is basically idle.) Just my two cents, please form your own opinions, after all I’m just a kid who couldn’t possibly have any experience.

Maintenance

Disclaimer: I've grown up a bit and learned a lot since this blog was started. In the beginning I took tips from the likes of John Chow and Shoemoney and tried to write titles and content for Digg and Reddit. In the end it didn't do me much good and most of it just seems silly looking back. If you're interested anyway, here's what I wrote back then, but take it with a grain of salt.

A quick welcome to everyone passing through via DZone! Please subscribe, I’d love to have you back!

If you’re new here, please excuse the mess, it’s still a work in progress since the content has been my number one priority. Speaking of content, I finally replaced the default Wordpress about page, so go check mine out if you’re interested!

Coding Your Fingers Off - Hand Tools, Power Tools, and Programmers

Disclaimer: Check the date! This post was written way back in 2008. If there are technical things in here, they may be outdated, or there may be better ways to do them by now. You've been warned.

saw.gif I have read quite a few posts recently on the lack of quality programmers, web or otherwise, available in the current market. I’ve even written a post myself on some of the “differences” in the technology stack between now and when I started programming professionally just four years ago. Some people are saying we need to encourage children to become programmers, others are questioning the languages that are taught in schools, still others are criticizing the things that are not taught (or encouraged) during secondary education. I’m going to question how things are taught.

I spent my first year of college at RIT, not to downplay my last three years at Muhlenberg, but everything I really needed to learn I learned in three quarters at RIT. Computer Science 101-103 had labs in a Sun Unix lab. We wrote Java code using Emacs from a shell. We compiled it from that shell. We checked it into RCS from that shell. We ran diffs from that shell. We submitted our completed assignments from that shell. We loved that shell, whether we wanted to or not.

We did not have an IDE, not in today’s sense anyway; there was no code complete, re-factoring tools, or visual SCM merging tools. In the process we learned Unix, we learned how to grep, how to use sed and awk, telnet, ssh, and command line ftp. We learned how the internet worked by first learning how a network worked. We learned to write code, use a computer, and use the internet with the functional equivalent of hand tools. In the process we learned and understood how and why it all fit together.

As a matter of illustration, I’m reminded of the Home Improvement television show that was on when I was a kid. In it, Tim Allen plays Tim Taylor, the host of a cable TV tool show called Tool Time. He has an assistant, Al Borland, played by Richard Karn. On the show, Tim’s motto is “more power,” which usually leads him to the biggest Binford Tools power tools, disastrous projects, and eventually the emergency room. Al, on the other hand, is more of a renaissance man, appreciating the beauty, elegance, and simplicity of hand tools and the wood they’re used on. Although I don’t think it was ever stated, Al never ended up in the emergency room. Which character would you hire to work on your house?

But I digress, we’re seeing more and more computer science grads who have worked only on Windows. They’ve used Eclipse and Visual Studio. They know how to use the very basic IDE functionality with the mouse and they live and die by ctrl+c and ctrl+v. They were given power tools in the very beginning of their careers and now quite a few of them have figuratively managed to cut their fingers off. They’re crippled programmers because the “more power,” here’s-a-monsterous-power-tool-that-does-everything-you’ll-ever-need-really-fast attitude has physically removed their ability to operate the simple tools that solve their problems in an elegant manner. They’re afraid of the shell because they don’t know how to use it, but they’re not afraid of the IDE because it has a big, shiny button that promises to make their life easier if they press it. Power tools in the real world have warnings about loss of life and limb if operated incorrectly. Sadly, power tools in the digital world do not.

So, I propose my solution. Bring the hand tools back into the classroom. Eliminate IDE’s from the educational system. Teach students to use the shell, and with it the tools of our hacker forefathers. Let them nick their fingers with a hand saw instead of cutting them off with a circular saw. Encourage them to use open source. Encourage them to contribute to open source. The web in general runs on it, they should know how it gets made, and know how to give back to the community that has made a large part of their future pay possible. Teach them Emacs or Vi. Give them cvs, svn, or git, and teach them to read a diff. Make them create a website and share what they’re learning, or at least participate in the forums of some pet open source project.
Do them a favor and scare the ones who aren’t meant to be doing this out of the profession. If they don’t have the passion to persevere they need to find something else to do. Ladies and gentlemen of academia, I ask you for one thing. Stop manufacturing cookie-cutter, power-tool graduates and start nurturing artesian, master programmers.

Thank you. If you need me I’ll be uninstalling Eclipse.

Comments

  1. Eric Wendelin:

    I think your solution is perfect and if I'm ever teaching in this decade or the next I will likely force my students to use the CL. There is a certain sort of understanding you acquire when you do things this way.

    June 17, 2008 9:43 am

  2. Chris Hall:

    The right tools make a developer more productive. Providing shortcuts, automating repetitive tasks, and hiding all of the little nuts and bolts lets them concentrate on getting things done. And that's what it's all about.

    Unfortunately, tools are often used as a crutch.

    If you're in the field long enough, you'll run into situations where your standard tool set isn't available. Maybe you need to make a quick template tweak on a live server, or work on-site as part of a client's team using a tool set you've never seen before. How you handle that is what separates "good" from "good enough".

    June 18, 2008 6:47 am

  3. James E. Ervin:

    Don't worry about uninstalling Eclipse, it will be there for you when you grow up kid. ;)

    First off I want to preface my comments, you were a kid when Home Improvement was on the air and yet you are pontificating like an experienced developer?? Whew, I need a moment to sit down and catch my breath, I don't like where that is going.

    Still I don't disagree with your general point. I think it would be better stated as your best power tool is still the one between your ears and not on your desktop. The problem is not the power tool per se, the trouble is that there are people now that do not understand the reason for the power tool. I agree with you that people starting out need to get it from the basic level. I still think that my training as a Computer Engineer serves me well writing software. I started out with logic design, chip design, and began programming from the assembly language level up. This education gave me an understanding of how computers actually work and then my exposure to various Unix distributions showed me how an operating system should work. Perhaps the way forward is to stop hiring CS grads?? *Duck*

    In defense of the power tool, Home Improvement was a good comedy, but you are perhaps too young to remember what it was based on. Home Improvement really was a parody of the old "This Old House" program on PBS. Tim is Bob Villa and Al is Norm. The reason why I mention this is that if you ever watch Norm's "New Yankee Workshop" on PBS you will notice two distinct things. First, Norm is an extremely skilled craftsman. Two, Norm, the real life Al, uses all kinds of Power Tools.

    June 18, 2008 8:16 am

  4. admin:

    @James,

    Ouch. ;)

    Why do you assume that because I was a "kid" when Home Improvement was on I am not an experienced developer? I grew up on the web and writing software. While I may only have 4-years post-college experience I've been doing web development professionally for 12, which in this industry's case is damn near forever.

    But pontificating aside, I might have lost part of my point, which thankfully you have pointed out. Norm, or Al in my example, can and should use power tools, since he has the experience and understanding of the medium in general to improve his own efficiency.

    Just as your experience in CE makes you a better programmer, the experience I'm advocating in "IT" can do the same for web programmers. If these kids don't know how a network really works how can we ever expect to write a web application. And by "kids" I mean the ones that wrote their first "hello world" in college, not the ones that installed linux on their parent's PC in the 8th grade.

    As far as Eclipse goes, I'll allow it back on my laptop when it starts be useful with Maven. Until then it's TextMate and a terminal for me.

    June 18, 2008 10:45 am

  5. Abhijeet:

    I agree with you that using the shell and command line tools to do things is a great way to learn. But uninstalling Eclipse isn't going to help. On the contrary, its going to slow me (and you?) down a LOT. I can't imagine loading .java files one after other just to trace the flow. Whats wrong with F3? Its more like...right tool for the right job.

    June 19, 2008 4:27 am

  6. admin:

    @Abhijeet,

    I suppose my treatment of Eclipse is a little rash, but recently it has not been fitting very well in my programming tool belt. If you are programming with java there is no doubt in my mind that you should have some sort of IDE, it just makes life easier, and the language practically requires it for its current design paradigms. (Generate getters and setters saves me hours!)

    Like you said it is a case of the right tool for the right job, and at least in my recent experience with Eclipse, it's feeling a little more like this tool (does everything but is it really that useful?) than this one (everything you really need and it still fits in your pocket!) Personally, I'm craving something a little simpler for a while, I'm not saying I'm going to go mountain man and only develop with vi, but it is still possible to be an effective developer without using a full IDE.

    June 19, 2008 4:50 am

  7. Chris:

    Interesting metaphor. As a die-hard emacs user, I also enjoyed the conflicting metaphor: http://www.team.net/mjb/hawg.html

    July 10, 2009 7:38 pm