Nikola Brežnjak blog - Tackling software development with a dose of humor
  • Home
  • Daily Thoughts
  • Ionic
  • Stack Overflow
  • Books
  • About me
Home
Daily Thoughts
Ionic
Stack Overflow
Books
About me
  • Home
  • Daily Thoughts
  • Ionic
  • Stack Overflow
  • Books
  • About me
Nikola Brežnjak blog - Tackling software development with a dose of humor
Miscellaneou$

How to ‘make it’ as a remote developer?

A very long TL;DR

In this pompously titled post, I’m going to share a few tips on how to be successful in working as a remote developer.

⚠️ I’m going to focus on developers in this post, as that’s where my experience comes from, and I would argue that these tips can help any remote employee.

I’m not stating that no other way works, I’m just sharing what worked for me in my experience so far (10+ years = 3+ full-time remote + 7 freelance). Yes, there’s a difference between freelance and full-time remote work, but we won’t tackle it in this post. However, I will say that remote work is easier because you don’t have to go around and chase new work/clients yourself, on top of actually finishing projects on time.

In some cases, this may feel like a ‘tough love’ or exacerbating kind of post, but it’s not my intention to discourage you or come across as an asshole. Totally opposite, my hope is that these tips will help you and my intention is to motivate you to go and do/become more ?

I’m all about the Pareto principle. Meaning, doing the few things that give you the biggest bang for the buck. But here’s the catch, it means doing these few things in the best possible way.

My two ‘must haves’ can be summarized like this: do the actual work and overcommunicate that. Everything else is a ‘nice to have’. So, without further ado, let’s get into the details of these…

If you prefer the audio version, my friend and coworker Shawn Milochik and I recorded an episode about this on our DevThink podcast, so check that out.

The One Thing

If there’s one thing that you get from this post, let it be this:

⚠️ There’s no such thing as over-communication in remote work.

Communicate clearly, communicate often.

Here’s the thing; if you’re in the office, your boss sees you in the office. If you’re not, how can you communicate trust to your boss that you are working and coming to work every day at the agreed time? Here are a few things that I did, and that I suggest new folks joining my team do:

  • Commit more often
    • if you commit once every few days it could be seen as if you’re not at all working. Or, potentially worse, outsourcing your stuff. Don’t be this guy. However, if you do, then don’t surf the damn Internet at that time – instead, spend the time to improve the business at which you’re working in some other ways
  • Keep a detailed time-sheet log of everything you do and share it with your manager and your PM daily
    • you don’t have to go and document when you went to the bathroom and stuff, but each time you commit something put it in your log with the time when this happened. At the end of the day, create a summary of what you did and send that to your manager and PM (Project Manager/Product Owner) in a nice short bulleted list.
    • some may see this as an overkill or micromanagement – I see it as working towards ‘making it’. Some may argue that you already gave your update on the standup. I agree and will repeat: there’s no such thing as overcommunication in remote work.
    • the added benefit of writing these summaries is that you’re already getting prepared for your yearly review, and in cases, someone comes in and asks ‘hey what were you working on Monday?’, you’ll have a quick and concise list of things to show them. In my eyes, it’s a win-win situation for minimal effort.
  • Check your spelling in formal communication
    • when replying to official emails and in tickets, make sure to check your spelling. There are tools like Grammarly these days that can help you with that.
  • Become visible in informal communication
    • you may be more on the shy side, and I get that but try to invest some time to:
      • add ? and ? to someone’s messages in #random or #general channels
      • write happy birthday wishes
      • post some links that you read and ask for feedback
      • create polls
      • share a funny image/video
      • share an educational post/video/course
  • Jump on a video call
    • Whenever you have to discuss some idea or get some tips for solving some bug that you can’t seem to figure out, prefer video over chat. It will help you to get to know the people you’re working with.
    • While you’re on that call and when you resolve the working problem that you had, stay a bit longer on a call and get to know the person that helped you. Ask them how they’re doing. But again, use common sense. Soon you’ll figure out who likes to share stuff and with whom you can bond and with whom you can’t.
    • I’m not saying you should waste someone’s time, but everyone needs a break, so use that time to be nice and genuinely get to know someone on your team. Kindness pays off in multiple ways.
    • Pro tip: don’t force it.
  • Meet in person
    • Remote friendly companies get the value of this, and they get their remote employees at least once per year to the main HQ office. Accept that kind of invites!
    • Even if your company doesn’t pay for the trip, I’d argue that you should invest money to go to the main HQ office and spend some time there.
    • Don’t try to work your usual output while in the office. Instead, use it to mingle and chat with people.
    • Don’t restrain yourself just to the people in your team or department. I found that conversations with people from other departments helped me see some pain points they experience and was able to help them.
  • Use your 1on1 time productively
    • come prepared to your 1on1s with your manager. If there’s something that needs to get resolved, communicate it sooner rather than later.
    • set goals and aspirations with him on what you’d like to achieve in the coming year (see if you can extrapolate this to personal goals like ‘learn to play some song on some instrument’)
    • show passion and willingness to progress
    • share your ideas and ask for feedback
    • he’s there to help you (at least I think he should be), so use that

Just Do The Actual Work

If you wiggled your way through the hiring process in some company and got the opportunity to work remotely only to drag your feet around and do just the bare minimum to get by, then stop right here and don’t read onward. You should be proud of your work, and you should strive to get better at it. I won’t go into a debate of why, and I’d argue that if you’re not liking what you do, then you’re in it for the wrong reasons, and unfortunately you won’t last long.

So, do the actual work: close tickets, add ideas, research, document and share your findings of how you think something can be improved.

Without this, you can be the best communicator ever, but if you’re not doing what you’ve been hired to do, then you don’t need me to tell you what will happen.

Don’t Be a Jerk

Say you’re the new breed of the term most true senior devs despise; the super⭐ ?. And say you truly rock in terms of closing tickets.

That’s all nice, but it will only take you so far. Don’t be a jerk! If you’re so good, then share your knowledge, document it, help others, be proactive in spreading this awesome knowledge that you have!

There’s more to a senior developer than just closing tickets… Become a go-to guy for something specific in your company, and willingly help anyone who asks you about it. Take it a step further and become a leader in your team!

Go The Extra Kilometer!

Work-life balance gurus will diss me for saying this, but be prepared to go an extra kilometer (miles are overrated). Here’s my why behind this:
+ you will quickly show that you know what you’re doing
+ you’ll earn respect from your peers
+ you’ll come across as a hard-working, willing to help and goal achieving person that you are

You ask me how should you do this? Well, remember those 2 hours (on average) that you’ve gained for not having to commute to work? Use them productively to get ahead at work.

