PodSearch

Developing Perspective

#77: Prototyping a new project.

 

00:00:00   Hello and welcome to Developing Perspective.

00:00:05   Developing Perspective is a podcast discussing news of note in iOS development, Apple, and the like.

00:00:07   I'm your host, David Smith. I'm an independent iOS and Mac developer based in Herndon, Virginia.

00:00:12   This is show number 77, and today is Thursday, September 6th.

00:00:16   Developing Perspective is never longer than 15 minutes.

00:00:20   So let's get started.

00:00:22   First, I just wanted to thank you all for the great feedback you gave me on the last show, number 76,

00:00:23   The Best Way to Avoid Distractions.

00:00:26   I heard a lot of people say that it was a really good, encouraging, motivating show.

00:00:31   And so if you haven't heard it, and this is your first one, or you just skipped the last one,

00:00:36   I'd highly recommend you find it.

00:00:40   A lot of people seem to be saying that it's a really good one.

00:00:42   So first, I appreciate your saying.

00:00:45   I want to thank you all for the feedback, because I do this for you, for the most part.

00:00:46   It's something that I do as a side project, my main thing, for the goal of sharing the lessons I've learned,

00:00:53   and hopefully helping other developers.

00:00:56   It's not a commercial project or anything like that.

00:00:59   And so one of the biggest things you can do

00:01:02   if you like the show is to just give me that high five

00:01:05   every now and then when it's like,

00:01:07   if I do something that really resonates with you,

00:01:09   it certainly encourages me and keeps me interested

00:01:12   and keeps me motivated to do the show.

00:01:13   All right, so I think what I've decided I'm going to do,

00:01:16   based a little bit on that feedback I got

00:01:17   from the last show, and kind of just trying to decide

00:01:20   where to head over the next couple of weeks.

00:01:23   So in the last show I introduced, I was saying that I'm just going to be starting to work

00:01:27   on a weather app for iOS.

00:01:29   This sort of the story back story of that's in the last episode.

00:01:32   Basically, that's what I'm doing.

00:01:33   I'm working on a weather app, and I'll probably be working on it for about the next month

00:01:37   or so.

00:01:38   My hope is to launch, I think, middle of the second week, October, something like that.

00:01:42   So with review times and things, roughly I'll be working on it over the next, say, maybe

00:01:47   month, month and a half.

00:01:48   And I think what I've decided I'm going to do is I'm going to walk through this process

00:01:53   from start to finish on the show and talk about how I'm going about doing what I'm doing.

00:01:58   Now, some of the things I'll talk about are obviously, I'll be plain and straightforward and talk

00:02:04   about some of the things I'll be a little bit more cagey about just in terms of it's, you know, you

00:02:09   want to be able to control and trickle out some of the features, some of the UI, some of those kinds of things.

00:02:13   I'm not going to jump in and share it all about it once as I'm doing it, but the goal is to kind of walk

00:02:21   through this process and show the arc of developing an application, sort of from concept through

00:02:26   to implementation, some of the marketing I'll do.

00:02:29   And a big part of the reason why I'm doing it this way, and what kind of got me excited

00:02:33   about the idea, is I want to try and synthesize and use all the lessons I've learned from

00:02:40   my past failures, my past successes, all the things that I've done over the last, whatever,

00:02:45   years that I've been writing iPhone apps, that I've learned about how to do it.

00:02:50   And I want to try and really put all those, to bring all those to bear on this project.

00:02:55   I want to make it that I'm doing all the things that I say, sort of I'm talking the talk about,

00:03:01   I want to do those.

00:03:02   And I'm going to be trying to do that in a way that I can talk about on the show.

00:03:07   And that's hopefully helpful, that you can kind of over the next month and a half, whatever

00:03:11   whatever that is, maybe 15 episodes.

00:03:14   They won't all be about this.

00:03:15   There's certainly things about like probably the new iPhone,

00:03:17   the new iPad mini if it comes out,

00:03:19   all those kinds of things.

00:03:20   But you know, this will be an arc.

00:03:21   And so what I want to do is,

00:03:22   in some ways it keeps me accountable

00:03:25   for doing all those right things.

00:03:26   And having an audience who's expecting me to do it,

00:03:29   it's like this app's going to be internationalized.

00:03:32   And I'm going to talk about my experiences with that.

00:03:34   I'm going to talk about, I'm going to make a video for it,

00:03:37   a teaser video, a promo video,

