Maintaining & Migrating with Antoine van der Lee - Part 1

In this episode, Leo talks with Antoine van der Lee of WeTransfer and SwiftLee about maintaining and migrating messy and old projects - how to refactor them, avoiding third party libraries, implementing a style guide, and more. Leo also gives some quick thoughts on this week Mac event with the M1 and let you know the latest in my conference appearances.

Guest

Related Episodes

Related Links

Sponsors

AppFigures
The tools you need to monitor, optimize, and get more downloads.

If you want your app to succeed, there's never been a better time to read up on App Store Optimization and Appfigures provides that for you. 
  • One of the most known conferences about Apple platforms development is going remote this year! 
  • NSSpain 2020 is an online, continuous 36 hours conference, carefully crafted by the community for the community.
  • Guests of the show Paul Hudson, Donny Wals and Antoine van der Lee will be speaking as well as others
Go to NSSpain.com and use promo code empowerapps to get 10% off

Intro

On Simulators

  • RocketSim
  • Managing Multiple Simulators
  • Creating Movies and Gifs from Simulator
  • Preparing RocketSim for Big Sur

Dealing with Old Code

  • Your old code vs Someone else's old code
  • When do you need to rewrite the app?
  • How do you convince a manager?
  • Differences between agency and product work

Early Project Decisions

  • Dealing with Third-Party Dependencies
  • Refactoring by Unit Tests
  • Keeping File Size Down
  • Splitting Types with Extensions

Social Media

Credits

Transcript

Leo Dion (Host): [00:00:00] Hello folks. Welcome to another episode of EmpowerApps. I am your host Leo Dion. Before we began the interview with Antonie, I wanted to cover a few things. We just finished the Apple event, revealing the new Apple Silicon Macs. And I wanted to talk about that. We recorded the episode the morning of today of the Apple event.

[00:00:20] So obviously Antonie and I didn't really cover these new Macs, but I figured I would just give you a quick, quick thoughts on the event today. So this was our last event from Apple last hardware event. It's been pretty quick. This year. We've had three events in two months, like Tim said, and we got the reveal of the  chip, which will be used in the Mac book pro, Mac book air, and Mac mini, which can be ordered today.

[00:00:48] I don't know when they're going to be out. Exactly. I haven't been able to check that out. I don't know which I'm really interested in. I'm kind of. Not really up for buying another piece of Apple hardware already bought a new iPhone and a new. Apple watch as well as the home pod mini, that should be coming in a few days.

[00:01:05] So I'm not super enthusiastic about buying something new. I do have a Mac book pro that's almost half a decade old now, so it could definitely use an upgrade, but I did just put a two terabyte hard drive in. So that's, that's helped us quite a bit, but it's getting slow for sure. The other. Option is looking at getting a Mac book air.

[00:01:25] If I wanted something to replace what was my iPad pro, but that doesn't sound really interesting to me for a right only machine. And then the other option is the Mac mini. And I think if I was really desperate to get an app in the app store that worked on Apple, silicone, I'd probably go that route because I think that would be.

[00:01:43] The most reliable as to kind of use it as a remote CI machine, essentially to make sure I can get my builds working on Apple Silicon, especially with the applique speculate, which I'm hoping to get an app store very soon. So that was the Apple event. I am really kind of a wait and see approach to see what the review say and what comes out.

[00:02:03] But It doesn't look like new industrial design or anything like that. A lot of comments about devices having fans or don't have fans and things like that, you know, all that's fantastic I guess, but I'm kind of wait and see, and. What is it actually going to be like when developers get these in their hands or even video editors as well?

[00:02:23] So that was pretty much the Apple event in summary, not a lot. And then the other thing I wanted to talk about is my videos are out for Back To Mac. Thank you so much, Gavin, for putting this conference together, you can check it out at the YouTube channel, which I'll have a link to as well as my two videos on modern.