If you still don’t want to use it to sharpen your axe (sorry grammar, axe sounds stronger than ax), go for a walk/run and listen to audiobooks (Audible is worth every penny) while you do that. You’ll get two birds with one stone: exercise and reading (OK, listening, but you get my point).

Don’t kill yourself
Working extra is, I would argue, needed to prove your worth and I can assure you that the majority of people that achieved something that was important to them worked their ass off at some point in their career.

I’m by far the model to follow there and am working on it. Slowly.

However, even I would be stupid not to say that there are only so many hours in a day that you can be productive. So, do what you can in a day, and take a well-deserved break. Play with your kids, go out with your friends, take your wife for a date, go play some sport, take a dog for a walk, work in the garden… Whatever works for you, just go out and away from the computer.

Manage Your Time

There are a vast number of books on the topic of time management. One that I always recommend is Time Management Made Simple by Brian Tracy.

In case you don’t have the time to read a book (here’s simple math on why you actually do and how you can read at least 6 books per year), look into the pomodoro technique (you can learn it under 5 minutes) and apply it to your day. I challenge you to do 8 true pomodoros in a day. If you do, do it consistently for 2 weeks. After that feel free to send me a ‘thank you ☕’ for the increased productivity that came out of ‘nowhere’.

If you have the luxury of choosing the time when you’ll work, I suggest you learn about yourself in terms of when you work the best. Is it morning, afternoon, night? Just make sure to communicate that to the team, so that they know when you’re available.

Work in your teams’ timezone
This may or may not be possible depending on the timezone you’re in. If you can, great. If you can’t, make it work as best as you can. Common sense works best. People will adapt as long as your contributions/replies are often/timely.

My friend and coworker Shawn Milochik and I did an episode about Time management and productivity on our DevThink podcast so check that out in case you want to hear more about this topic.

Have written goals and todos for every day

Preferably prepare the night before, so that when you get to your dedicated place to work (see below) in the morning, you know what’s first on your plate.

This is your career we’re talking about, not a walk in the park, so don’t take the value of preparation and having big goals too lightly.

Set up a dedicated place to work

Be it your special room in the house, your closet, or whatever, just make sure it has doors. What I mean by that is that it’s so easy to get distracted in a home environment and even your family members may not understand that you’re working.

So, setting some kind of a home office is, trust me, crucial. Especially if you have kids; you won’t be able not to greet them when they walk past you. And just like that, you’re out of the flow and good luck getting back.

Some people prefer coworking spaces, but I’m firmly against that, as it’s just yet another office environment. Especially if there’s an open-floor environment. No, thank you. YMMV.

Some people tend to experience ‘loneliness’ while working remotely. If that’s you, consider going to meetups. If that’s not you, go to meetups either way. It’s a breath of fresh air to meet and speak with the people who are interested in the same topics as you are, and you may learn a new way of approaching things.

Use the tools to your advantage

Any tool can be a lever or a crutch, use them wisely. Here are some tools I use on a daily basis:

  • Slack – who doesn’t use or at least know what’s that? Emoji’s FTW ?
  • Gmail – the Boomerang and Mailtrack plugins are great
  • Google Calendar – if you’re trying to set up a meeting in your organization it helps immensely if your coworkers share their calendar with you – it makes setting up meetings so much more hassle free
  • Evernote – I use it to track all my time sheets, as well as all other notes
  • KanbanFlow – task management app with a Pomodoro timer
  • RescueTime – never fool yourself with how productive you were while at the computer
  • Dropbox – put the stuff that you can’t afford to lose here. If you’re super concerned about privacy, then check out Syncthing.
  • TextExpander – subjectively, this tool saved me from a lot of repetitive typing

Would love to hear in the comments what are the tools you use to stay productive/save time?

Conclusion

Remote work is not easy and remote work is not for everybody. If you don’t possess a certain level of self-discipline, you’ll have trouble working remotely.

However, as with almost everything in life, you can get better at it if you work hard for it and that’s why I hope some of these tips will help you.

You may agree, and you may entirely disagree with these tips. They worked for me, and they may not work for you. When applying anything from this post, use your common sense.

Don’t try to go and implement all of them at once. This doesn’t work with almost anything in life. One example that probably all of us had experience with a similar statement:

I’m going to lose 20 pounds! I’m going to do that so that I’ll stop eating all the sugary stuff, going to start running every morning for 5k, going to… And all of that starting this Monday!

We all know how those resolutions end up. Therefore, start implementing things one by one gradually, and move to another thing only once the previous one has become a habit and something you ‘just do’, and not have to think about. In case you’re interested more about habit forming and similar good stuff, an awesome guy James Clear has a blog about it, and we almost always mention his articles in our podcast.

I’ll end this post with butchering this well-known quote a bit:

Achieving anything worthwhile almost always means living a few years of your life like most people won’t so that you can spend the rest of your life like most people can’t.

How to 'make it' as a #remote #developer? https://t.co/PSdzVMGX4a

— Nikola Brežnjak (@HitmanHR) October 22, 2018

Books

The math behind reading 30 books per year

TL;DR

25 minutes reading daily is enough to read 30 books per year.

In this blog post I’m going to show you a simple math behind reading 30 books per year, so read on.

Facts

Do you know what’s the average number of books that people read per year?

Google says it’s about 4 books per year. I bet you know a lot of people that actually read closer to 0 ?

Anyways, here’s a simple math behind reading 50% more than the average, so 6 books per year.

The Premise

Would you agree that spending 5 minutes on reading per day is really not much of a time investment?

Great.

And, would you agree that in those 5 minutes you could (on average, depending on the book) read 5 pages?

Great.

Except that 5 pages is not that much, right? It’s actually negligibly small number.

Extrapolate

As with anything worthwhile in life, what if you decide to extrapolate that on a longer period and read those 5 pages per day for a whole month?

That’s 5 * 30 = 150 pages.

Again, not much, right?

Average book page length

According to this blog post, there are 240 pages in a typical mainstream novel.

Again, to make our math simpler, and to not take the lower number, let’s say a typical book is 300 pages long.

Extrapolate even more

If you continue your pace of reading 5 pages per day, and manage to do it for a whole year, you’ll end up with reading 6 whole books!

WOW!

Yes, by just spending 5 minutes per day on reading, you could easily read 50% more books than people do on average.

Upside

If you start with 5 pages a day, and you maintain that for a month, I can promise you that you’ll end up doing more and loving the process. Not just because you’ll become a faster reader, but also because you’ll fall in love with the process and you’ll want to increase these 5 minutes to more.

So now, how do we get to those magical 30 books per year?

Well, if with 5 minutes per day we can get 6 books per year, then we need to increase the number of minutes 5 fold to get to 30 books.

Yes, believe it or not, 25 minutes per day is all you need. Funnily enough, that equals one Pomodoro.

