Gym, QuadTree, and k-d tree

January 12, 2020 Data Structures, Design, Fun 2 comments

Recently I went to a gym with a friend of mine and we had a chat about QuadTrees and k-d trees (yeah… don’t invite software engineers to your party – they will spoil everything). He asked me to explain what QuadTree is, and I said that it’s like binary tree just with four children instead of two. He then said it must be a variety of k-d tree. “Well…” – thought I – “probably, but I don’t know”. He explained that k-d trees as used to break k-dimensional space, which seemed reasonable as QuadTree is used to break two-dimensional space. Below are definitions of the two from wikipedia as well as some of context and my drawings.

QuadTree

A quadtree is a tree data structure in which each internal node has exactly four children. Quadtrees […] are most often used to partition a two-dimensional space by recursively subdividing it into four quadrants or regions.

https://en.wikipedia.org/wiki/Quadtree

Something like QuadTree could be used to compress images or to break a map of uneven density into regions where each node would have similar density.

For breaking a map, you can think of a designing a system that handles storage of information about restaurants and other points of interest. You would like to look up the information using your location on a map. Obviously downtown of a big city would have high density of these places and you might not want to show all of them to your user. So you would break you map into more quadrants few levels down, but on the outskirts you might have only few nodes that cover larger areas.

I just drew this process of compressing an image below. What you see on the bottom-left corner (SW) is an image, which was broken on bottom-right (SE) into 4 quadrants, each of which was broken into some more, but the moment either black or white occupied entire square the process stopped. Top-right (NE) is visualization of a compressed image (not too nice), and top-left (NW) is the QuadTree with some of the leafs pointing to their position on compressed image, which needed only 67 nodes and depending on how we store the data it could be insanely small amount of data required.

SW (image), SE (compression), NE (compressed), NW (QuadTree)

k-d tree

[…] k-d tree (short for k-dimensional tree) is a space-partitioning data structure for organizing points in a k-dimensional space. k-d trees are a useful data structure for several applications, such as searches involving a multidimensional search key (e.g. range searches and nearest neighbor searches).

https://en.wikipedia.org/wiki/K-d_tree

I didn’t draw anything for the k-d tree, but on very high level the idea is similar of breaking the space and going few levels down (there exists a generalization called binary space partitioning). With k-d tree the space is broken into TWO half-spaces by one of the dimensions instead of FOUR. Say, if it was “z”, then all children to the left will have “z” of smaller value than parent, and all to the right will have greater than parent. What I find interesting about k-d tree implementation is assigning axis to levels (root “x”, its children “y”, their children “z”, next level would be “x” again and so on for 3-dimensional space).

Conclusion

Don’t be like me, read a bit about these fascinating data structures and their application and who knows, you might be able to strike a great conversation in your local gym! :)


2 comments


Approaching a software engineering problem

January 5, 2020 Career, Opinion, Success No comments

How we approach problems often defines whether we succeed or not or how hard success comes to us!

Me ice climbing

This blog post is my humble attempt to come up with some of problem solving advice for software engineers who are starting in their careers. Why would you listen to me? – You don’t have to. In fact, I would argue, that you shouldn’t take anyone’s advice at glance and at the same time be open to evaluate everyone’s advice and then make up your own mind. I do not have many credentials, other than 12 years of experience as a software engineer in various roles (SDE, Sr. SDE, Tech Lead) and various industries (outsourcing, online entertainment, nuclear energy, e-commerce). My experience is different and success is questionable. I am guilty of making career mistakes and solving problems the hard way. My hope here is that the below could save you from making same mistakes.

Worst mistake

The worst mistake of all is to die with regrets but, as not to get too philosophical, we are talking about software here. So…

It is totally normal to get stuck time to time on problems. If you never ever get stuck it might indicate that you are staying in your comfort zone impeding the speed of your progress. Therefore, imho, one of the worst things you could do to yourself at work is to let yourself stay stuck on a problem without any progress or learning and as a result with no advancement to your future career.

Understanding the problem

The first step to approaching a problem is understanding. You’ve got to identify the issues and envision how the success would look like. Sometimes this might be referred to as “working backwards”. More often than not, there will be preprocessing done by business analysts / project managers / senior engineers which results in some kind of requirements (stories, documents, tasks, etc). Your job as a software engineer is to first understand what is wanted from you. Simply state back to requirement givers in your own words what it would solved problem mean. Once you understand the problem completely proceed to the next step.

Strategizing

The second step is strategizing. You need to come up with a potential solution. You might want to brainstorm on options, evaluate them and try to come up with the best one. Decision matrixes and other techniques might help, but don’t bug yourself too much. At this step you might want to create a plan by breaking problem into smaller tasks. You might work on proof of concept or try one or few things out. I do not believe in plans themselves, but I do believe in planning as it makes you think hard about the approach. It is important not to get stuck in “analysis paralysis” mode, so once reasonable time is spent, move on to the next step even if somehow you don’t feel ready. You will never be fully ready. Take on the problem you’ve got. You might learn some new things when doing so which you didn’t anticipate.

Execution

The third step is approach execution. Doesn’t matter how great plan you had, if you fail to execute you fail. Say, you picked option x and it didn’t work out for you, do you continue to push for x or do you switch to option y, do you give up, do you seek help? What do you do? Do you feel how anxiety creeps in?

From my personal observations generally there are two types of execution: erratic and systematic.

Erratic

Basically you just start bashing the keyboard, throwing different copy-pasted blocks of code and praying it is going to work. This is that kind of approach when “<” didn’t work, so you replaced it with “<=” and it worked, but then you realized that your loop had to start with index 1 instead of 0, and so on. Eventually you arrive at the finish line. I bet that most of us, software engineers, have used this approach and it worked at times but then we felt uneasy about it.

Systematic

You think about each piece of code you write and consequences it is going to have, questioning each line of code and thoroughly testing the code. Why do I use “<” instead of “<=”? Why does the loop start at index 0? Should have I used thread-safe data structure here?How would this button look on small screen? Why does this API accept any number of items? I don’t know about framework ABC, so why not read a doc reference first? And so on – you question everything! This approach might seem like taking much more time and it does, but eventually written software has less bugs, is much more maintainable and truly solves the problem. Arguably, maturity of a software engineer can be recognized by observing them solving problems in this systematic way.