[00:02:43] Mac OS development with C++ as well as my talk on Swift argument parser, those will be in the links Lucas, who was a guest this summer and talked about Miko West development. He had a video as well, and a few other people that you really should check out. It's awesome conference. If you're interested in Mac development anyways.

[00:03:00] Yeah. And that's back to Mac. And then lastly, get your ticket to NSSpain. Remember you can get 10% off if you use our promo code and power apps. I'm speaking at it. I will be speaking on Swift package management Antonie. Our guest for today is also speaking as well. And folks that we've had on the show like Paul Hudson, Donnie Walls, they all will be speaking at this 36 hour conference, which is going to be awesome.

[00:03:23] So that's fantastic. Definitely want to check that out, go to Anna spain.com. Use the promo code and power apps get 10% off and you will see me talk about Swift package manager, the dependency management of the future. Thank you so much. I think that's it. Here is the first part of our interview with Antonie about maintaining and migrating old code and old projects over a second part should be out in a few days later, probably five days.

[00:03:51] So thank you so much and I'll let the rest episode take it away.

[00:04:00] Welcome to another episode of EmpowerApps. I'm your host, Leo Dion. Today. I'm excited to have one of my favorites. Bloggers in the Swift space. Antonie Vander Lee. Hey Antonie how's it going? 

[00:04:12] Antoine v.d. SwiftLee (Guest): [00:04:12] Hey. Hey. Yeah. Great. Thanks for inviting me over. I'm really looking forward to having a nice conversation today . 

[00:04:19] Leo Dion (Host): [00:04:19] So for those who don't know who you are, I'll let you go ahead and introduce yourself.

[00:04:23] Yeah, I think 

[00:04:24] Antoine v.d. SwiftLee (Guest): [00:04:24] I'm best known for my personal blog called swiftly at which I write for two years every week. And I try to publish that article every new week, besides that I'm a developer for almost four years that we transfer where I developed the collect by we transfer application. Yeah. And I tried to be a regular speaker at conference. And so yeah, that's me. 

[00:04:47] Leo Dion (Host): [00:04:47] Yeah. We'll talk about at the end of our recording today. We'll talk about our talks and Spain. I'm really excited about that this year, but you've been working on your big app you've been working on for developers has been RocketSim, correct? 

[00:05:01] Antoine v.d. SwiftLee (Guest): [00:05:01] That's correct. Yeah. That's like a typical example of a hobby project that turns out to be way more serious than it started.

[00:05:09] I think I started like a year ago in August where I found myself testing universal links in the simulator. For the CollectByWeTransfer application and it was quite like a repetitive task. You know, I had to copy a link into Safari on the simulator open it. Then I started evolving it into an HTML page where I could just press a link and it would open in the simulator, but you know, it was repetitive and it didn't really.

[00:05:39] Well smoothly my whole process in testing the application. So yeah, I decided to start developing RocketSim, but it's a, it's a different application, you know, today, 

[00:05:49] Leo Dion (Host): [00:05:49] I think. So what exactly does RocketSim do? Is it like a power tool for simulators essentially? Yeah, 

[00:05:56] Antoine v.d. SwiftLee (Guest): [00:05:56] so I think many of the iOS developers are familiar with the SIM CTL tools.

[00:06:02] Yes, we have available in the, in the terminal command. 

[00:06:06] Leo Dion (Host): [00:06:06] Yeah. I use that for like screenshots and videos. You can do all sorts of stuff with like clearing or data resetting it, all that stuff. 

[00:06:13] Antoine v.d. SwiftLee (Guest): [00:06:13] Exactly. So what I basically did with RocketSim is a at first I built like a, a UI around that tool to make it a bit more accessible.

[00:06:22] And over time I started developing RocketSim to be a more enhanced version of it. So. Right now RocketSim enables you to record the simulator into MP4 or GIF. So what basically RocketSim is doing for you is converting it into a quality video file, as well as a dif file, which you can share on platforms like Git or GitHub.