So imagine, how better off could you be after those 30 books in a year? How many new ideas could you get from those 30 books? I’d argue, a lot. But, don’t just read, implement what you read as well!

Conclusion

Give it a go, it’s a small-time investment that (for starters) you can even do while on the toilet (what!?, you’re either way staring at your phone, right? ?).

All of a sudden, you’ll be a reader – and go figure, with just 5 minutes per day ?

The math behind reading 30 #books per year https://t.co/YfL4y5HKZ7

— Nikola Brežnjak (@HitmanHR) October 22, 2018

Miscellaneou$

Ekobit DevArena 2018

TL;DR

In this post, I’ll show you some pictures and notes from the Ekobit DevArena 2018 conference.

Previous conferences

In case you’re interested, here are the posts from the previous four that I attended:

  • DevArena 2017
  • DevArena 2016
  • DevArena 2015
  • DevArena 2014

Breakfast

is the most important meal of the day ?

This is how the accreditation looked like on the back side, with the list of presentations per each track:

Conference opening

Awards

This year I was the fastest ‘painter’:

and for that I got a Sony phone:

Anyone wanna buy a phone? ?

As always, if you were active on the talks, you could get one of these:

Which would then go to the drawing pot, for a chance to win yet another set of great prizes at the end of the conference…

Keynote

The presenter was young Albert Gajšak who is the author of the awesome MAKERbuino and MAKERphone that just went live on Kickstarter a few days ago and already has $165k out of a $15k goal. Congrats!

[ngg_images source=”galleries” container_ids=”37″ override_thumbnail_settings=”0″ thumbnail_width=”120″ thumbnail_height=”90″ thumbnail_crop=”1″ images_per_page=”20″ number_of_columns=”0″ ajax_pagination=”0″ show_all_in_lightbox=”0″ use_imagebrowser_effect=”0″ show_slideshow_link=”1″ slideshow_link_text=”[Show as slideshow]” order_by=”sortorder” order_direction=”ASC” returns=”included” maximum_entity_count=”500″ display_type=”photocrati-nextgen_basic_thumbnails”]

NativeScript

Julian Steiner spoke about NativeScript. As many of you know, I’m a die-hard Ionic/Cordova/Hybrid fan (for when it makes sense) so this looked interesting because it’s not hybrid in a way that you have a web-view. Instead, you can access all the native API directly via JavaScript.

[ngg_images source=”galleries” container_ids=”38″ override_thumbnail_settings=”0″ thumbnail_width=”120″ thumbnail_height=”90″ thumbnail_crop=”1″ images_per_page=”20″ number_of_columns=”0″ ajax_pagination=”0″ show_all_in_lightbox=”0″ use_imagebrowser_effect=”0″ show_slideshow_link=”1″ slideshow_link_text=”[Show as slideshow]” order_by=”sortorder” order_direction=”ASC” returns=”included” maximum_entity_count=”500″ display_type=”photocrati-nextgen_basic_thumbnails”]

Serverless architecture

Standardly awesome Ratko Ćosić spoke about the serverless architecture:

[ngg_images source=”galleries” container_ids=”39″ override_thumbnail_settings=”0″ thumbnail_width=”120″ thumbnail_height=”90″ thumbnail_crop=”1″ images_per_page=”20″ number_of_columns=”0″ ajax_pagination=”0″ show_all_in_lightbox=”0″ use_imagebrowser_effect=”0″ show_slideshow_link=”1″ slideshow_link_text=”[Show as slideshow]” order_by=”sortorder” order_direction=”ASC” returns=”included” maximum_entity_count=”500″ display_type=”photocrati-nextgen_basic_thumbnails”]

Machine learning

An excellent talk by Valentin Solina from Aether-Signum on how they used machine learning in some real-life projects.

[ngg_images source=”galleries” container_ids=”40″ override_thumbnail_settings=”0″ thumbnail_width=”120″ thumbnail_height=”90″ thumbnail_crop=”1″ images_per_page=”20″ number_of_columns=”0″ ajax_pagination=”0″ show_all_in_lightbox=”0″ use_imagebrowser_effect=”0″ show_slideshow_link=”1″ slideshow_link_text=”[Show as slideshow]” order_by=”sortorder” order_direction=”ASC” returns=”included” maximum_entity_count=”500″ display_type=”photocrati-nextgen_basic_thumbnails”]

Motivation

Danijela Tokić Šantak gave a very interesting talk on what motivates knowledge workers these days.

[ngg_images source=”galleries” container_ids=”42″ override_thumbnail_settings=”0″ thumbnail_width=”120″ thumbnail_height=”90″ thumbnail_crop=”1″ images_per_page=”20″ number_of_columns=”0″ ajax_pagination=”0″ show_all_in_lightbox=”0″ use_imagebrowser_effect=”0″ show_slideshow_link=”1″ slideshow_link_text=”[Show as slideshow]” order_by=”sortorder” order_direction=”ASC” returns=”included” maximum_entity_count=”500″ display_type=”photocrati-nextgen_basic_thumbnails”]

Flutter

Mislav Staržik talked about Flutter, an open-source mobile application development SDK created by Google. Seems interesting, but why Dart ?

[ngg_images source=”galleries” container_ids=”43″ override_thumbnail_settings=”0″ thumbnail_width=”120″ thumbnail_height=”90″ thumbnail_crop=”1″ images_per_page=”20″ number_of_columns=”0″ ajax_pagination=”0″ show_all_in_lightbox=”0″ use_imagebrowser_effect=”0″ show_slideshow_link=”1″ slideshow_link_text=”[Show as slideshow]” order_by=”sortorder” order_direction=”ASC” returns=”included” maximum_entity_count=”500″ display_type=”photocrati-nextgen_basic_thumbnails”]

Phaser

Standardly awesome Ratko Ćosić showed off the game called Dice and Roll that he made with his family ?

[ngg_images source=”galleries” container_ids=”41″ override_thumbnail_settings=”0″ thumbnail_width=”120″ thumbnail_height=”90″ thumbnail_crop=”1″ images_per_page=”20″ number_of_columns=”0″ ajax_pagination=”0″ show_all_in_lightbox=”0″ use_imagebrowser_effect=”0″ show_slideshow_link=”1″ slideshow_link_text=”[Show as slideshow]” order_by=”sortorder” order_direction=”ASC” returns=”included” maximum_entity_count=”500″ display_type=”photocrati-nextgen_basic_thumbnails”]All in all, yet another great conference!

Till next time, drink lots of ☕! 

@DevArena 2018 was ?Here are some notes and pics: https://t.co/syTVafhEX7

— Nikola Brežnjak (@HitmanHR) October 20, 2018

iOS

How to run your app on the iPhone with the newest OS version via an older version of Xcode?