Some other bullet points

  1. Reiterating is fine. Although systematic approach wants you to think about each line of code, you might be overwhelmed to do so at once for larger project. In this case coming up with a “skeleton” solution that does something and then building on top of it (maybe changing few “bones” here and there) is totally fine. This goes along with agile methodology as well. Just don’t scarify quality with “oh, this will be one in the next iteration” and eventually never being done.
  2. Do not just copy-paste. As the joke goes: “Dev1: Damn, copied this from StackOverflow and it still doesn’t work. Dev2: Did you copy from the question or the answer?” Although copy-pasting from other parts of the project or SO, for that matter, is totally fine, what’s not fine is not understanding what you are coping or not questioning the quality of the piece of code you are copying. If the code was written by more senior developer or if most of the project is written “this was” this is not a valid justification to not try to see if anything about it could be improved. As a simple example, a developer before you might have took a shortcut by defining style right in html instead of moving it to a css class in separate file.
  3. “Don’t work hard – work smart” – although true, stinks. Most often I heard this from people who were lazier than others. There might be two types of laziness – a) the one that makes you procrastinate, and b) the one that makes you ingenious in problem solving. I’m fine with b) as long as it doesn’t come at cost of quality of your solution in terms of maintainability. Think of someone doing a+=b; b=a-b; a-=b; to swap two integers because they didn’t want an extra variable and now extrapolate this on on system design of your software where no-one could understand what the hell is going on. Long story short, you need to work hard and there is no way around it.
  4. Pause to learn and deliberately practice. At times you might come around something you haven’t worked with before. Stop! Take a moment to understand what it is. Reading one of two pages of documentation or going through “hello world” tutorial might save you a day or few. As an example, you might need to integrate a library into your project and it may look overwhelming as the project is huge. At this point it is best to implement simplest possible project with the library to understand how it works before spending days integrating it and then not understanding why it isn’t working.
  5. Seek help but do your due diligence. It is totally ok to ask others questions – this is the way to learn. At the same time it might not be appreciated to ask something that can be found online or in documentation with a simple query. Also learn to ask how to ask help http://xyproblem.info/
  6. Time bound. Never get stuck on something for too long. Put some boundaries for specific tasks. If x isn’t working, look at your strategy and unstuck yourself. You might need to escalate this with your manager.
  7. Clearly communicate. Very likely you are working in a team and have a manager. Work on improving your communication so that you can convey your status and whether you are blocked and need help. I would advice against obfuscating your status with needless information – just be honest if you are having difficulties.
  8. Retrospect and analyze if you can improve something for the future. Don’t just take everything at its “status quo”. Say, if environment setup for your project is difficult, and always takes time for engineers go ahead and improve it.
  9. Reasonably document your work. Chances are that someone will have to solve a similar problem or that you will need to explain your work at later stages. Documentation is just a tool to help you out in these situations.
  10. Add your bullet-points/thoughts/disagreements in comments!

Conclusion

It is in my personal view that approaching a software problem consists of 1) understanding the problem 2) strategizing about solutions and 3) execution of the strategy. Observation I have made over the years is that engineers tend to solve problems erratically or systematically. More systematic approach supplemented with the above bullet-pointed guidance might be helpful advice for starting software engineers, but be skeptical as this is purely an opinion. Enjoy and let me know if it helps.


No comments


2019 Recap / 2020 Plan

December 29, 2019 YearPlanReport 18 comments

My life is boring. Unlike many previous years, when I either moved a country, got a newborn, changed a job, or travelled tons of countries, 2019 turned out to be unremarkable in so many respects. I do not know if this could be because of not having a clear plan as I usually do (see my reports and resolutions for past years here) or if this is because of becoming older and less ambitious. Hoping my 2020 is going to be way more exciting and positive! Wishing you a very happy new year!

2019 Recap

Let me try to pull out at least something of notice for 2019:

  • Technically travelled around the globe in 6 days (airports: YVR->HKG->SIN->BLR->HYD->STV->BOM->LHR->YVR). Not enjoyable at all
  • Bungee jumped (pic above)
  • Leaned to solve Rubik’s Cube (personal record 2m41s)
  • Visited real home (Ukraine) and previous home (Austria)
  • Drove from Vancouver all the way to Death Valley and back
  • Ran 52 times with total distance 311 km
  • Worked out 107 times
  • Gained 7kg. Yes, on purpose and it wasn’t any easy as I’m super skinny guy with insanely high metabolism, yet after this my BMI is still < 20
  • Set some personal records (half-marathon in 2h00m, 10km in 52:41, 1km in 3:50, longest run at 33km, pushups in a single set 101, pushups in single workout session 600, grouse grind of 2830 stairs in 46min)
  • Listened to/read 24 books
  • Managed to get at up around 5AM-6AM for couple of months and gave up
  • Solved 282 leet code problems and haven’t given up yet
  • Wrote 6 blog posts (shame!)
  • I didn’t use Facebook, rarely used Twitter, watched only 2-3 TV series, went to cinema only once and this is all good (probably) except I cannot join all of the conversations
  • “O, Canada!” is welcoming. I’m now a permanent resident and feel myself more like at home than I felt in Austria

Bad things:

  • Created an instagram account and that thingy eats some of my time
  • Cannot get up even within 1 hour after alarm going off
  • Made very few friends (too few in fact)
  • Visited 0 conferences
  • Contributed to 0 open source projects
  • Learned 0 new programming languages
  • Learned 0 new frameworks
  • Spoke at 0 events
  • Got 0 promotions
  • 0 interviews given [Edit 5Jan2020: from contact to offer or rejection]
  • Can come up with N+1 things with number 0 and where I would want it to be > 0
  • … you got the idea

Can have anything; cannot have everything

While some of those good things might seem interesting or even inspiring and some of bad things might not sound too horrible, I hate to celebrate. Problem is that I do not feel any progress in this year whatsoever. One intriguing thing that I came to realize is that I do have resources (relative youth, great health, some money) allowing me to do so many things, but sadly I cannot do everything I want and, maybe, I shouldn’t. Let me bring a quote from one of the books I read recently:

… you can have just about anything you want, but not everything you want. Maturity is the ability to reject good alternatives in order to pursue even better ones.

Ray Dalio, Principles: Life and Work

This is so sad! We don’t know what is right in this life and there is no “start over” button, at the same time “game over” is coming for everyone.

2020 Plan

So what’s up for the year 2020? A change! I don’t want any more children as two are already giving me hard time, but I don’t mind changing something about my work, learning something new and exciting, traveling somewhere exotic, or coming up with some fun that makes me and others happy.

Motto for the year 2020: “Break the records!

