Xcode Playground Part III: Behind the Scenes

The Xcode Playground is an interactive REPL (Read-Eval-Print-Loop).

While you’re editing the code, Xcode executes, interprets and displays the results in the different views (timeline, result and console).

You can use the Swift interpreter from the command line:

There are also online interpreters like SwiftStub.com.

All-in-all the Playground coding experience is extremely interactive and feels like magic.
But this comes at the cost of performance. Complex or computing-intensive scripts run laggy. Even in the current XCode 7.1 release I regularly encounter errors that require an XCode restart.

But that’s okay!

For learning & testing this is acceptable and in many cases a better choice then a usual test project. I use it also for SpritKit test’s wich I demo in the next and last Episode of the XCode Playground series.

Introduction to the Swift(Apple)
SwiftStub.com (online Swift Interpreter)

XCode Playground Part I: Diagrams

I really like developing with Swift for iOS for fun. With Xcode 6 (and Swift) Apple included the Concept of Playgrounds for learning, testing and so on. Coding in a Playground is interactive, per Default Xcode builds automatically while you change the code.

Playground are very simple, but also powerful. Over the next Weeks I’ll demonstrate other cool Playground Features.

Playground with 2 DiagramsLet’s have a look at the Diagrams:
In my 2 Examples I use loops and Playground tracks the variable Changes. If you use “print” the Console Output would be displayed, but to use the Diagram we just need an Variable as single Statement or an Operation as you see in the second Example.

I made a short Video to demonstrate how to open the Diagram. Note that the diagram gets updated instantaneously after changing the code!


Stop Multitasking!

A day in Life of a Software Developer
09:00: Check E-Mails, answer some of them, flag some as unread or important.
09:30: Start Working on Project A
09:45: E-Mail from Colleague,  interrupt Work immediately interrupt working to read it & answer it.
09:55: Working on Project A
10:10: A Colleague comes to your Desk and has a question
10:20: Back to Project A…
10:40: Phone Rings, another Colleague has a Questing to another Project
10:45: Back to Project A…
11:00: Meeting
12:30: Lunch

Do you know Days when you get Home after several Hours of work and ask yourself what you really have archived? Or you feel guilty because you have the feeling that you should have get more done that day? Laying in Bed, thinking about your next days Tasks?

What’s the Problem with Distractions, and Multitasking?
Software Development is a quite complex Task that requires Focus. It takes some Time to get into the Project Environment and to really understand what the Task or the Problem is. Maybe you know Situations where you were think hard about a Problem, and then BANG the phone rings and the bubble over your head bursted. After a 2 Minute call you try to remember of what you thought before and it takes a lot of time to get back into it.

Even if multitasking let’s us feel good – our Brain isn’t very good at it. Usually Multitasking takes more Time to get things done then doing one after another!

If you focus on one Task you can use your full Brain-Power to get into it and to get it done. When you really focus on a Task you feel how you get in a Zone where you work productively and make progress.

Every time when a Distraction occurs your Brain has to switch Focus. This costs Power and takes time. Over the Day you feel more and more exhausted and focussing on a Tasks gets harder.

The big Task Mountain
Do you know this Situation: You are assigned to a big and complex Task, you start working on it but again and again you drift off the another Task that seems more important?

In this Situations our Brain tends to Procrastinate: http://webstandardssherpa.com/reviews/breaking-the-perfectionism-procrastination-infinite-loop/

If we decompose a big Task into smaller ones it becomes much easier to get an Overview and to get started. You can set smaller goals, see faster results and often the Task doesn’t seem to be as complex anymore.

Kanban to the Rescue

(c() Jeff.lasovski
(c) Jeff.lasovski

As we’ve seen – Multitasking may not be as efficient as we think. Much Work in progress (WiP) forces you also to switch Context more often, but how to Manage all those smaller Task’s?

Kanban is a Part of Lean Software Development. Kanban is a tool to reduce Work in Progress and to visualise you Workflow.

Here’s an Article of Kanban in action: http://scn.sap.com/community/data-warehousing/bw/blog/2012/02/17/how-our-sap-bw-team-uses-kanban

Kanban is simple to understand and all you need are Post-It’s, a Whiteboard or Online-Tools like Jira Agile or KanbanFlow.

Tomato, help me focussing
Focus is the key to efficiency – but how can I get focussed? Try this: Disable your Mail & Phone notifications, select a Task to Work on and set a Timer for 25 Minutes. After 5 Minutes you start your next 25 Iteration. After you completed 4x 25 Minutes Blocks take a longer break. Sounds crazy? Maybe, but the Pomodoro technique works.

You can track how many Pomodoro’s you complete per day / week and measure how much of focussed work you’ve done. Don’t worry if you have 5 or less Pomodoro’s / day at the beginning. It takes some discipline to resist all the Things with that your brain will come up to prevent you from focussing like checking you Mobile, Facebook, WhatsApp or whatever. But when you get trough this you will see soon results on how much more Stuff get’s done!

Try yourself how many Pomodoro you can complete per day / week without felling to exhausted. It seems like our brain is like a muscle – if it’s overused it will end up in a hangover.

But hey, i don’t have an office – I get interrupted all the time by my colleagues!? Talk to your colleagues and explain them how they help theirselves be reducing the distractions. Ask your colleagues to send E-Mails instead and check regularly for important Task. You don’t have to read & answers all you Mails immediately, often it’s more effectively to batch E-Mail reading / answering. Respond only to urgent Mails immediately.
Your colleagues will be exited about how much more value you can deliver!

Smaller Tasks, Kanban and the Pomodoro technique are just 3 of multiple tools & techniques that help me to get stuff done more effectively and to keep work & life balanced. I use kanbanflow.com, because it’s simple to use an has  a builtin Pomodoro Timer.

I would love to hear which tools & techniques you use to work effectively and focussed!

This Article @SAP Community Network

Type less – SE80 Editor Code Templates

The “new” Editor has a few nice features that make it a bit less painful to use. I use them to prevent unnecessary typing of repetitively used Code-Blocks and to generate local Classes (Test, Exception and so on).

You can find a Collection of my Templates in a GitHub Repository. Over the time I’ll add further, so if you are interested, you may watch that Repository.

SE80 Code TemplateI you like to contribute please feel free to send a pull request!

Here’s the Repository: https://github.com/zs40x/se80_templates

This article @SAP Community Network.