[00:06:44] Leo Dion (Host): [00:06:44] You can't create a GIF with some CTL, so you you're doing all that in coding yourself.  

[00:06:49] Antoine v.d. SwiftLee (Guest): [00:06:49] EXactly. So right now yeah, I'm, I'm taking the result from SIM CTL and I'm converting it in multiple ways. I also want it to support dragging it into app store connect so you can use it for app store Prefuse so yeah, you know, it's a lot easier to create app store Prefuse if you want through the simulator.

[00:07:07] And it's also resulting in an floating third nail on the bottom right of your screen. So you can dial like directly drag the recording result in any app you want. And that's different compared to using the terminal where you first need to open the third terminal. Remember the commands executed commands, save it to a location with the right syntax.

[00:07:28] And then you can start dragging it anywhere. So it's basically making the whole workflow a lot easier. 

[00:07:34] Leo Dion (Host): [00:07:34] That's awesome. And is this available on the app store or is it just free open source? 

[00:07:39] Antoine v.d. SwiftLee (Guest): [00:07:39] It's available for free in the app store, in the Mac app store and for free, we'll get like a recording version with a small watermark on it to just to help me promote this RocketSim a bit.

[00:07:49] And you can decide to become a rocketsim PRO user and then you get like recordings without any watermarks. 

[00:07:56] Leo Dion (Host): [00:07:56] Awesome. So are you ready for. The switch over to big Sur with RocketSim. 

[00:08:03] Antoine v.d. SwiftLee (Guest): [00:08:03] Yeah. Yeah. W what I did, what I'd like to do in general is to just have an separated petition in which I can test out big Sur.

[00:08:10] So I did the same because I had quite a few early adopters. I think that's the downside of a developer tool because developers, they want to test out big server as soon as it's available. So I had to actually start testing it quite early. And well, yeah, you know, I was, I think I was kind of lucky because it works almost completely, so yeah.

[00:08:33] I guess I'm ready. 

[00:08:34] Leo Dion (Host): [00:08:34] That's awesome. So today we have. Quite a challenging topic. I'm sorry. This is the topic that we've picked. It's not fun and exotic, but I think as employees and as software developers, we run into this quite a bit and that's maintaining and migrating older applications. We all, we've all done it before.

[00:08:59] It's it's the dirty job of iOS development. What kind of experiences have you had? Dealing with like old code or maintaining old code. What kind of challenges do you run into frequently? Yeah. 

[00:09:14] Antoine v.d. SwiftLee (Guest): [00:09:14] So there's a lot. I can say about this and I think it totally differs per project. Before I worked at we transfer, I was working at a digital agency and it often happened that I had to take over a project from a different company where you would end up being in a reel.

[00:09:29] Big, well kind of coat mess. You didn't write yourself, which is a lot. Whereas then if you are in a code mess you did right. Do you know nowadays it's at WeTransfer? I, you know, was one of the first developers, so I can dream like the complete code in that application. And I think if you're, if you're doing a great job for yourself, it's, it's not, not a difficult topic to discuss because if you're iteratively making sure your code is up to date and then there's nothing really to migrate, you know, So what we try to do at WeTransfer.

[00:10:01] And we do the same as we speak with SwiftUI is we really try to stay on top of the new things and adopt as we go in phases. Step-by-step which, you know, that makes it at least a much smaller step. Over time. And I think that way it doesn't really hurt. Yeah. 

[00:10:21] Leo Dion (Host): [00:10:21] I think definitely doing it iterative approach, and I'm a big believer in continuous integration and things like that.

[00:10:30] And just making sure your code is constantly like. Passes, whatever linting or whatever code coverage you expect and following that rule. But yeah, I think I've run into more situations where I am brought on to deal with essentially like a mess of code that somebody had already worked on and kind of being brought onto those projects.

[00:10:54] And that, that to me is like the bigger challenge is how, how do you take something that's are writing on this and like, introduce. First of all a clean it up, but also be introduced an intuitive process into it. So that way problems don't happen in the future. Yeah. 