Last updated 1 April 2020

  1. [Edit 29Jan2020] Spend more quality time with kids in 2020 than in 2019 as measured by wife’s opinion
  2. Travel a distant country (candidate New Zealand, other places count) Changed thsi to be a long 2+ weeks roadtrip.
    COMPLETED
  3. Write 24 blog posts, of which at least 12 are of a technical content
  4. Listen to/read 24 books
  5. Run 52 times and take part in a race (candidate VanSunRun on 19April)
    COMPLETED
  6. Ski 12 days (night skiing after work counts)
    COMPLETED
  7. Improve swimming by going 10 times to swimming pool (consider a course)
  8. Learn to walk on hands
  9. Work out 104 hours
  10. Gain another 7kg of pure muscles (70kg, BMI of 22, fat 11-15%)
  11. Drive a racing car
    COMPLETED
  12. Go indoor climbing 10+ times, learn to do 5.10+ YDS and V4+ Hueco (USA)
    COMPLETED
  13. Some adrenaline rush thingy (skydive, bungee, paraglide, etc)
  14. Learn a programming language (tiny project counts ~3 blog posts)
  15. (re)-introduce myself to Machine Learning (basics + TensorFlow)
  16. Sleep 8-9 hours, but learn to get up with damn alarm instantly (15 sec). This one might be the most challenging as this is a horrible habit of mine (hitting “snooze” for 2 hours)
  17. Limit read-only social media activities to 2 hours a week (scrolling Facebook/Twitter/Instagram/LinkedIn, excl. posting and messaging people) as to produce instead of consuming
  18. Meaningful work related change
    COMPLETED
  19. Solve 100 leet code problems
  20. Visit a tech conference and/or some tech meetup(s) (2+ counts)
  21. Quit regular money wasters (going out for lunch, 5$ coffee, etc, max 1 a week or 52 in a year)
  22. Reduce coffee (max 1 per day); best if I could go cold turkey
  23. Increase focus at work (track screen time and distractions)
  24. Invest 20% more money in 2020 than in 2019
    COMPLETED

Ok, these are 24 items. The goal is to complete at least 12 of them. Obviously some are more important and challenging like work related change and some are way less important and easy like learning to walk on hands, but, as a matter of fact, 92% of new year resolutions fail, so promising to do >=50% of the list might be a reasonable approach.

Happy New Year!

Dear reader, what’s your plan for the year 2020? Do you have one? Is it achievable and specific enough so you can keep yourself accountable?


18 comments


Embrace the challenge to avoid procrastination

December 22, 2019 Opinion No comments

This post is highly opinionated, personal, and demotivating. Don’t read.

You may be procrastinating at the moment by reading this blog post the same way you do when you scroll Twitter/Instagram/Facebook/Reddit. If you have something more important to do now, do it now! Really, do it!

I don’t mind if you are not going to finish reading – this post is far from perfect. Also it might be the reason why it exists in the first place, since as they say “Perfectionism is a prime cause for procrastination, because demanding perfection usually results in failure.” Last call for action – go and do the thing you are postponing to do even if it won’t be perfect!

That crunch time

A lot of us tend to do everything at the very last moment. Sometimes working in the last moment is intense and very productive. Remember that night before the exam in school? What about crunch time at work not so long ago? If you succeed, last moment triumph has a certain joyful taste to it. If you fail, you feel miserable and crashed.

I remember a time at one of my previous jobs when I sat till 6AM fixing critical bug related to monetary operations, writing tech post and then coming to the office around 12PM like a hero (well at least in my own ego eyes). Moments like that made me happy, but those were my 20s. Now I really want to have my 8 hours of sleep and a sustainable pace of work.

Time management techniques don’t work. Do they?

There are time management techniques that try to address these issues so that you can plan and complete your goals throughout the time. For instance, there is one where you split your tasks into 4 groups like on the picture below.

The idea is to make yourself work on important but not very immediate tasks (B) so you don’t end up with important and urgent ones later on (A). And in no way you want to be working on (C) or (D). The idea is good, but it doesn’t work for me at all, and likely it doesn’t work for some of you.

One other idea is called “pomodoro” requiring you to split your work into 25 minutes of highly intense and focused work. This one mostly works for me but I have rally hard time sticking to it for a long time.

There are tons of other methods to make you work on things you would rather do later, like “East That Frog!“, but my argument is that these techniques suck a big deal just because they assume people are rational.

We are irrational, emotional, impulsive, lazy (ok, maybe not you) and we do not operate like machines. If something is not intrinsically motivating there is very little you can do about it. How about doing it tomorrow? (you know that mysterious place where 99% of human productivity is preserved)

Not suggesting anything

I cannot suggest doing anything as I am not an authority on anything. I know next to nothing about time management. I know next to nothing on motivating people. At the same time we all know what we need to do, but we just aren’t doing it. For instance, there are numerous books, techniques, “gurus”, programs, whatever for loosing weight, but everyone, and I mean everyone, knows that it all boils down to “Eat less, exercise more!” that’s it. Yes, that’s it, and yet despite majority fails. It only works if you fall in love, or, say, you are an actor to take that 10M gig or something else of high intensity. Sad, but true. You must be demotivated by now. Sorry.

Utilize what works

There are some things that work for me even when it is about doing something I don’t want to. Shame to acknowledge, but these are based on opinions of others about me (yes, that thing that we say isn’t important, but at the same time is often the most important to most of us, social creatures). Maybe some something else might be the kicker for you. Below are some things that work for me:

External visibility of progress

I find it helpful to state my commitments publicly. This generates pressure to complete whatever promised as not to look bad in eyes of others.

Self-imposed deadlines

In the past I would sign up for things that I knew I had to do but would always postpone, like that nasty certification exam or language exam or whatever. It works because there is an approaching deadline. On this note:

A rational decision maker with time-consistent preferences would not impose constraints on his or her choices. But if people impulsively procrastinate, and if they also are aware of their procrastination problems […], self-imposing costly deadlines can be strategic and reasonable.

Ariely, Dan; Wertenbroch, Klaus (2002) “Procrastination, Deadlines, and Performance: Self-Control by Pre-commitment” (PDF). Psychological Science.

Challenges

I love being better than my previous self. This works best when it is something measurable, like personal record of some sort. This also works great if others would find it admiring. I know this worked for me really well as for instance I would complete my 200km running challenge in Sep 2016 despite being injured. These days I’m trying to play this game as well. I’m currently in four challenges where I promised to stick to my commitments to four different people. I also have few self-imposed challenges (not sure if these would work).

Hey, you, my reader!

If you have something you want to do, but you’ve been putting off lately, I am challenging you: play a challenge game with someone by promising them to complete the thing you want to do or otherwise you will complete a punishment (let them come up with it), ask the other person to do the same so both of you gain something from the interaction. Make sure it is something you can measure and share, also time bound it (week, two, month).

If we know each other, I would love to play this challenge game with you as well. Get in touch!


No comments


Having Fun Solving Leet Code Problems