00:03:39   making the website for it, reaching out to the press,

00:03:44   all those kinds of parts of the marketing back inside,

00:03:47   as well as the development side.

00:03:49   This app does a couple of interesting things,

00:03:50   other things not so interesting,

00:03:53   but that's what I'm going to be talking about

00:03:54   over the next couple of weeks.

00:03:56   I just wanted to queue that up.

00:03:57   If that sounds good to you,

00:03:58   and especially if there are topics or ideas

00:03:59   or things that you want to make sure that I hit on

00:04:03   in that vein of if you're building an app

00:04:05   from start to finish,

00:04:07   what are the things that you want to talk,

00:04:05   you would want to make sure you were understanding or hearing my perspective on,

00:04:10   then please let me know.

00:04:15   Twitter is probably the best way to do it.

00:04:16   You can also email me.

00:04:18   It's on my About page if you need my address.

00:04:19   But you can, please reach out to me if you have things that you want to make sure I cover.

00:04:22   Otherwise, it should be pretty good coverage of the topics involved in writing an app and getting it done.

00:04:26   All right.

00:04:33   So the first part of this, what I'm going to talk about is prototyping,

00:04:33   and specifically about how I build an app

00:04:38   and how I start that process and work through it.

00:04:41   So kind of from final new project,

00:04:43   this is the way that I tend to build an application.

00:04:46   So first, you always pick a template

00:04:48   that is relevant to your application,

00:04:49   that'll do a lot of the heavy lifting for you if you want.

00:04:52   Xcode has a lot of these templates in there

00:04:54   and they work pretty well.

00:04:56   They're definitely, you're going to get carried away

00:04:58   with that, but if you're making a data-driven application

00:05:01   that's going to be table-based, use the detail view template.

00:05:05   And it'll do a lot of the setup for you.

00:05:07   You can click a button that says use core data,

00:05:09   and it'll build a base core data stack for you and things.

00:05:12   These are things that you ultimately, a lot of times,

00:05:15   what I'll end up doing is replacing those templates.

00:05:16   And I'm not saying that you want to necessarily ship

00:05:19   that template or use the code that's in that template,

00:05:21   but it's great for getting started.

00:05:22   Because you can start implementing your idea

00:05:25   rather than having to do a lot of boilerplate, a lot of code

00:05:28   that isn't actually interesting or useful.

00:05:30   There's a lot of things that are just kind of there that you have to do.

00:05:35   If there's a template that exists for doing that, please do use that.

00:05:38   Don't feel like you need to start a new project with the window-based application,

00:05:42   which is I think the most bare bones.

00:05:46   You know, absolutely nothing in it.

00:05:48   Don't do that.

00:05:50   That's not helping anybody.

00:05:51   So first, you start that and you start a new project.

00:05:54   And probably it's also important for you to have a slight disclaimer.

00:05:55   A lot of what I'm talking about in my development process

00:06:00   applies mostly to individuals or very small teams.

00:06:03   If you're a developer working on a large team,

00:06:06   10, 15, 20, 30 developers,

00:06:09   first, you really have my condolences.

00:06:11   I'm sorry about that.

00:06:13   That's a tough situation.

00:06:14   I've been there.

00:06:16   Personally, I'd rather work on smaller and smaller teams.

00:06:18   The smaller the better.

00:06:21   Probably my sweet spot is probably a couple of developers.

00:06:22   I've really enjoyed the time since I've worked on projects

00:06:22   I've met a couple developers, but I've also done the big, big teams, and it's a bit of

00:06:26   a mess.

00:06:27   But anyway, I'm just saying as a disclaimer, what I really like is this is the way that

00:06:32   I like to do it because I'm an individual.

00:06:34   I can cut a few corners.

00:06:37   That would be really awkward to cut in a bigger team project.

00:06:41   For example, some of the ways that I do things in terms of files and being able to add and

00:06:46   remove files really easily and things would be really awkward in a version control environment

00:06:50   where you're constantly trying to have to merge

00:06:55   XJ project files and nib files and things.

00:06:57   Take it with a grain of salt if you work on a large team,

00:07:02   but if you're a small team or an individual,

00:07:05   definitely this is the way that I do it,

00:07:07   and it seems to have worked pretty well.

00:07:09   So the first thing I do when I'm trying to prototype something

00:07:11   is I hate doing work that doesn't help me get closer

00:07:13   to actually completing my project.

00:07:17   And by that I mean I hate it when you kind of,