[00:11:11] Antoine v.d. SwiftLee (Guest): [00:11:11] I think if I look back, I have been lucky over time.

[00:11:13] Right. Could convince my product managers to really start rewriting the complete project. At the time when Swift first just just arrived. But you know, there are indeed cases where that's not an option that you really need to figure out like a solid structure in a solid way where like tomorrow is a better day for your project, then, then it, and today.

[00:11:35] Leo Dion (Host): [00:11:35] What do you think helped convince your product manager?

[00:11:38] Antoine v.d. SwiftLee (Guest): [00:11:38] Yeah. So, you know, I always try to really make it visible for them. Especially if the product manager isn't technical, you really need to know how to convince him in terms of like, what does it mean if we wouldn't do the migration in terms of time, for example, because. If it means that the developing a new feature takes, like, for example, a week long, or just because the project structure isn't fitting the way we like to work.

[00:12:04] And it takes for example, three months to develop the, the rewrite because you know, you already have the code, right. You only need to rewrite it to Swift. For example, you know, the business rules already. So it's kind of like a faster approach than starting from scratch. Three months is obviously longer than that one week for that developing that new feature.

[00:12:25] But if you take it over like two years or three years, then obviously it's, it's, it's a better approach. I think this, this is a case per case, obviously, but in this case it might work. If you, for example, still have a project and Objective-C let's say that you have a project with Swift and that project is a mess just because, you know, maybe, maybe somebody else wrote a lot of things in Well, let me, let me share an example.

[00:12:52] What I did, this is a sad story for my old colleagues, because I left them with a, with a project which is now a code mess probably. But you know, you have those, those times where you really want to dive into like a new, new, new tool or topic. And for me, that was at the time RXSwift. Okay. You have to reactive programming.

[00:13:12] I was really into it and I wrote everything with our experience, even though it wasn't the best choice. And right now I left over like a few of those engineers with a project, which is completely wired into our Swift observables and those kinds of things. And it's really hard for them to maintain that project because, you know, If you don't have that learning curve for RXSwift, with it's just, yeah.

[00:13:36] Time-consuming and it's way harder doing a project without it. And what they do, they take, take it step by step and they rewrite screen per screen, business logic, pro business logic, into like code. That's easier to understand and simpler for them to maintain. And obviously that doesn't result in a better application within a few days, but yeah, it's, it's an iterative process.

[00:13:59] Which makes it a better project over time. 

[00:14:01] Leo Dion (Host): [00:14:01] Yeah. I'm hearing a couple of things. One thing is when you convince your product manager, it seems like, like at the end of the day it's money, right. That's going to drive the decision. If that means they can save more money long time by you rewriting and rearchitecting the code, I think that's much more tangible to them.

[00:14:18] And of course, like you said, it depends case by case because a lot of cases there is no long-term, everything is short term. Those are not fun projects to work on, but. They're for real they're out there. And so, like, they don't even care about rearchitecting cause they just want the short term gain. And then, you know, whatever, they'll worry about it at some other point.

[00:14:39] Antoine v.d. SwiftLee (Guest): [00:14:39] I think that that's also like an important difference between an agency working for clients that really want to have a result within eight weeks, no matter how you do it. You know, those are often also the examples where you don't write any unit tests because there's no time. Right, right. Whereas if you're working at a product company, it's much more important to have that solid foundation on which we can build on for like years, you know?

[00:15:05] We, we can't rewrite the project every, every other year. So yeah, those are really different stories. 

[00:15:10] Leo Dion (Host): [00:15:10] The other thing you talk about is using RX Swift and the idea of bringing in third party, the library's always is kind of a flag, a warning flag. It better be like really accepted or something. That's pretty major.

[00:15:22] If you're going to bring that in and make that your whole design philosophy. Cause I know a lot of fans that RX Swift there isn't, it isn't that. I wouldn't say it's that foreign to a lot of people, especially now that people are getting more exposure to reactive programming, but still at least, I don't know, we're talking to maybe like five years ago that you did this.