December 12, 2019 Interview No comments

Disclaimer: anything you read in this blog post is my own opinion and doesn’t represent opinion of my current or past employers in any way.

Profile link: https://leetcode.com/andriybuday/

For those of you who are looking for landing a Software Development Engineer job at a large tech company being able to crack the coding interview is essential.

You might be a reader from outside North America and are not really used to the kind of software interviews common here, but the harsh truth is that you have to grind college/university kind of coding problems before the interview.

Of course, the argument always goes that you should be a problem solver and that interviewer is accessing your approach to tackling a problem as well as your comprehension and communication skills. My counter argument is that preparation matters a big deal and even people with enormous experience and track record of deliveries would have difficulties if they haven’t brushed on algorithms in a long while.

Let’s do a thought experiment: let’s imagine there are two deep copies of you. By “deep copy” I mean that you both have absolutely identical personalities, knowledge, background, experience. Now you are both to be interviewed in one month at a big company. Copy One doesn’t have time to prepare and just looks up what are the main types of questions. Copy Two takes a month of vacation and sits at TopCoder / LeetCode / HackerRank / GeeksForGeeks solving, say 300-500 problems. Copy One is also capable of doing it as both of you did well in university XX years ago. Now when the interview comes, copy Two just shines and cracks all questions. Copy One struggles with solving problems but manages them somehow. Both do almost equally well on behavioral and design questions, though copy Two still has an edge as all of her/his stories are pre-prepared. So when the performance of these two copies is compared copy Two wins even it appeared both had similar cognitive and communication skills. What hiring company gets is almost identically same employee with a difference of 1 month of intensive practice, which has 0 effect on day-to-day job or quality of work.

Nevertheless there are some positive sides to these kind of interviews. One of them is that they are somewhat standardized and candidates are generally judged against the same bar. Another very obvious aspect is that these problems require writing code. If you go to an interview for a software engineer role and the main skill of your job isn’t accessed then there is something wrong with that interview. Here is the quote for this:

Talk is cheap. Show me the code.

Torvalds, Linus (2000-08-25)

My favorite types of questions for interviews are those (a) that could be solved in multiple different ways from least efficient to most efficient; even better are those (b) that start very simple but allow interviewer to make the problem ever more difficult, say by increasing the limits or converting input to a stream instead of an array, or by adding complication that requires alternative approach. Though an ideal problem, in my opinion, would be a problem that satisfies both conditions (a) and (b) and also is close to potential real-world task (c).

Problems at interview preparation websites, such as LeetCode, might satisfy the condition (a) from above, but rarely satisfy (b) or (c). I almost never see problems that would be (a), (b), and (c) – those would be fantastic.

Some example of a set of problems that satisfy (a) and (b) at LeetCode is classical easy problem “Best Time to Buy and Sell Stock” that can be solved with brute force O(N²) or more efficient O(N), but then there is a twist by adding transaction fee, when you would need to come up with a dynamic programming solution, there are many other twists. Here are variations: 1, 2, 3, 4, 5, 6. Some example of a problem that matches condition (c) would be implementation of an iterator interface, like “Flatten Nested List Iterator“.

Personally I’m not good at solving coding problems. I did participate in ACM competitions back in the university days, but I was always 3rd person on a team – kind of banging my head against the wall on a single problem while the other two guys were bashing the keyboard or coming up with magical math formulas.

I keep practicing on LeetCode mostly to keep myself in a good form. At the moment I have 407 out of 1285 problems solved. I bought myself premium subscription as it unlocks some problems and makes submission process faster. It also unlocks some of the mock interview functionality. Again I suck, but this kind of stats please my eyes (previously solved problems appear in mocks at times so I just know how to solve them).

Another fun activity you can do at LeetCode (without premium subscription) is to take part in Weekly Contests. Please let me know if you are competing as well and want to chat (my contacts are always easy to find andriybuday everywhere or leave a comment).

I really do horribly on these ones, though I find it ok to share as long as it helps me improve.

Recommendations?

This post wasn’t much about how to prepare to the interview nor an overview of coding practicing resources, though if you are interested, read about the interview process online, consider buying yourself the book “Cracking the Coding Interview” or other top resources. Remember that big companies often have the information on their process public, for example facebook on their interview process. Make sure you prepare for system design interview as well. But most importantly of all: practice, practice, practice!


No comments


Book Review: “Designing Data-Intensive Applications”

November 24, 2019 Book Reviews, Design No comments

Designing Data-Intensive Applications

The book “Designing Data-Intensive Applications” is definitely one of the best technical software engineering books I’ve ever read. Also it is probably the best one you can use to prepare for system design interviews in big tech companies, so take a note. I personally made three small tech talks within my tech team based on this book and plan to maybe do few more. Engineers love this stuff.

The book is very crisp and well structured dive into architecture of under-the-hood workings of distributed data systems, such as databases, caches, queues focusing on fundamentals rather than specific implementations. The book is also based on lots of scientific research which is properly referenced so you can always go deeper into any of given topics if you would like to.