00:07:19   I hate the concept of building things

00:07:22   that you're going to, that are entirely throwaway.

00:07:26   I'm a big fan of throwaway code,

00:07:29   but I don't like things that I'm going to build

00:07:31   and then throw away.

00:07:32   And a classic example for me of this

00:07:33   is the Photoshop mockup, where you are having someone

00:07:38   spend a lot of time and effort mocking up every page,

00:07:41   pixel by pixel, and then the developer goes

00:07:44   and tries to build this.

00:07:45   And obviously I'm a developer, and that's my specialty.

00:07:50   So I'm going to shy away from that process.

00:07:53   If you're in a design-driven organization,

00:07:55   that may be just the way you work,

00:07:58   that the people in the driver's seat are designers

00:07:59   rather than developers, and so you can't.

00:08:01   And for me, I really struggle in that environment.

00:08:03   What I like doing is I want to build it right away.

00:08:08   I want to get in there, I want to build something,

00:08:10   and I want to have something to show

00:08:12   from that very first day.

00:08:11   So what I do is, everything I do is writing code.

00:08:15   I have a couple of sketches, maybe in a notepad,

00:08:17   just to kind of organize my mind,

00:08:19   but once I've got that, I just go in and start building.

00:08:22   And when I'm starting to build, I tend to,

00:08:26   I'm cutting a lot of corners,

00:08:30   and these are often things

00:08:31   that I know I'm going to replace later.

00:08:33   And you cut these corners

00:08:36   to make your development process faster.

00:08:38   Any time that I can do something

00:08:40   make me develop quicker and more effectively, I'll definitely do it.

00:08:44   So, and often what I'm doing when I'm building these things is I'm doing, I'm making obviously

00:08:49   naive choices that I know aren't right, and I know there are better solutions for, but

00:08:54   I don't have the time or the energy to do it right away, because what I want to do is,

00:08:58   my goal is to get from zero to a roughly functionally complete version as soon as possible.

00:09:06   And by that I don't mean that it's ready to ship.

00:09:11   For that I have something that I can put in people's hands,

00:09:14   have them play with it, I can play with it,

00:09:16   I can start using it day in and day out.

00:09:18   On my home screen right now is my weather app

00:09:21   and I'm using it daily to check the weather

00:09:23   before I go out to use on a regular basis.

00:09:25   And I want to get there as quickly as possible.

00:09:28   It drives me crazy when I've worked on projects

00:09:30   where you end up spending like weeks and weeks

00:09:33   building all this code that at the end of it you're like,

00:09:33   We don't have anything to show yet.

00:09:36   Some higher up, some C-level executive appears in and says, "Hey, what you guys been working

00:09:41   on?"

00:09:42   It's like, "Well, we've got these 16 data persistence libraries all ready to go.

00:09:45   We've got this data rendering engine over here, and we have nothing really to show for

00:09:49   it."

00:09:50   I want things as quickly as possible.

00:09:52   So the first thing I did when I'm building a weather app is I set it up so I could make

00:09:59   a weather call, download the data, and display it on the screen.

00:10:02   That's my first goal, and that was pretty straightforward.

00:10:07   I use AF networking as my networking stack right now

00:10:10   because it is just gorgeous.

00:10:13   The API for it is really straightforward.

00:10:15   It seems very fast, performance reliable,

00:10:17   and I've had really good experience with it.

00:10:20   And so that's all the application was at its beginning,

00:10:22   is it was just a single view with a couple of labels in it

00:10:24   that were styled in basic Helvetica,

00:10:27   and you open the app, it made a static request

00:10:29   for basically the address of my house,

00:10:30   and it showed me data.

00:10:35   Now, at that point, that took, oh, no,

00:10:36   maybe an hour, something like that.

00:10:39   It was not a lot of work to get to that point.

00:10:41   Now, at this point, I actually have something that's useful.

00:10:44   I can use this to look at the current weather

00:10:46   right now on my house.

00:10:49   That's obviously not an app I don't want to ship,

00:10:50   or it's not useful in the broader sense,

00:10:52   but what I've done, though, is I've started,

00:10:54   I've gotten a great starting point,

00:10:57   and then I just start growing out from there,

00:10:56   pulling in more data, showing it to the user, starting to build out the views.

00:11:00   But in everything what I'm doing is I'm trying to, as quickly as possible, get it on screen.

00:11:04   I want to be able to see it and play with it and interact with it. But I cut a lot of corners