In this short post, I’ll explain how to run your app via an older version of Xcode (9.2 in my particular case) on your iPhone that has the newest OS (11.4.1 in my case at the time of this writing).

Say you update your iPhone OS to the newest version, and you open the project in an older version of Xcode and try to run it. You will most probably get an error similar to this (version numbers may vary):

Could not locate device support files on iPhone X (11.1) with Xcode (9.2 9C32c)

The problem has been addressed in these two StackOverflow posts:

  • Xcode not supported for iOS 11.3 by Xcode 9.2 needed 9.3
  • How to fix Xcode error: Could not locate device support files on iPhone X (11.1) with Xcode Beta (9.2 9C32c)

The solution is basically to go on this Github project and download the device support files and place them in the DeviceSupport folder of your Xcode app.

You can get to the DeviceSupport folder by going into your Applications, find the Xcode app, right-click on it and select Show Package Contents. Then navigate to Contents > Developer > Platforms > iPhoneOS.platform > DeviceSupport and paste the contents of the downloaded file there.

All you have to do now is to restart Xcode and run the app again.

⚠️ Now here’s the potentially tricky party; you may realize that even though you’ve downloaded the correct support files from Github (and restarted Xcode) the Xcode is still not happy with it. Say for example you’ve downloaded 11.4 (15F79) but after restarting and running again you get an error mentioning something like 11.4.1 (15G77). The solution there is to just rename the folder to that, restart Xcode and voila, it works!

Hope this helps someone ?

Programming

Code Complete 2 – Steve McConnell – General Control Issues

I just love Steve McConnell’s classic book Code Complete 2, and I recommend it to everyone in the Software ‘world’ who’s willing to progress and sharpen his skills.

Other blog posts in this series:

  • Part 1 (Chapters 1 – 4): Laying the Foundation
  • Chapter 5: Design in Construction
  • Chapter 6: Working Classes
  • Chapter 7: High-Quality Routines
  • Chapter 8: Defensive programming
  • Chapter 9: Pseudocode Programming Process
  • Chapter 10: General Issues in Using Variables
  • Chapter 11: General Issues in Using Variables
  • Chapter 12: Fundemental Data Types
  • Chapter 13: Unusual Data Types
  • Chapter 15: Using Conditionals
  • Chapter 16: Controlling Loops
  • Chapter 17: Unusual Control Structures
  • Chapter 18: Table-Driven Methods

Boolean Expressions

Except for the simplest control structure, the one that calls for the execution of statements in sequence, all control structures depend on the evaluation of boolean expressions.

Using true and false for Boolean Tests

Use the identifiers true and false in boolean expressions rather than using values like 0 and 1.

You can write clearer tests by treating the expressions as boolean expressions. For example, write

while ( !done ) ...
while ( a > b ) ...

rather than

while ( done == false ) ...
while ( (a > b) == true ) ...

Using implicit comparisons reduces the numbers of terms that someone reading your code has to keep in mind, and the resulting expressions read more like conversational English.

Making Complicated Expressions Simple

Break complicated tests into partial tests with new boolean variables rather than creating a monstrous test with half a dozen terms, assign intermediate values to terms that allow you to perform a simpler test.

Move complicated expressions into boolean functions if a test is repeated often or distracts from the main flow of the program. For example:

If ( ( document.AtEndOfStream ) And ( Not inputError ) ) And 
    ( ( MIN_LLINES <= lineCount ) And ( lineCount <= MAX_LINES ) ) And 
    ( Not ErrorProcessing() ) Then
    ...
End If

This is an ugly test to have to read through if you’re not interested in the test itself. By putting it into a function, you can isolate the test and allow the reader to forget about it unless it’s important.

If ( DocumentIsValid( document , lineCount, inputError) ) Then
    ' do something other
    ...
End If

If you use the test only once, you might not think it’s worthwhile to put it into a routine. But putting the test into a well-named function improves readability and makes it easier for you to see what your code is doing, and that’s sufficient reason to do it.

Forming Boolean Expressions Positively

I ain’t not no undummy.

~ Homer Simpson

Not a few people don’t have not any trouble understanding a nonshort string of nonpositives-that is, most people have trouble understanding a lot of negatives.

You can do several things to avoid complicated negative boolean expressions in your program:

  • In if statements, convert negatives to positives and flip-flop the code in the if and else clauses
    • You shouldn’t write if ( !statusOK ). Alternatively, you could choose a different variable name, one that would reverse the truth value of the test. In the example, you could replace statusOK with ErrorDetected, which would be true when statusOK was false.
  • Apply DeMorgean’s Theorems to simplify boolean test with negatives
    • DeMorgan’s Theorem lets you exploit the logical relationship between an expression and version of the expression that means the same thing because it’s doubly negated. For example:

if ( !displayOK || !printerOK ) ...

This is logically equvalent ot the following:

if ( !( displayOK && printerOK ) ) ...

Using Parentheses to Clarify Boolean Expressions

Using parentheses isn’t like sending a telegram: you’re not charged for each character – the extra characters are free.

Knowing How Boolean Expressions Are Evaluated

The pseudocodeThe pseudocode example of when “short-circuit” or “lazy” evaluation is necessary:

while( i < MAX_ELEMENTS and item[ i ] <> 0 ) ...

If the whole expression is evaluated, you’ll get an error on the last pass through the loop. The variable i equals MAX_ELEMENTS, so the expression item[ i ] is an array-index error.

In the pseudocode, you could restructure the test so that the error doesn’t occur:

while ( i < MAX_ELEMENTS )
    if (item[ i ] <> 0 ) then 
        ...

C++ uses short-circuit evaluation: if the first operand of the and is false, the second isn’t evaluated because the whole expression would be false anyway.

Write Numeric Expressions in Number-Line Order

MIN_ELEMENTS <= i and i <= MAX_ELEMENTS

The idea is to order the elements left to right, from smallest to largest. In the first line, MIN_ELEMENTS and MAX_ELEMENTS are the two endpoints, so they go at the ends. The variable i is supposed to be between them, so it goes in the middle.

Compound Statements (Blocks)

A “compound statement” or “block” is a collection of statements that are treated as a single statement for purposes of controlling the flow of a program. Compound statements are created by writing { and } around a group of statements in C++, C#, C, and Java.

⚠️ Use the block to clarify your intentions regardless of whether the code inside the block is 1 line or 20.

Taming Dangerously Deep Nesting

Excessive indentation, or “nesting,” has been pilloried in computing literature for 25 years and is still one of the chief culprits in confusing code.

Many researchers recommend avoiding nesting to more than three or four levels (Myers 1976, Marca 1981, and Ledgard and Tauer 1987a). Deep nesting works against what Chapter 5 describes as Software’s Major Technical Imperative: Managing Complexity. That is reason enough to avoid deep nesting.