Here is the list of all of the chapters, with some of the notes, and random comments from me (not well structured, but gives a good idea on what the book is about):

  1. Reliable, Scalable, and Maintainable Applications
    • Martin Kleppmann brings in main terminology and fundamentals in this chapter:
      • Reliable – system works correctly, even when faults happen.
      • Scalable – strategies for keeping performance good under load.
      • Maintainable – better life for engineering and operations.
  2. Data Models and Query Languages
    • Data models as in three main types of databases: document, relational, and graph, and sometimes full-text search can be considered as another data model type.
  3. Storage and Retrieval
    • Awesome chapter where the author builds database starting with simplest possible file commands like:
      #!/bin/bash 
      db_set () {
           echo "$1,$2" >> database
      } 
      db_get () {
           grep "^$1," database | sed -e "s/^$1,//" || tail -n 1 
      }
      
    • And then expanding this to log-structured databases (Bitcask, SSTables, LSM-trees, Cassandra, Lucene, etc) and to update-in-place ones, with B-trees being the main example of these and core for effectively all relational databases.
    • In this chapter the author also talks about two types of categories of databases – those optimized for transaction processing and those optimized for analysis.
  4. Encoding and Evolution
    • This chapter is looking at different types of encoding, including popular JSON, XML but also those that are language specific or those that are used to write data to disk and also all kinds of problems that come with backwards compatibility and rolling upgrades.
  5. Replication
    • The chapter on replication explains of single-, multi-, and no- leader replication, touching of potential problems you might face with them, such as “split brain“, “seeing into the future” because of the replication lag, etc, and solutions to those problems.
    • Simple example of split brain is in single-leader replication when the leader node becomes temporary unavailable and one of the replicas is elected as leader, though when the old leader comes back online it still considers itself to be the leader. These inconsistencies and situations have to be be handled in properly designed distributed systems.
  6. Partitioning
    • Key-range partitioning – partitions based on ranges of sorted keys.
    • Hash partitioning – hash function applied to each key and partitions are based on ranges of hashes.
    • Local document-partitioned indexes – secondary indexes stored in the same partition. Read requires scatter/gather across all partitions, write is to single partition.
    • Global term-partitioned indexes – secondary indexes partitioned as well. Read from single partition, write to many.
  7. Transactions
    • Race conditions:
      • Dirty reads – read even before data committed.
      • Dirty writes – another client overrides old uncommitted data.
      • Read skew – client sees different parts of database at different times. Preventable by snapshot isolation.
      • Lost updates – two clients in read-modify-write overriding each others data. Preventable by snapshot isolation or manual lock.
      • Write skew – premise of the write decision changed since it was read by a transaction. Preventable by serializable isolation.
      • Phantom reads – transaction reads data matching search conditions that are being changed by another client. Preventable by snapshot isolation.
    • Serializable transaction types: executions in serial order, two-phase locking, serializable snapshot isolation.
  8. The Trouble with Distributed Systems
    • All kinds of crazy things can go wrong when you are dealing with distributed systems are discussed in this chapter, including lost network packets, clocks going out of sync, temp failures of nodes, heck even sharks biting underwater network cables. Here is screenshot from youtube for fun:
  9. Consistency and Consensus
    • Achieving consensus means making all of the nodes agree on irrevocable decision. One of the ways to achieve this without implementing own consensus algorithms is to “outsource” it to tools like ZooKeeper.
    • Leaderless and multi-leader systems do not require consensus, but they need to cope with such problems as conflict resolution.
  10. Batch Processing
    • Unix tools such as awk, grep, sort have the same processing principles as MapReduce. Same concepts extrapolate into dataflow engines as well. The author shows how two main problems of partitioning and fault tolerance are solved and then goes into join algorithms for MapReduce: sort-merge joins, broadcast hash joins, partitioned hash joins.
    • Batch processing jobs read some input of data and produce some output, without modifying the bounded input.
  11. Stream Processing
    • Stream processing is different to batch processing because the input is not bounded and is never-ending, therefore sorting does not make any sense and data is served by message brokers.
    • Two types of message brokers are discussed: AMQP (order not preserved, messages assigned to consumers and deleted upon acknowledgment by consumer) and log-based (order preserved and same consumer receives all messages from same partition, messages retained and can be reread).
  12. The Future of Data Systems
    • One of the interesting approaches to designing applications is to shift amount of work done from the read path to the write path. I.e. you would do more of preprocessing when writing via materialized views and caches so that when you need to read everything is prepared for you and query is super efficient. This technique is probably something that is used often when solving scaling and latency problems.
    • I especially liked the last chapter on the Future of Data Systems and section “Doing the Right Thing” entertaining on implications of intensive data usage and trying to automate things based on data. One interesting thought experiment is to replace the word data with surveillance: “In our surveillance-driven organization we collect real-time surveillance streams and store them in our surveillance warehouse. Our surveillance scientists use advanced analytics and surveillance processing in order to derive new insights.” This becomes scary, especially when we try to justify automatically made decisions without looking at ethical implications. Another interesting quote brought in this sections is this “Machine Learning is like money laundering for bias“.

Conclusion

If you are software development engineer working on scalable distributed systems is book is simply must read. Totally and absolutely recommended. I will be going through some of the chapters once or twice again as one read is not enough. Let me end with this fancy quote brought up in the book:

“The major difference between a thing that might go wrong and a thing that cannot possibly go wrong is that when a thing that cannot possibly go wrong goes wrong it usually turns out to be impossible to get at or repair.”  – Douglas Adams, Mostly Harmless (1992)


No comments


Approach to System Design Interview

October 7, 2019 Design, Interview, Opinion No comments

Designing something like Dropbox or other well known service is one of the standard System Design Interview (SDI) questions at FAANG companies. This post is for self-educational purposes focused on how to approach SDI question. Also this does not represent how any tech company is designing their software or is interviewing candidates. Though, feel free to use it as a guide for your SDI if you find it useful.

I like to break SDI into four phases. You want to get to the last phase when interviewer is making the problem harder by asking you follow up questions.

Scope, Requirements, Interfaces

The most important part that sets the tone for the entire interview is to clarify requirements with your interviewer. Try to understand what functional and non-functional scope of the problem they expect you to cover.

Functionally Dropbox “offers cloud storage, file synchronization, personal cloud, and client software”. You can list these as bullet points during the interview (any device accessibility, automatic file synchronization, file sharing, file storing, backups, team collaboration, security, etc).

Something like Dropbox will have to handle millions of users, have scalable, available, and performant backend. Ask for number of users, active users, devices, etc to be able to estimate required storage, network capacity and understand if partitioning and how much of replication of data is required. This can be used in calculations later on. Something like: 2K (avg. files) * 500Kb (avg. file size) * 1B (tot. users) ~= 1PB (file storage).

It is always a good idea to define interfaces of your system. APIs exposed by server are usually a great way to start. Define interfaces like list of REST calls or just names of APIs.

Component High Level Design

After gathering the requirements and documenting main interfaces proceed to listing major components of the system. You might not be able to list everything, so mentioning that there are other aspects that you not fully covering, but can get back to them when required (examples could be: authentication, payment system, integration with external systems, etc).

At this stage you should arrive at key ideas to solving the design. Key ideas for designing Dropbox could be: split large files into multiple chunks; keep chunk metadata in database locally and sync to server; receive and upload files via synchronization queues.

Once key solution ideas are clear, draw some boxes. It is best to start from top and proceed to details. In our Dropbox example it could be Backend and Frontend. Backend could consist of File Storage, Metadata Database, App Servers and Queues. Our Client could be split into logical parts. Many similar posts (not sure about origin) suggest to split client into Chunker (split files into multiple), Watcher (watches local folders and server for updates), Indexer (processes watcher events), InternalDb (stores metadata).

Component Details

Obviously, it is impossible to cover gigantic system, like Dropbox, in 45 minutes, so you have to focus on few aspects that are important. For instance, you can focus on database design for metadata by drawing tables and their relations, or instead you can focus on how updates will be sent to other devices by drawing sequence diagram, etc.

This could be the best stage to show your depth of the knowledge in one or the other area. More often then not interviewer would be happy to focus on area you are comfortable with and then would ask you follow-up questions to understand the depth of your knowledge and whether you really know what you are talking about or just making things up while throwing buzz-words. It should go without saying that you should not be doing this.