[00:15:41] Like yeah. I could see how that's a totally, totally foreign way to do things outside of the standard UI kit storyboard way. 

[00:15:49] Antoine v.d. SwiftLee (Guest): [00:15:49] Yeah, definitely. And you know, it's not per se a problem. You know, if everybody in the project knows what you're doing and knows about this third party dependency, then it's a perfect way to develop the application.

[00:16:02] And at the time I was the only one developing the application so, you know, there is no problem. 

[00:16:06] Leo Dion (Host): [00:16:06] Well, where were you in the hierarchy of the company? 

[00:16:09] Antoine v.d. SwiftLee (Guest): [00:16:09] This was at the agency time where I grew from like. Being a junior or for four years to a senior. And I think, I think this, this was at a point where I was the senior, because I made a decision to do a

[00:16:23] Then I was capable of making that decision. Yeah. 

[00:16:26] Leo Dion (Host): [00:16:26] And there probably were like, whatever five years ago. That was probably not a lot of Swift developers because whatever Swift is only six years old anyways. Yeah. 

[00:16:36] Antoine v.d. SwiftLee (Guest): [00:16:36] That's true. This dates back even longer where We also adopted reactive cocoa with objective-C time, you know?

[00:16:43] So yes. Okay. In general, any decision to adopt it to a third party dependency? Which obviously also happens way more often than tonight to see because the time is way smaller. So if you can use a third party dependency, which gives you like a boost in development. Yeah. That's the easy choice.

[00:17:06] AppFiguresLeo Dion (Host): [00:17:06] I want her to talk to you again about app figures. You probably already know them, but their analytics and their app store optimization. I figures really is about giving makers the tools they need to get more downloads and revenue. Well, now figures can help you track competitors for how many downloads they're getting and how much money they're making to their audience, demographics and which SDKs they use.

[00:17:27] Their competitor intelligence really gives you great context, say a competitor as like a new feature or was spending in the news recently with app figures, you can see if that brought in more downloads right away. Got a great idea for an app or a game. Well with that figures that you can figure out how big that market is and how much money you could be making with it.

[00:17:48] And that's just scratching the surface, whether you're growing your app or building a new one, and figures has the tools you need that will reduce the risk, but also get you more downloads. You don't need a large budget or a data science degree to do this kind of thing. I figures has made it affordable Ansible on top of tools and figures also provides a lot of great guides and tutorials to take you step-by-step through gaining more visibility with ASO and increasing your revenue by learning from your competitors.

[00:18:16] They just released a free guide on that, actually. So go ahead, head to the link in the show notes and try out figures for free. If you like it, user special code and power 30, 30 to get 30% off for the next three months. Thank you at figures for sponsoring our show.

[00:18:36]End Sponsorship

[00:18:36] So let's say you got a ginormous file. From one of your developers, like a really big file, maybe has maybe there's, it's a huge view controller. Let's say tons of lines, like we're talking thousands. How what's your philosophy fee on like cleaning up that code? Or how do you triage that in such a way that like, okay, first thing we need to do is break this up in this way.

[00:18:59] Or first thing we need to do is to deal with this. What are some like red flags that you would take care of right away? 

[00:19:05] Antoine v.d. SwiftLee (Guest): [00:19:05] So the way I like to do refactoring is by being really convinced that I'm doing the right thing. And the only way I see that makes it possible is by writing unit tests. 

[00:19:15] Leo Dion (Host): [00:19:15] Yeah. I was about to say the same thing.

[00:19:17] Antoine v.d. SwiftLee (Guest): [00:19:17] Yeah. You know, it's, it's, it's the only way you're for sure that the inputs results in the same output and I guess if anybody writes such a big class, a they don't care about unit testing as well. So I probably have to start writing those first. Once I have those, I would, I would take it step-by-step and rewrite like, well, maybe, maybe first look at like data sources, delegates, like those distinct responsibilities and take them out, creates a single responsibilities of them.