It’s not hard to avoid deep nesting. If you have deep nesting, you can redesign the tests performed in the if and else clauses or you can break the code into simpler routines. Here are the tips to reduce the nesting depth:

Simplify the nested if by testing part of the condition

if ( inputStatus == InputStatus_Success ) {
   // lots of code
   ...
   if ( printerRoutine != NULL ) {
    // lots of code
        ...
        if ( SetupPage() ) {
            // lots of code
            ...
            if ( AllocMem( &printData ) ) {
                // lots of code
                ... 
        }
    } 
}

Here’s the code revised to use retesting rather than nesting:

if ( inputStatus == InputStatus_Success ) {
   // lots of code
   ...
   if ( printerRoutine != NULL ) {
      // lots of code
... }
}
if ( ( inputStatus == InputStatus_Success ) &&
   ( printerRoutine != NULL ) && SetupPage() ) {
   // lots of code
   ...
   if ( AllocMem( &printData ) ) {
      // lots of code
      ...
    } 
}

This is a particularly realistic example because it shows that you can’t reduce the nesting level for free; you have to put up with a more complicated test in return for the reduced level of nesting.

Simplify a nested if by using break

If some condition in the middle of the block fails, execution continues at the end of the block.

do {
   // begin break block
   if ( inputStatus != InputStatus_Success ) {
      break; // break out of block
   }
   // lots of code
   ...
   if ( printerRoutine == NULL ) {
      break; // break out of block
   }
   // lots of code
   ...
   if ( !SetupPage() ) {
      break; // break out of block
   }
   // lots of code
   ...
   if ( !AllocMem( &printData ) ) {
      break; // break out of block
   }
   // lots of code
   ...
} while (FALSE); // end break block

This technique is uncommon enough that it should be used only when your entire team is familiar with it.

Convert a nested if to a set of if-then-elses

If you think about a nested if test critically, you might discover that you can reorganize it so that it uses if-then-elses rather than nested ifs. Suppose you have a busy decision tree like this:

if ( 10 < quantity ) {
   if ( 100 < quantity ) {
      if ( 1000 < quantity ) {
        discount = 0.10;
      } 
      else {
        discount = 0.05;
      }
    }
    else {
      discount = 0.025;
    } 
}
else {
   discount = 0.0;
}

You can reorganize the code for better readability and reduced complexity:

if ( 1000 < quantity ) {
   discount = 0.10;
}
else if ( 100 < quantity ) {
   discount = 0.05;
}
else if ( 10 < quantity ) {
   discount = 0.025;
}
else {
   discount = 0;
}

Convert a nested if to a case statement

You can recode some kinds of tests, particularly those with integers, to use a case statement rather than chains of ifs and elses. You can’t use this technique in some languages, but it’s a powerful technique for those in which you can.

Factor deeply nested code into its own routine

If deep nesting occurs inside a loop, you can often improve the situation by putting the inside of the loop into its own routine. This is especially effective if the nesting is a result of both conditionals and iterations. Leave the if-then-else branches in the main loop to show the decision branching, and then move the statements within the branches to their own routines.

The new code has several advantages. First, the structure is simpler and easier to understand. Second, you can read, modify, and debug the shorter while loop on one screen; it doesn’t need to be broken across the screen or printed- page boundaries.

⚠️ Complicated code is a sign that you don’t understand your program well enough to make it simple.

A Programming Foundation: Structured Programming

The core of structured programming is a simple idea that a program should use only one-in, one-out control constructs (also called single-entry, single-exit control constructs).

A structured program progresses in an orderly, disciplined way, rather than jumping around unpredictably. You can read it from top to bottom, and it executes in much the same way.

The Three Components of Structured Programming

  • Sequence
    • A sequence is a set of statements executed in order. Typical sequential statements include assignments and calls to routines.
  • Selection
    • A selection is a control structure that causes statements to be executed selectively. The if-then-else statement is a common example.
  • Iteration
    • An iteration is a control structure that causes a group of statements to be executed multiple times. An iteration is commonly referred to as a “loop”.
  • The core thesis of structured programming is that any control flow whatsoever can be created from these three constructs of sequence, selection, and iteration (Böhm Jacopini 1966).

How important is complexity?

The competent programmer is fully aware of the strictly limited size of his own skull; therefore he approaches the programming task in full humility

~ Edsger Dijkstra

Control-flow complexity is important because it has been correlated with low reliability and frequent errors.

Android

Calling Android Devs Who Hate Spammers

TL;DR

We are looking to hire a new senior Android mobile app developer that would help our team in getting revenge on the spammers and telemarketers.

If you want to help us fight the good fight, please apply here.

!TL;DR

I’m happy to announce that we’re expanding our mobile team here at Teltech and this time we’re searching for a senior Android mobile app developer that would help our team in getting revenge on the spammers and telemarketers.

This is your chance to join a dynamic environment where you get to hone your software development skills alongside other experienced and passionate developers. At TelTech, we make software that is used by oodles of people around the globe, and every team member is crucial to our success in making our customers happy. We’ve been doing this since 2008 when we published one of the first 100 iPhone apps EVER!

We pride ourselves in our relaxed, flexible culture, where you are treated like a member of the family. We have an inspiring building, perks like free food and games, and, most importantly, good people who are always looking to have fun. We strive to provide a place where you will happily balance your work with the rest of your life for years to come.

If you’re the kind of person who thinks outside the box to solve hard technical challenges, loves learning new things, loves sharing what you know, and is passionate about making great software, this could be the place for you!

Using cutting-edge technologies, you will:

  • Improve our existing and launch new mobile apps for Android.
  • Contribute to our Web APIs for products and services.
  • Quickly prototype new ideas for market and user evaluation.
  • Mentor others to improve their mobile and general software development skills.

We look for those who don’t let themselves be pigeonholed into a specific list of functions and are willing to help out wherever there is a need.

Here’s what we expect you have:

  • 4+ years of Android experience developing consumer-facing apps
  • Strong Java skills with extensive knowledge of the latest versions of Android
  • Experience in taking a design file (e.g. Sketch, Zeplin, Photoshop) and bringing it to life on Android
  • Experience using Web RESTful APIs
  • Demonstrated success in defining and launching mobile apps
  • A positive, ‘get stuff done’ attitude and passion for learning and making great apps

If on top of the above traits, you also have one of these, it’s a plus for you:

  • Experience with telecommunications technologies such as SIP, VoIP, IVR, etc.
  • Experience with using Kotlin
  • Microservices and/or socket communications experience
  • Experience with using Protocol buffers
  • UI test automation experience, including TDD
  • UI/UX design sense

What about iOS!?

If you’re intrigued by the problems, we’re solving and would like to help out, but you’re ‘only’ focused on iOS fret not. Even though we’re not actively looking, we’re always open to establishing a connection.

So, feel free to reach out to me in either case.

Where do I sign up?

You can send your resume to my email, or via this link.

Books

Leading Snowflakes by Oren Ellenbogen

These are my notes from an awesome and more importantly practical book called Leading Snowflakes by Oren Ellenbogen. This is a very good book if you just moved from a developer role to Lead or Manager.

Switch between Manager and Maker models

  • NSC! – Never stop coding!
  • Schedule Maker and Manager times on your calendar

No one is being promoted to a managerial position to increase their productivity. We already proved our capabilities there. Our job as managers is to amplify our teammates. Our job is to ask the right questions, to encourage people to think, to challenge, to inspire.

The only way we can keep our edge is by continuously practicing our Maker skills, even if it’s on a smaller scale. Make it easy to pick small tasks you can take. If you’ve got 3 hours to be productive, it would feel counter-productive to use this time to think of tasks instead of making them happen.

Code Review Your management decisions

  • WHEN/WHO/THE DILEMMA/THE DECISION MADE/RETROSPECTION/DID I SHARE THIS?
  • discuss these dilemmas with your boss and see how he would have handled it
  • discuss dilemmas with another engineering manager and review each other decisions
  • do a retrospection every day for ten mins
  • do a retrospection once a month for 1 hour

People quit their boss, not their job

Receiving constant feedback is the fastest way to learn

Confront and challenge your teammates

  • email summaries of your 1on1’s
  • care deeply about your team but don’t care about what they think of you
  • The Asshole Checklist: a) Did I show empathy (not sympathy) b) Did I clarify my expectations c) Did I practice what I just preached
  • share harsh feedback if needed no matter what
  • don’t go helping others with their tasks
  • share your failures with the team