Follow-Ups

It is a very good sign when interviewer starts to make the problem harder as it means you are doing really good. At this stage the interview can go into any direction depending on the interviewer, but often you would need to solve scalability problems (queues, caches, load balancers), availability (replications), or you could be asked to increase the scope of functionality that would make you add new components, etc.

Conclusion

This is my concise view on the parts of SDI, though your experience could be totally different depending on the interviewer, company, level targeted and specifics of a question (like, say, designing fridge controller).

I recommend reading the book “Designing Data Intensive Applications” as it is absolutely great resource to train yourself whether you are preparing yourself for interview or just trying to solidify design skills. You can also try watching youtube videos and googling articles like this.


No comments


It’s all in your head: thoughts on 15 books

September 22, 2019 Book Reviews, Career, Opinion, Personal 3 comments

Metacognition. Seeing with your tongue. Implanting fabricated memories. Superintelligence. Immortality. Dataism as religion. Lobsters and your social status. Number anchoring when negotiating your salary. Amoral deception. Illusion of choice and of free will.

Are you intrigued? You should be. I definitely was impressed by some of the new knowledge gained and ideas covered in few books read recently. This post is a set of short one-four paragraph book reviews. Some books I do recommend and some I don’t though still mention them for my personal record and for entertainment reasons and also to prevent you from reading them. Since this is covering 15 books the post is going to be relatively long. Please bear with me.

Learn better

Key idea: Learning is a skill and you can teach yourself to be better in it.

The author advises 6 steps: value – make learning more valuable by associating it to things you appreciate, target – set learning goals, develop – practice with audience or teach, extend – constantly improve understanding of existing knowledge, relate – create relationship between concepts, and rethink – don’t get overconfident and dive deep to understand ever better.

Quote: “The act of writing is a good example of metacognition because when we think about composing sentences and paragraphs, we’re often asking ourselves crucial metacognitive questions: Who will be reading this? Will they understand me? What things do I need to explain? This is why writing is often such an effective way to organize one’s thoughts. It forces us to evaluate our arguments and think about ideas.”

At times I regret how I was studying at university – I could have been much more efficient had I known that the key is to retrieve the knowledge instead of repeatedly consuming information. My interpretation is that the brain works in such a way that when we consume information it is transmitted towards its storage destination igniting complex neural paths in one direction but to retrieve the information the path has to be ignited in the opposite direction as well or otherwise we risk “forgetting”. This brings us to the next book:

The Brain: The Story of You

The book if full of all kinds of absolutely fascinating facts about inner workings of our brain. Sometimes even slightly creepy. For instance, read this quote below:

Quote: “So not only was it possible to implant false new memories in the brain, but people embraced and embellished them, unknowingly weaving fantasy into the fabric of their identity.”

Disregard if you believe someone can implant fake memories, this book is totally absorbing and exciting read if you are new to neuroscience and psychology and want good introduction. You would get to learn about extreme adaptive capabilities of the brain and other things. As I understand it, effectively the brain is a powerful interpretation machine taking electrical signals as input (from your ears, eyes, tongue, nostrils, skin) and translating them into flow of bioelectric processing that could cause certain chain reactions resulting in physical actions and/or secretion of chemical substances (hormones) by glands effectively making us alive. Since the brain is such a powerful interpreting machine we can work on providing it with other inputs and teaching it to handle those as well. In this way a guy has learned to see with his tongue and even climb using Brainport. This is a real product for people with disabilities consisting of a camera on outside, a pad put on tongue towards which an electric picture is projected. To extend on this, there is nothing that could prevent us from extending capacity of human body.

Or, maybe, instead we can build artificial general- or super- intelligence to help us out?

Life 3.0: Being Human in the Age of Artificial Intelligence

Let’s do versions first: 1.0 – biological when hardware and software evolved, 2.0 – cultural when software is designed and hardware is how it was, 3.0 – technological when both hardware and software are designed. Here “hardware” is human body and “software” is our cognitive abilities to process information.

This book reads almost as science fiction and somehow involuntarily reminds me of movies where robots and humans exist together. The book brings questions of how the society will exist when Artificial General Intelligence becomes a reality. Would we no longer need to work? Would machines try to exterminate us as in Terminator movies or harvest for energy as in The Matrix? I liked be book for bringing all of these interesting questions, entertaining on all kinds of possibilities, and exploring potential solutions to new problems we would eventually have to face and at same time not actually being a fiction.

Can we become super-humans or even gods without the help of AI? Let’s look what the next book says:

Homo Deus: A Brief History of Tomorrow

The key idea is that we eventually become god-like and gain ability to control life and environment and Homo Sapiens goes extinct. We might eventually lose our carbon-based existence and just become information.

I really like the structure of this book taking your slowly from understanding how much progress humanity has made by overcoming such horrible things as plagues, famines, and wars. Then the book sets next goals for humanity such as immortality and eternal happiness. The author then projects his historical knowledge and recent achievements in medicine and technology into what future might bring us.

We believed in gods, science, liberalism, other things. Humanism being the main “religion” of 21th century when we celebrate our own intelligence and experiences, but the final and the last one could be Dataism. You can translate everything into data! Everything. Many people measure their pulse, sleep, etc. People with diabetes wear devices that measure blood sugar levels and inject insulin as needed. People post pics on facebook, instagram nonstop, and tweet like crazy. When I run I measure speed, pace, etc and compare to earlier myself and other runners. Oh… and I write this post. Let’s go further: wondering how good sex with your partner is – easy put data sensors that measure, duration, intensity of orgasm, analyses sweat contents and put it on a plot over period of time and you know all you desire to know and, maybe, even compare to results of others. Sounds weird? I bet, but some real companies produce products like this. Now, let’s put even crazier proposition: Do you even exist if you are not connected to net and there is no digital trace of you? Right now, you would think that you do, but maybe in future ubiquitous data stream of human life becomes their life in itself?

Quote: “Senses and emotions are biochemical data-processing algorithms”

Speaking of biochemistry:

12 Rules for life

Serotonin is natural hormone associated with feeling of happiness. It is antidepressant you can get prescribed if you’ve got depression. In lobsters serotonin is regulating posture – the more serotonin – the more open lobsters posture is – the higher lobster is in its dominance hierarchy. Let’s call them alpha-lobsters (AL). Other male lobsters would know AL are tough ones and would not take on them and female ones would be attracted to AL. Female ALs would also be the ones with all the mating choices. Lobsters existed since 350M years ago (and if you recall 65M for dinos and some 200-300K for homo sapiens). Now the interesting part: the process of regulating posture and social status is embedded in humans the same way as it is in lobsters. Yeah it is very deep inside us, but, damn, crap, no! So the first rule is “Stand straight with your shoulders back”.

