Know your tools, Love your tools.
I've been coding for 8 years now. I worked in the industry for about 4 and developed 6 iOS apps on the side prior to Shoutt. I've coded in C, C++, Java, C#, Objective-C and a bunch of other languages. I've always used whatever environment was available - Visual Studio, Eclipse, Xcode etc. I consider myself to be very efficient, productive and good at what I do. And honestly, I never really cared much about the tools I used.
Our CTO at Shoutt is an uber-geek. Combined with awesome software and keyboard shortcuts, he dances around his computer with dexterity like Tony Stark on his incredible interfaces.
He'd always say "Know your tools". I'd think "Stop showing off. So you learnt a few keyboard shortcuts".
Anyway, I decided to learn the keyboard shortcuts for XCode. I did some quick googling and found the must knows
Open Quickly - Shift-Command-O
Go Forward - Control-Command-Right Arrow
Go Back - Control-Command-Left Arrow
Jump to Counterpart - Control-Command-Up Arrow
I felt awesome. I started to do things quicker. I felt like an "expert user".
Over the last couple of days, I decided to explore Xcode further and I discovered keyboard shortcuts were just the beginning ....
Tab based tasks - lets you create tabs that maintain their own state. So I can have different tabs for different things and navigate between each tab using simple keyboard shortcuts.
I setup an Edit tab for writing code with a primary & assistant editor, a Design tab to always opens to my xib files and a Debug tab to open to the call stack, the debug and the output consoles.
Behaviors - lets you control how Xcode behaves while building, testing or running code.
I've configured my XCode to open the Debug tab when a breakpoint is hit. So I have everything thing that I need (call stack, debug and output consoles) but only when I actually need to use them.
Version Editor - lets you compare code changes since your last commit right within Xcode.
I have a tab for Review so that I can visualize my code changes and edit them inline. (Previously, I used p4merge but Version Editor has won me over)
Built-in Git Integration, assistant editors etc etc etc.There is so much more to XCode than initially meets the eye.
Today, my workflow has completely changed. Let me give a quick example.
I want to add a button in my app, which when pressed logs a user into my application & changes its title from "Login" to "Logout". Then I want to review my code and check it in.
1. Open the .h file
2. Declare the button
3. Open the .m file
4. Define the method to run on click - Log the user into the application and change title of button in this method
5. Open the .xib file(user interface file)
6. Connect the button with its declaration and the method to be run on clicking it.
7. Run and Test
8. Goto Terminal
9. cd into the project directory
10. Use p4merge to verify your code changes
11. Commit & push
Here are a few tabs from my setup.
Edit Tab with an assitant editor (I can view the .h & .m files at the same time)
Design Tab for designing the user interface
Review Tab for Code Review.
1. In Edit Tab, Open .m file. The .h file is opened automatically in the Assistant Editor.
2. Declare the button in the .h file & the method to run on click in the .m file
3. Change to Design Tab and open the .xib file
4. Connect the button with its declaration & the method to be run on clicking it.
5. Change to the Review Tab & verify code changes.
6. Commit & Push
Now, this might not seem like it would save much time. But let me ask you a question? What if I want to rename the button, or change its position or make some other modification.( It's really annoying when this happens and this happens more often than I'd like.) Previously, I would have to re-open all the files one after the other and make the changes I wanted. Now, with tab based tasks, I have all the files open and ready for me. I just need to switch to appropriate tab and make changes.
Further, when I would run the application, the output console would automatically open up if I had any logging statements. So I'd have to keep closing the console when I resumed coding. Now I have a Build tab and a Edit tab. The build tab is automatically selected when running the app so my Edit tab is never affected.
With my new workflow, I have now become atleast twice as efficient. I have come to not only Know my tools, but also Love my tools. So, to those, like me, who don't give a damn about the tools they use - take the time to get to know your tools, to understand them and to play with them. And you'll fall in love, just like I did.
P.S - Though I've spoken about only XCode, I'm certain there are other IDE's which we can all fall in love with.
P.P.S - If you'd like to learn more about XCode, I'd recommend watching "Working efficiently with Xcode"(You'll need to have a developer account to watch this video).