If you want to achieve anything in this world, you have to get used to the idea that not everyone will like you.

I used to send a summary of my conversations with my teammates including my concrete examples and recommended steps. Then, I added how I understood the other side and the next action items we agreed on. I asked them to reply back to this email with their feedback if I got it wrong or they have anything else to add. That email was archived (I had a label per teammate), and used as a way to congratulate them on their progress or to figure out together why a particular pattern keeps emerging.

Not making a decision is equally important and explicit as making one

We also have to keep in mind that bored people quit. Engineers want to improve and get better over time. They want to learn new techniques. They want to tackle harder problems. They want to gain the respect of their peers and the organization they’re a part of. They enjoy new challenges; they appreciate different solutions. It’s our responsibility to help them grow. If we’re not giving our teammates feedback and challenging them, they will become unhappy (and bored) and will eventually leave.

Teach how to get things done

  • show how something is done
  • your job is to help someone else succeed
  • small increments (1-3hrs per task)
  • write docs after the feature is finished
  • see if you can have someone teach others

A great way to amplify teaching is by showing someone else how to get things done, rather than telling them what should be done

Managers should exist for only one reason. To help those who work underneath them be successful and succeed.

Delegate tasks without losing quality or visibility

  • make a list of things you’re doing today and see which ones you can start delegating
  • use the spreadsheet from the book
  • use the one-pager template from the book

Ask yourself two questions for each task:

  • Does it utilize my unique strength and responsibilities as a manager?
  • Does it serve the leader I want to become in the long-run (does it push me out of my comfort zone)?

The idea is to define only what we expect to see happening and not how we expect them to get there

Build trust with other teams in the organization

  • in the priority meetings list three priorities that are most important for you in the next week, but acknowledge that you know what is expected of you
  • TEAM is a group of people that TRUST each other
  • There is no I in TEAM
  • ‘Thank you’ email (or public praise) for a feature well done
  • Internal tech talks
  • Cross-team exchange program
  • Tracking our team’s output in a simple spreadsheet
  • Pizzability

Sitting down with other teams and watching how our product is being used could create a better understanding of the value we produce

Premature optimization is the root of all evil – it is the same logic we should apply when we are optimizing our process.

Don’t fall in love with the solution you’ve built, but with the problem, you’re trying to solve

Automated Testing can decrease the time to deliver each feature and so increase efficiency

Optimize for business learning

Startup Metrics for Pirates: AARRR!:

  • Acquisition
  • Activation
  • Retention
  • Referals
  • Revenue

Spend 80% on tweaking features and 20% on developing new features.

Technical Debt is less scary than getting out of business

Companies fail when they stop asking what they would do if they were started today, and instead just iterate on what they’ve already done.

Use inbound recruiting to attract better talent

  • Answer questions on StackOverflow for 1hr/week
  • Guest blog posts or repost your posts on Medium or dev.to
  • Have hackathons
  • Birthday pics to Instagram, Facebook, Blog. Also do a video maybe
  • Give talks
  • Have side projects

It’s so hard to find great employees these days – everyone, all the time.

Instagram talked about their unique infrastructure and lessons learned a year before they were acquired by Facebook for 1 billion dollars.

Make something people want includes making a company that people want to work for. — Sahil Lavingia

The goal of a successful Inbound Recruiting tactic is to cause a wow factor for our future candidate. The best case scenario would be that this person will sit at home, read our content or play with our project and say oh wow, that’s amazing! I wish I could work there.

Build a scalable team

  • Vision
  • Core values
  • Self-balanced
  • Sense of accomplishment
  • Who is putting down fires? – get him to distribute knowledge and mentor others to get the job done
  • Who is an expertise bottleneck – same as above
  • Who is not building trust?
  • On your 1on1’s ask “What is the worst thing about working here?”

Own it. Never let someone else fix our mess: we understand that sometimes it’s not our fault, but we don’t believe in making excuses and pointing fingers. We believe in getting things done and take full ownership of our deliveries

If someone is kicking ass, it’s our job to recognize and celebrate it together. Most chances are, we’ll see each other on a daily basis more than we see our families. Let’s make sure we enjoy each other’s companionship.

Passion to learn & get better every single day is an agile state of mind: constant feedback, constant improvement, baby steps for large change.

Books

Coaching for performance – Sir John Whitmore

Here are my notes from the book Coaching for performance by Sir John Whitmore.

Coaching focuses on future possibilities, not past mistakes.

Coaching is unlocking peoples potential to maximize their own performance. It is helping them to learn rather than teaching them.

If blame and criticism are a prevalent communication style and this doesn’t change, relationship failure can be predicted with over 90% accuracy.

Of the spoken word: 7% in words, 38% in the way the words were said, 55% facial expression.

I think this person:
– Is a problem
– Has a problem
– Is on a learning journey and is capable, resourceful and full of potential

Intentionality – set a clear intention for a meeting. 2 min before a meeting: “if the meeting would wildly exceed your expectations, what would happen?” No limits!