I didn’t like the book, though. Except of the very first rule others are not so fascinating and exciting. Not too sure what exactly to make of the first rule or what other rules are teaching us, but the book is quite popular and the author is very interesting personality (Canadian clinical psychologist with strong views), so instead of reading I would recommend to watch this first: https://www.youtube.com/watch?v=-5RCmu-HuTg (start at 3:40) and if you still want to read all 50 shades of grey in the lobster world – go ahead.

10% Happier

Another book I cannot really recommend. Listing here mostly for myself as not to forget. I read it and, yes, it is quite interesting as a story, but not much more. The book is like a memoir of one of the journalists who discovered his way to practicing mindfulness through his personal struggles of finding himself while building his career, reporting at war, craving for drugs (adrenalin, cocaine, whatever), and interviewing notable people, such as Dalai Lama. The only learning form this book is that celebrated people are often deceiving, they are hiding things and are driven by crazy things. The author didn’t motivate me to start meditating – I still think it is not gonna work for me. Somewhat fun read though, waste of time otherwise.

Speaking of deception:

The 48 Laws of Power

Let’s start with a disclaimer: I do NOT praise this book.

This book effectively teaches you how to deceive others and how to work your way to gain power the evil way. Wikipedia says it is a bestseller popular with prison inmates and celebrities. Description on goodread has this “This amoral, cunning, ruthless, and instructive book synthesizes the philosophies of Machiavelli, Sun Tzu, and Carl Von Clausewitz with the historical legacies of statesmen, warriors, seducers, and con men throughout the ages.”

If you want to understand how amoral this is read the quotes here: https://www.goodreads.com/author/quotes/865.Robert_Greene I don’t even want to repost them here.

Key learning: bad people exist and they could intentionally be manipulating you in psychopathic ways just to get what they want no matter what the price or method. It is good to be aware of such things and try to recognize and distinguish between people with genuinely good intentions and those who are evil. Never be a victim.

The subtle art of not Giving a F*ck

One thing that I like about this one is that the author says it is ok to not try being positive all the time. At times people are overplaying it and it is weird when they pretend to be happy. Acceptance of some of the negative experiences is a positive experience in itself.

The book is an easy and extremely entertaining read, especially if you are feeling a bit stressed and worry about too many things. Definite fun. Most of us like fun, so if you are going to read/listen to it do it mostly for that reason.

Algorithms to live by

Fun book for software engineers on how you can incorporate computer algorithms into your everyday life. Just go and read. Super easy reading and wonderful way of spending your time.

Wondering how to sort your clothes and stuff in the most effective way? Like maybe sorting them by type? Nope. Wrong answer. The best way is to introduce Least Recently Used cache, making sure stuff you need the most often is always most accessible.

Go ahead and apply game theory towards making your decisions and design mechanisms for decisions instead of relying on good intentions.

Never split the difference

Ok, finally back to slightly more serious books, and I would go as far as to say that this book is a “must read” before your next job offer negation. The book is written by former FBI agent who worked as hostage negotiator.

It is also probably one of the most practically useful books for people who have office carriers like me and would like to apply negotiation techniques in almost any discussion. More often than not, “No” means “wait” or it means there is something the other side doesn’t want to reveal. Your job is to work through what the other side really wants.

Louder than words

This is a book on nonverbal intelligence. I remember it being intriguing when listening to. We humans are very interested in knowing what others think. They say body language conveys 55% of communication. If this is true then we should benefit from learning to be better at understanding nonverbal messages.

Principles: Life and Work

This is really good perspective on how you can structure your life and work around set of principles. I like the emphasis on always getting all the way to truth by overcoming your emotions, ego, and blind spots.

One of the great and unique notions introduced in the book is idea meritocracy that can be applied at workplace based on the following: radical truth – no filter on what you’re thinking, radical transparency – being super open for entire organization, thoughtful disagreement, believability-weighted decision making.

If you don’t have time for the book just want this great video on how economics works and then look at the principles for success videos. These two should be worth one hour of your leisure time. I really appreciate how Ray Dalio is trying to leave some legacy after him.

Extreme Ownership

This book is written by former US Navy-Seals who fought in Iraq and in essence is partially memoir and partially book on leadership covering 12 principles towards becoming extreme owner and a real leader. The most memorable are the first and the last. The first one is extreme ownership: always take full responsibility for your own and your team’s results, never blame anyone.

Quote: “Implementing Extreme Ownership requires checking your ego and operating with a high degree of humility. Admitting mistakes, taking ownership, and developing a plan to overcome challenges are integral to any successful team.”

The last principle one is discipline equals freedom: conquer your weaknesses, procrastination since being disciplined means being fee. This brings us to another book:

The Power of Habit

Key learning: most of our lives are structured on top of numerous habits and building right habits could propel you really far forward.

Habits have the following structure: Cue (stimuli) + Response (actions) => Reward (resulting sensations). To build a new habit you need to identify the response – which is the core of what you want to be doing, then you need to come up with cues that would repeat and eventually create craving (same timing, same location, same triggers), and then you need to make sure you get the reward or punishment. Once this is done: repeat-repeat-repeat and at one point you won’t be able to resist.

Quote: “Habits are most malleable when the Golden Rule of habit change is applied: If we keep the same cue and the same reward, a new routine can be inserted.”

Thinking Fast and Slow

This one is written by Nobel price winner and is probably based on more research done by author himself than any other book in this list. Not an easy read. I definitely recommend the book, but probably don’t listen to it like I did. Get yourself kindle or paper version.

This is a book on how we think about things in realm of two systems: system 1 – fast processing, lazy, and emotional, automatic, and impulsive; system 2 – slow processing, rational, aware, conscious, and considerate. Although the author didn’t give these parallels I tend to think about system 1 as subconsciousness or based on subconsciousness and about system 2 as that of consciousness.

Default rule. Let me give you one example: I lived in Austria for some 6 years. Had I died in car incident I would have been donor of my organs, same is the case for 99% of drivers in Austria. Now, this number is only 12% in neighboring and culturally similar Germany. This is simply because Austria uses opt-out and Germany uses opt-in system when collecting consent. System 2 needs to put consideration in case of opt-in, while system 1 is happy to skip in case of opt-out.

Loss aversion. We are more afraid to loose something than we are eager on getting more of it. Authors provide numerous examples of loose/gain propositions with exactly same statistical outcomes and demonstrate how people choose option that sounds more safe. Unfortunately in real situations what sounds safer could be irrational and more often than not people actually make the wrong decisions. This is especially important when you make money decisions.