[00:19:50] And then that leaves you up with, with, with other kind of sectors in that class, you know, like pieces that should be in a field model. Maybe there's some network in which I can extract into networking layer. Maybe that field itself is way to bake and I need to create two new fields first, which already removes a bit of code.

[00:20:11] And as you go, it will be more and more obvious what you want to create there. Although, while I'm sorry right here, thinking out loud, I think it's maybe even better to do this beforehand where you really create that structure. So you know what you're going to do, you know, like where, where are you going to place all the pieces that you have in place?

[00:20:30] Leo Dion (Host): [00:20:30] Yeah. Like, I like the idea about unit testing, because I think like that's not just as unit testing, ensure that your code does what you expect it to do, but it also it's created at least for me, like a healthy habit of good architecture. That's one of the things and just being able to like, Build the unit tests and then build the scaffolding.

[00:20:52] So that way, like kind of like you're building almost like a bridge or a tower to where, like you have pieces in there. I didn't even know what it's called. I'm not a construction person, but like you have the pieces in there that holds the thing up, but then you are able to like remove those pieces that hold it up temporarily, which is basically your old code.

[00:21:10] Once you've set up your new code, that's better are cut textured and refactored correctly. Does that analogy make any sense? I think so. 

[00:21:18] Antoine v.d. SwiftLee (Guest): [00:21:18] Yeah. Yeah, I think it does. Although it might not always be the way how to do this, you know, because it's not always possible to keep the old code in place while rewrite or well writing the new code.

[00:21:29] You know, sometimes you have to throw the way the old code first, before you can start writing and adopting the new code, but I guess, yeah. You can make the building collapsed the reflector, you know, 

[00:21:42] Leo Dion (Host): [00:21:42] what, what do you mean by you have to remove the old code. Well, you know 

[00:21:46] Antoine v.d. SwiftLee (Guest): [00:21:46] you have two ways of refactoring one way would be to kind of like in an AB testing way where you would have to first and side-by-side working.

[00:21:54] That would mean that, that the ultimate approach should completely stay working automatic contest in you. And the other approach would be to. Make the project kind of breaks. So you're kind of like let the building collapse and then you start rebuilding it from scratch to kind of 

[00:22:11] Leo Dion (Host): [00:22:11] so kind of let it, you let the compiler fail or the app crash, because that way it, it's a way to remind you to, to, you know, understand when that thing is fully working, I guess.

[00:22:21] Antoine v.d. SwiftLee (Guest): [00:22:21] Yeah, exactly. And sometimes the new approach needs to make use of codes that already exists, but that existing code needs to be adopted for the new way of working. But to be able to do that, you're breaking the old kind of logic that was already in place. So you have to remove that kind of yeah, it's just an easier approach.

[00:22:40] If you don't have to think about the old implementation. 

[00:22:43] Leo Dion (Host): [00:22:43] Yeah. Yeah. That makes sense. What other red flags do you think you'll see in code that you'd like now that needs to be taken care of right away? 

[00:22:52] Antoine v.d. SwiftLee (Guest): [00:22:52] Well, what we like to do with retreads transfer is well, it's actually an open source framework we have where you can find our code guidelines, you know, like the same techs using that  source spaces. You, you notice, go in discussions you have in the community, but 

[00:23:09] Leo Dion (Host): [00:23:09] linting rules basically, right? 

[00:23:11] Antoine v.d. SwiftLee (Guest): [00:23:11] Exactly main thing rules we have we have Swift lint set up and we also have a few custom danger rules. They just systems which will all run during the day and, and pull requests. She, I integration we're using patronize for that, which really helps us to write consistent code and it could easily be that that costs we get.

[00:23:32] Somehow doesn't apply to those rules. So I think that's a red flag for us as well, because we want to have consistent code that at least makes it easier. That's that's one part. There is another part that you can't really force through LinkedIn, and that's like structuring code decided to go for a few model, certain naming conventions using a return keyword or not, you know, like all those kinds of decisions.