Questions for building a great team:
– What would the dream or success look for us working together?
– What would the worst case look like
– What’s the best way for us to achieve success or dream
– What do we need to be mindful of to avoid the worst case
– What permissions each of us wants from each other
– What will we do when things get hard?

Open questions:
– What do you want to achieve
– What’s happening at the moment
– How would you like it to be
– What’s stopping you
– What’s helping you
– What problems might there be
– What can you do
– Who can help you
– Where can you find out more
– What will you do

Don’t ask WHY question => ask “what were the reasons” instead

Don’t ask HOW question => ask “what are the steps” instead

Top 10 questions in coaching:
– If I wasn’t here what would you do
– If you knew the answer, what would it be
– What if there were no limits
– What advice would you give to your friend in the same situation
– Imagine having a dialog with the wisest person you know; what would they tell you to do
– What else?
– What would you like to explore next
– I don’t know where to go next, where would you like to go
– What is the real issue
– What is your commitment on a scale from 1 to 10 to doing it. What can you do in doing it

1on1s:
– Goal setting for the sessions (both long and short-term)
– What do you want?
– Reality check to explore the current situation
– Where are you now?
– Options and alternative strategies
– What could you do?
– Will – What is to be done, when, by whom, and a will to do it
– What will you do?

SMART, PURE and CLEAR goals

Having a big dream brings as much work as a small dream.

To set up accountability:
– What will you do
– When
– How will I know

70 learning through experience on the job
20 learning from other people
10 formal learning

Feedback framework:
– What happened
– What have you learned
– How to use this knowledge in the future

Discussion may be facilitated by the team leader but what happens should be decided by team members.

Bonding opportunity by doing something together.

Our true values reside within us and at the deepest level, those values are universal.

Programming

Code Complete 2 – Steve McConnell – Table-Driven Methods

I just love Steve McConnell’s classic book Code Complete 2, and I recommend it to everyone in the Software ‘world’ who’s willing to progress and sharpen his skills.

Other blog posts in this series:

  • Part 1 (Chapters 1 – 4): Laying the Foundation
  • Chapter 5: Design in Construction
  • Chapter 6: Working Classes
  • Chapter 7: High-Quality Routines
  • Chapter 8: Defensive programming
  • Chapter 9: Pseudocode Programming Process
  • Chapter 10: General Issues in Using Variables
  • Chapter 11: General Issues in Using Variables
  • Chapter 12: Fundemental Data Types
  • Chapter 13: Unusual Data Types
  • Chapter 15: Using Conditionals
  • Chapter 16: Controlling Loops
  • Chapter 17: Unusual Control Structures

Table-driven code can be simpler than complicated logic using ifs. Suppose you wanted to classify characters into letters, punctuation marks, and digits; you might use a logic like this one (Java):

if ( ( ( 'a' <= inputChar ) && (inputChar <= 'z' ) )  || ( ( 'A' <= inputChar ) && (inputChar <= 'Z' ) ) ) {
    charType = CharacterType.Letter;
}
else if ( ( inputChar == ' ' ) || ( inputChar == ',' ) ||( inputChar == '.' ) || ( inputChar == '!' ) || 
    ( inputChar == '(' ) || ( inputChar == ')' ) || 
    ( inputChar == ':' ) || ( inputChar == ';' ) ||
    ( inputChar == '?' ) || ( inputChar == '-' ) ) {

    charType = CharacterType.Punctuation;
} else if ( ( '0' <= inputChar ) && ( inputChar <= '9' ) ) {
    charType = CharacterType.Digit;
}

Two Issues in Using Table-Driven Methods:

  • how to look up entries in the table
  • what to store in the table
    • the result of table lookup can be data, but also an action. In such case, you can store a code that describes the action, or in some languages, you can store a reference to the routine that implements the action. In either of these cases, tables become more complicated.

How to look up entries in the table

You can use some data to access a table directly. If you need to classify the data by month, for example, you can use an array with indexes 1 through 12.

Other data is too awkward to be used to look up a table entry directly. If you need to classify data by Social Security Number, for example, you can’t use the Social Security Number to key into the table directly unless you can afford to store 999-99-9999 entries in your table. You’re forced to use a more complicated approach. Here’s a list of ways to look up an entry in a table:

  • Direct access
  • Indexed access
  • Stair-step access

Direct Access Tables

Suppose you need to determine the number of days per month (forgetting about leap year, for the sake of argument). A clumsy way to do it, of course, is to write a large if statement:

if ( month == 1 ) {
    days = 31;
} else if ( month == 2 ) {
    days = 28;
}
// ...for all 12 months, you get the point
else if ( month == 12 ) {
    days = 31;
}

An easier and more modifiable way to perform the same function is to put the data in a table:

int daysPerMonth [12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };

Now, instead of using the long if statement, you can just use simple array access to find out the number of days in a month:

days = daysPerMonth[ month - 1 ];

Indexed access Tables

Sometimes a simple mathematical transformation isn’t powerful enough to make the jump from data like Age to a table key.

Suppose you run a warehouse and have an inventory of about 100 items. Suppose further that each item has a four-digit part number that ranges from 0000 through 9999.

First, if each of the entries in the main lookup table is large, it takes a lot less space to create an index array with a lot of wasted space than it does to create a main lookup table with a lot of wasted space.

For example, suppose that the main table takes 100 bytes per entry and that the index array takes 2 bytes per entry. Suppose that the main table has 100 entries and that the data used to access it has 10,000 possible values.

In such a case, the choice is between having an index with 10,000 entries or the main data member with 10,000 entries. If you use an index, your total memory use is 30,000 bytes. If you forgo the index structure and waste space in the main table, your total memory use is 1,000,000 bytes.

That means you waste 97% less memory with indexed access tables.

Stair-Step Access Tables

Another kind of table access is the stair-step method. This access method isn’t as direct as an index structure, but it doesn’t waste as much data space.

The general idea of stair-step structures is that entries in a table are valid for ranges of data rather than for distinct data points.

For example, if you’re writing a grading program, here’s a range of grades you might have to program:

> 90.0% A
< 90.0% B
< 75.0% C
< 65.0% D
< 50.0% F

This is an ugly range for a table lookup because you can’t use a simple data-transformation function to key into the letters A through F. An index scheme would be awkward because the numbers are floating points. You might consider converting the floating-point numbers to integers, and in this case, that would be a valid design option, but for the sake of illustration, this example will stick with floating point.

Here’s the code in Visual Basic that assigns grades to a group of students based on this example.