There are many other concepts introduced in the book all backed up by research, evaluation and phrases for remembering in the end of each chapter. Just going over all of these concepts is worth your time as it might help you make better decisions. I am considering rereading kindle version of the book after some time.

Conclusion

Personally I find this kind of books very fascinating and engaging as they provoke profound thoughts on our existence and provide guides towards enhancing our future well being.

Hopefully these short reviews are useful to you and will help you pick your next read.

Thank you.

Would be happy to receive quick recommendations on similar books in comments!


3 comments


“StrengthsFinder 2.0” book and assessment

April 23, 2018 Book Reviews No comments

StrengthsFinder 2.0 by [Rath, Tom]

The book

The book starts with arguments on why it is important to focus on your strengths versus your weaknesses. The author points out that for way too long industries are trying to “fix” people, and it has some benefits, but empowering people in areas they are best at produces significantly greater results. “We found that if your manager focuses on your strengths, your chances of being actively disengaged go down to one in one hundred. However, if your manager primarily focuses on your weaknesses, your chances of being actively disengaged are 22%, and if your manager ignores you, that percentage rises to 40%.”

“StrengthsFinder 2.0” then continues with introducing 34 different talents/strengths. The book provides brief description, a few examples of how person with this quality could sound like, and then proceeds with recommendations for individual and leader who manages person with this strength.

It makes sense to take an assessment before reading through these to know which ones to pay more attention to (though you are likely to just feel when it is about you).

The assessment

Do you know those online personality assessments where they ask you 10-20 questions and then give you a result, which says “You are 75.99% leader” or something. I am very skeptical of most of such assessment, even though, people, including me, like to take those. When I opened questionnaire that comes with the book “StrengthsFinder 2.0” I was positively surprised. It is a set of 177 questions and each of them is where you need to choose between two unrelated aspects of your personality within 20 seconds. So, from the first look, it was clear that it is superior to most of other. The book is based on 40 years of research and the assessment is taken by millions of people, so there is foundation for the assessment to be good.

Result of this assessment is 5 strengths that characterize you. You get results in a form of a document that with a description, example of how person possessing each strength would sound like, and 10 ideas for action for each strength. I was shocked by how strongly those 5 resonated with my personality, so I decided to embed few of such ideas into my own growth plan.

The assessment is available only if you buy a book (I listened to it on audiable.com) or if you purchase the access code. Link to assessment: https://www.gallupstrengthscenter.com/

My results

I keep these mostly for my own record, but what surprised me about the results was how unexpected some of those were. For instance, I never think of myself as competitive person. Though when reading through qualities of a competitive person and analyzing my own behaviour, I started to agree. This explains why I was so happy to win programming competitions, or hackathon in the past, but also why I avoid taking part in competitions where my chances are slim. Competitors don’t play to participate, they play to win.

  1. Competition. People who are especially talented in the Competition theme measure their progress against the performance of others. They strive to win first place and revel in contests.
  2. Focus. People who are especially talented in the Focus theme can take a direction, follow through, and make the corrections necessary to stay on track. They prioritize, then act.
  3. Achiever. People who are especially talented in the Achiever theme have a great deal of stamina and work hard. They take great satisfaction from being busy and productive.
  4. Analytical. People who are especially talented in the Analytical theme search for reasons and causes. They have the ability to think about all the factors that might affect a situation.
  5. Significance. People who are especially talented in the Significance theme want to be very important in the eyes of others. They are independent and want to be recognized.


No comments


Thoughts on the book “Mindset: The New Psychology of Success”

November 29, 2017 Book Reviews 2 comments

 

Mindset Book

Just recently, using a recommendation, I read the book “Mindset: The New Psychology of Success”. In the book, Carol S. Dweck argues that people can be divided into two groups. Those who have fixed mindset and those who have growth mindset. This is how she explains it:

 

 

Believing that your qualities are carved in stone — the fixed mindset — creates an urgency to prove yourself over and over. If you have only a certain amount of intelligence, a certain personality, and a certain moral character, well then you’d better prove that you have a healthy dose of them. It simply wouldn’t do to look or feel deficient in these most basic characteristics.

growth mindset comes from the belief that your basic qualities are things you can cultivate through effort. Yes, people differ greatly – in aptitude, talents, interests, or temperaments – but everyone can change and grow through application and experience.

Qualities of successful people and the growth mindset

Apparently the whole book argues that people with the growth mindset usually have better odds of becoming successful. Professor Dweck demonstrates this through the research she has done. Her team showed that the view people adopt of themselves has profound impact on their lives. This resonates with a famous quote by Henry Ford “Whether you think you can, or you think you can’t – you’re right”.

When I think of myself I cannot tell if I’m more of a growth mindset or of a fixed mindset. I am afraid to fail, but at the same time I am fine with trying things I could fail in. I like to prove myself, but at the same time I am open to learning and can easily admit if I don’t know something. Top grades in high school was my thing, but this didn’t stop me from taking part in math, physics, chemistry, programming competitions even I knew that at some level I will be stopped revealing that I am not that “all knowing”.

From my own observation, many successful people whom I met in life usually had an urge to prove themselves, which is explained in the book as a quality of a fixed mindset person. These people were so much afraid to fail that they put tons of effort into things they were doing. This might be one bit where I somewhat disagree with the author. Even more, it was somewhat ironical to read about desire to prove yourself as a fixed quality from a successful person who admits of being taught of fixed mindset in her childhood.

Of course, it is totally different issue when people try to prove themselves by pretending to be smarter, cooler, or whatever. I consider this to be a very bad behavior and in general a red flag for any relationship, including employer-employee.

Learning like children

In my opinion, the chapter on parenting is where the book really excels. The advice I took for myself is not to praise my children for how smart they are, but instead praise them for their effort. I strongly agree that it is important to develop children’s desire to learn things, to encourage their curiosity, and to work on their resilience to failure. It has been for couple of weeks as I try to use this advise with my daughter and it really works. My toddler daughter now seeks to put more effort into little things she does.

We all should be more like little children when it comes to learning and trying new things. A baby doesn’t question its ability to learn how to walk. Small failure is nothing more than a learning experience. While I was writing this blog post I also stumbled upon another idea that when we are young we are full of curiosity and intrinsic motivation but overtime it is replaced by extrinsic motivation in form of grades, ratings, incentive pay, etc. I think this idea by Edwards Deming plays very well with the ideas in the “Mindset” book, especially considering that Carol S. Dweck has done a lot of her research on students and children.

I want to leave you with this great illustration of the two mindsets.Illustration of Fixed and Growth mindsets


2 comments