[00:23:59] You want to make sure that that class is adopting that as well. So it's kind of like family of the coat you already have in place. 

[00:24:07] Leo Dion (Host): [00:24:07] Okay. So let's let me ask tabs or spaces.

[00:24:10] Antoine v.d. SwiftLee (Guest): [00:24:10] Tabs

[00:24:11] Leo Dion (Host): [00:24:11] Oh my gosh. Yeah. I don't know if we can keep her, keep doing this work. It's going to become a controversial I do, I guess. Yeah. I need two spaces. Just, just FYI. But yeah, I don't, I don't care. Like, I guess for my own part projects, I'll do two spaces, but like, if I'm on a team, I just want a rule. Right.

[00:24:34] Like, I think that's the important thing. Just have a rule if it's tabs be consistent. Like, I think that's the most important thing though, to the agreed and then. I guess like one, one thing that I, I haven't found a good Swift lint rule or Swift format rule for is one struck or one extension or one type in each file.

[00:24:57] I try to follow that rule. So like, don't have multiple classes in one file. I'll do that when I first start off. Right. But then eventually, like I split it up into like files each file for each type in each extension. And enumeration, whatever, you know what I mean? I'm trying to think what other rules I find a lot of.

[00:25:18] I don't know. Well, anything else you can think of? Do you have like a max max line limit or max limit? 

[00:25:26] Antoine v.d. SwiftLee (Guest): [00:25:26] Yeah, we have the max file length later, but you know, that's always a big struggle because sometimes it's just, you know, those, those few controls that add up so many extensions, it's really hard to just.

[00:25:39] Move them over to a different file because you also want to contain them to get a kind of 

[00:25:44] yeah, because I have, 

[00:25:45] Leo Dion (Host): [00:25:45] when I've done view controllers like that, I usually just split them up into extensions if they're way too long. And then I try to group it based on what protocol, let's try to implement. And then that way, like, okay, this one is the view controller data source implementation.

[00:26:00] Antoine v.d. SwiftLee (Guest): [00:26:00] This is the view controller whatever table view, delegate, you know, things like that. Yeah, the downside, I find there is that it's always, you know, you need to find it in a different file, even though it does files may live together in the same folder. It's an extra step to make it discoverable, which I often kind of dislike.

[00:26:18] Leo Dion (Host): [00:26:18] Yeah. Yep. I've heard that's a big pet peeve with extensions in general. 

[00:26:23] Antoine v.d. SwiftLee (Guest): [00:26:23] Yeah. Yeah. And we, we do end up doing so, but I'd rather have like a hundred lines extra in that class and make it easy to find. Instead of having the code separate. And of course all those files in the end, it's all about findability readability in your project.

[00:26:39] And if it means that it's a 600 lines file, but it's still viewable, you know, then I reached my goal. So yeah, we, we sometimes decide to use that wild market to disable the rules. 

[00:26:52] Leo Dion (Host): [00:26:52] Right, right, right. Yeah. Was there any other red flags you want to talk about? Or should I just go to the next topic?

[00:26:58] Antoine v.d. SwiftLee (Guest): [00:26:58] What I find interesting about your road that you suggest that this you know, and that's, that's often something I run into is in the beginning, you start writing your field model in the same file. So you have like a few controller and the structure for your view model in the same file. As long as that's view model is really small.

[00:27:15] You don't really feel the need to create a new file because the new file will only contain like 10 lines of code or something. And it seems kind of odd to create a whole file for that small class, you know, but the thing is over time, it could easily grow, grow into like a bigger class with more responsibilities.

[00:27:35] So if I, if I look at the code we have in place that we transfer, we often never define two instances in the same file, but it's always an interesting interesting decision. 