' set up data for grading table
Dim rangeLimit() As Double = { 50.0, 65.0, 75.0, 90.0, 100.0 }
Dim grade() As String = { "F", "D", "C", "B", "A"}
maxGradeLevel = grade.Length - 1
...
' assign a grade to a student based on the student's score
gradeLevel = 0
studentGrade = "A"
while ( ( studentGrade = "A" ) and ( gradeLevel < maxGradeLevel) ) 
    If ( studentScore < rangeLimit( gradeLevel ) ) Then
        studentGrade = grade( gradeLevel )
    End If
    gradeLevel = gradelevel + 1
wend

Although this is a simple example, you can easily generalize it to handle multiple students, multiple grading schemes, and changes in the grading scheme.

The advantage of this approach over other table-driven methods is that it works well with irregular data. The grading example is simple in that although grades are assigned at irregular intervals, the numbers are “round,” ending with 5s and 0s. The stair-step is equally well suited to data that doesn’t end neatly with 5s and 0s. You can use the stair-step approach in statistics work for probability distributions with numbers like this:

Probability Insurance Claim Amount
0.456935 $0.00
0.546654 $254.32
0.627782 $514.77
0.771234 $717.82

Ugly numbers like these defy any attempt to come up with a function to neatly transform them into table keys. The stair-step approach is the answer.

⚠️ Tables can provide an alternative to complicated logic, so ask yourself whether you could simplify by using a lookup table.

Programming

Code Complete 2 – Steve McConnell – Unusual Control Structures

I just love Steve McConnell’s classic book Code Complete 2, and I recommend it to everyone in the Software ‘world’ who’s willing to progress and sharpen his skills.

Other blog posts in this series:

  • Part 1 (Chapters 1 – 4): Laying the Foundation
  • Chapter 5: Design in Construction
  • Chapter 6: Working Classes
  • Chapter 7: High-Quality Routines
  • Chapter 8: Defensive programming
  • Chapter 9: Pseudocode Programming Process
  • Chapter 10: General Issues in Using Variables
  • Chapter 11: General Issues in Using Variables
  • Chapter 12: Fundemental Data Types
  • Chapter 13: Unusual Data Types
  • Chapter 15: Using Conditionals
  • Chapter 16: Controlling Loops

Recursion

For a small group of problems, recursion can produce simple, elegant solutions. For a slightly larger group of problems, it can produce simple, elegant, hard-to-understand solutions. ?

Java Example:

void QuickSort( int firstIndex, int lastIndex, String [] names ) {
    if ( lastIndex > firstIndex ) {
        int midPoint =  Partition( firstIndex, lastIndex, names );
        QuickSort( firstIndex, midPoint-1, names );
        QuickSort( midPoint+1, lastIndex, names );            
    }
}

In this case, the sorting algorithm chops an array in two and then calls itself to sort each half of the array. When it calls itself with a subarray that’s too small to sort-such as ( lastIndex <= firstIndex ) – it stops calling itself.

Tips for Using Recursion

  • Make sure the recursion stops – Check the routine to make sure that it includes a nonrecursive path.
  • Limit recursion to one routine – Cyclic recursion (A calls B calls C calls A) is dangerous because it’s hard to detect.
  • Keep an eye on the stack – With recursion, you have no guarantees about how much stack space your program uses. To prevent stack overflow, you can use safety counter and set the limit low enough or allocate objects on the heap using new.
  • Don’t use recursion for factorials or Fibonacci numbers – You should consider alternatives to recursion before using it. You can do anything with stacks and iteration that you can do with recursion. Sometimes one approach works better, sometimes the other does. Consider both before you choose either one.

goto

You might think the debate related to gotos is extinct, but a quick trip through modern source-code repositories like SourceForge.net shows that the goto is still alive and well and living deep in your company’s server.

The Argument Against gotos

The general argument against gotos is that code without them is higher-quality code
+ Dijkstra observed that the quality of the code was inversely proportional to the number of gotos the programmer used
+ Code containing gotos is hard to format
+ Use of gotos defeats compiler optimizations
+ The use of gotos leads to the violation of the principle that code should flow strictly from top to bottom

The Arguments for gotos

The argument for the goto is characterized by advocacy of its careful use in specific circumstances rather than its indiscriminate use.

A well-placed goto can eliminate the need for duplicate code. Duplicate code leads to problems if the two sets of code are modified differently. Duplicate code increases the size of the source and executable files. The bad effects of the goto are outweighed in such a case by the risks of duplicate code.

Good programming doesn’t mean eliminating gotos. Methodical decomposition, refinement, and selection of control structures automatically lead to goto-free programs in most cases. Achieving goto-less code is not the aim but the outcome, and putting the focus on avoiding gotos isn’t helpful.

Summary of Guidelines for Using gotos

Use of gotos is a matter of religion. My dogma is that in modern languages, you can easily replace nine out of ten gotos with equivalent sequential constructs.

  • Use gotos to emulate structured control constructs in languages that don’t support them directly. When you do, emulate them exactly. Don’t abuse the extra flexibility the goto gives you.
  • If goto improve efficiency, document the efficiency improvement so that goto-less evangelists won’t remove it.
  • Limit yourself to one goto label per routine
  • Limit yourself to gotos that go forward, not backward
  • Make sure all gotos labels are used.
  • Make sure a goto doesn’t create unreachable code.

https://t.co/AGH65l2L9F

— Nikola Brežnjak (@HitmanHR) March 12, 2018

Page 13 of 51« First...10«12131415»203040...Last »

Recent posts

  • Discipline is also a talent
  • Play for the fun of it
  • The importance of failing
  • A fresh start
  • Perseverance

Categories

  • Android (3)
  • Books (114)
    • Programming (22)
  • CodeProject (35)
  • Daily Thoughts (77)
  • Go (3)
  • iOS (5)
  • JavaScript (127)
    • Angular (4)
    • Angular 2 (3)
    • Ionic (61)
    • Ionic2 (2)
    • Ionic3 (8)
    • MEAN (3)
    • NodeJS (27)
    • Phaser (1)
    • React (1)
    • Three.js (1)
    • Vue.js (2)
  • Leadership (1)
  • Meetups (8)
  • Miscellaneou$ (77)
    • Breaking News (8)
    • CodeSchool (2)
    • Hacker Games (3)
    • Pluralsight (7)
    • Projects (2)
    • Sublime Text (2)
  • PHP (6)
  • Quick tips (40)
  • Servers (8)
    • Heroku (1)
    • Linux (3)
  • Stack Overflow (81)
  • Unity3D (9)
  • Windows (8)
    • C# (2)
    • WPF (3)
  • Wordpress (2)

"There's no short-term solution for a long-term result." ~ Greg Plitt

"Everything around you that you call life was made up by people that were no smarter than you." ~ S. Jobs

"Hard work beats talent when talent doesn't work hard." ~ Tim Notke

© since 2016 - Nikola Brežnjak