00:11:08   in doing that. So here are a couple of examples, and I think these are hopefully useful

00:11:12   examples for what this actually means in practice. So, for example,

00:11:16   one thing that I always do whenever I'm working on

00:11:20   prototyping like this, is I set it up so that I always

00:11:24   cache network requests, pervasively, across the board.

00:11:29   Because I want my iteration process

00:11:34   to be as quick as possible.

00:11:38   So when I launch it in the simulator on the app,

00:11:40   it immediately returns results and displays them.

00:11:42   Because usually the interesting part

00:11:45   is not getting the data.

00:11:46   The interesting part is what I do with that data,

00:11:48   how I display it, how I interact with it.

00:11:49   So what I do is I just add a little stub

00:11:51   to my AF networking stack that any time

00:11:51   a URL request is made, I record the URL,

00:11:56   and when I get the JSON back, this is a JSON thing,

00:12:00   it works pretty much any way you do it.

00:12:03   I get the JSON back, I take that as an NS dictionary,

00:12:05   and I put that dictionary with the URL key

00:12:09   in my NS user defaults.

00:12:12   It's a terrible solution for caching,

00:12:14   but it works really well because it does all

00:12:16   the serialization for me, I don't have to worry about that.

00:12:18   And then you just, at this point,

00:12:23   anytime you make a network request,

00:12:25   it's instantaneously returned.

00:12:26   There's all kinds of performance problems and things

00:12:28   that you never actually want to cache anything

00:12:30   in NSC user defaults, but it's a really simple way

00:12:32   to just pervasively put that kind of code

00:12:34   in your application.

00:12:36   And it makes my development process much quicker.

00:12:37   Now, I've since iterated twice on my caching strategies,

00:12:39   and right now it's got a much more complicated system,

00:12:43   you know, serializing data to disk

00:12:46   in special custom files and all these kind of things

00:12:46   that I've been building on top of that.

00:12:51   But to start off, that's what I did,

00:12:54   and it made me develop faster

00:12:55   because I didn't have to worry about

00:12:57   network connectivity problems,

00:13:00   about that performance hits,

00:13:02   all those things I could just focus on what I was building.

00:13:04   Another thing that I do

00:13:06   is I have a couple of base UI view classes

00:13:08   that all of my views tend to subclass.

00:13:10   And I often do that mostly just so that I can do

00:13:13   kind of clever, not clever,

00:13:12   I can apply custom attributes to all views across the board

00:13:17   to make my life a little easier when I'm developing.

00:13:21   And for example, the classic,

00:13:23   this is the most important thing that I do

00:13:24   whenever I'm laying out code,

00:13:26   is I set it so that all my views have a one pixel

00:13:27   like black border, or a random color border is even better

00:13:30   if you just pick a random color.

00:13:33   Because what that allows me to do

00:13:35   is very easily see layout on my screen.

00:13:36   When the app is running,

00:13:39   everything has these ugly borders everywhere,

00:13:37   But I can see weird alignment problems.

00:13:38   I can see how things are actually spaced out in a way that is often difficult if you have

00:13:42   a lot of white space around your controls.

00:13:45   So those are two things that I do when I'm starting off, when I'm prototyping, to just

00:13:48   get going quickly.

00:13:49   And as I said, all of those things will get pulled out and replaced later.

00:13:52   You don't want to ship this stuff.

00:13:53   What you're trying to do, though, is actually get something that you can ship soon so that

00:13:57   you can get feedback on soon.

00:13:59   The earlier you make mistakes, the quicker you're able to correct those mistakes.

00:14:04   You put it in front of somebody and they're like, "This doesn't make any sense."

00:14:07   You want to know that information as soon as you can.

00:14:09   As a result, I'm about a week in.

00:14:12   I've spent roughly one week of time working this app.

00:14:15   And I have some that's functional, that's useful,

00:14:17   that I've started to put in people's hands and show them.

00:14:20   And I've gotten started getting feedback.

00:14:22   And so that's the goal of this really rapid focus

00:14:24   on attention to shipping something

00:14:27   and putting pixels on screen as soon as possible.

00:14:29   All right.

00:14:30   That's it for today's show.

00:14:31   As always, if you have questions, comments, concerns,

00:14:33   complaints, I'm on Twitter as _DavidSmith.

00:14:35   Otherwise, I hope you have a good weekend.

00:14:37   And as always, happy coding.