[00:27:47] Leo Dion (Host): [00:27:47] I feel like that's a habit I got from when I was a C# developer. And then I just carried that through, into JavaScript and Swift and, and it makes a lot of science and like, I've gotten to a point.

[00:27:58] I have like a, somewhere in my terminal history. I have a series of like batch and bash. Commands that basically splits the file for me, based on every little curly bracket, because I just, I do it so often. And it's just, it's easier to find stuff. If anything, like, I almost wish going back to your comment regarding extensions, like, I feel like.

[00:28:23] Maybe an Xcode 13. It'd be nice if like the find finding features worked better. I know it keeps getting improved, but that would, that would make it a lot easier to deal with like multiple files for a single class or type. 

[00:28:35] Antoine v.d. SwiftLee (Guest): [00:28:35] Yeah, it's a, it's an interesting one. You know, we often run into a discussion as well in our team meetup we developed do we transfer app collect by, we transfer for three iOS engineers and. That's that makes it easy to discuss things. You know, it's not really a given that a certain way of direction is the way forward. And one of my  colleagues ofte, likes to use functions in function, which is always discussion.

[00:29:01] Leo Dion (Host): [00:29:01] That's scary. 

[00:29:03] Antoine v.d. SwiftLee (Guest): [00:29:03] Scary. What is your opinion on that? 

[00:29:06] Leo Dion (Host): [00:29:06] That's really scary. That's that's that should not be done, I guess. Yeah. That's kind of my feeling because yeah, it has a, it has a sloppy Javascript feel to it when you're, when you have a function in a function. Yeah. 

[00:29:22] It gets used to it too, but you know, in some places he meant to convince me because it kind of works and it's kind of readable.

[00:29:31] Antoine v.d. SwiftLee (Guest): [00:29:31] But still, it feels so, you know, it's almost like a structure into a structure itself. So up to me, you know, it just feels like it's, it's like tangled into each other or, you know, it doesn't feel right. 

[00:29:44] Leo Dion (Host): [00:29:44] That's a hard one. Okay. Here, I'm going to try, try to. Try to try to be coherent and explain why I don't like it and I could be totally wrong, but I'm going to try it anyways, a function in sight, a function.

[00:29:59] And the reason why it reminds me of like older Javascript is because it kind of it's masking a variable. As a function, even though it's really a variable, that's essentially private. And I understand he's like trying to like, control access that way to that function. But to me, like why not just make it a file private function in the type, rather than making it inside the function itself like that.

[00:30:24] Well in, in unit testing too, like just the unit testing of that individual function is going to be a mess, which goes back to my whole point about how like unit testing, one of the best things about it has been how it's made architecture so much better in the last 10 or 15 years that it's been popular.

[00:30:41] Antoine v.d. SwiftLee (Guest): [00:30:41] Yeah, totally. You 

[00:30:42] know, and it's also not really improving the structure of the method itself. Like it's pretty hard to get an overview of what is not exactly in the method called all those inner methods, you know, and readability doesn't really 

[00:30:55] approve. 

[00:30:55] Leo Dion (Host): [00:30:55] Yeah. Is this, it, it reminds me of all the worst parts about Java script when I did a lot words, like even whatever ES6, whatever it is right now.

[00:31:05] Yeah. Thank you so much, Antonie. Let's go ahead and we'll continue with the rest of our interview in the next episode. Folks can find me on Twitter at Leo G Dion and my company is BrightDigit. If you have any comments, questions, or feedback, please let me know, reach out to me on Twitter. And then I would love for you to just take a few moments, retweet, whatever you liked about this episode.

[00:31:31] Just send me a reply, send me something on Twitter. Just letting me know what you've liked about this particular episode. And if you could post any reviews on Apple podcast, Spotify or Google podcast, I'd really appreciate it. We'll continue the rest of our interview with Antonie in the next episode in a few days.

[00:31:47] So be sure to subscribe and we'll talk to you.



★ Support this podcast on Patreon ★

Join our newsletter

Got it. You're on the list!
© Bright Digit, LLC 2018