Side activities of a software developer

It always amuses me how movies depict people who work in the IT industry. In general they show somebody who is a technical genius but socially very awkward, or they are a hacker underground magician who can break into any complex system just by typing very fast. Just think about Internship, Silicon Valley, The Social Network, etc. While there are people who are like that, in my opinion somebody who has a long and successful career in IT probably also have very strong communication skills.

Think about it, we work in teams and our daily work depends on others, most of the applications that you hold dear were done by a handful of dedicated individuals who knew how to work together to reach a common goal. Let’s go through a few non-technical activities in the order in which you generally start doing them.

Continue reading

A fast Texas Hold’em hand strength calculator – part 2

In part 1 we talked about how you can attach a value to a poker hand in order to compare it versus other hands. While to code there runs quite fast 2.6 mill hands in 1200 ms, we can do better.

Imagine a bit that you are writing your own poker server, which needs to execute this calculation many times a day, or that you write a poker bot which not only needs to calculate the current hand strength, but also make predictions on how your hand evolves (usually after the strength, you calculate the percentage of the hands you win now, and you also do this calculation for each upcoming phase in order to see whether your hands has a high chance to improve or worsen).

Performance as a requirement is in trade-off with storage, usually when you want to increase performance you need to sacrifice storage, or if you want to reduce the used storage you probably end up doing more CPU work.

In our poker hand evaluator we can quickly notice that the value of the hands never change and since there are only 2.6 mill of them, it will be easy to move them to the memory. We need to find a way to assign a unique value for each hand to construct a lookup table. This is called hashing. I wrote the following class.

Continue reading

A fast Texas Hold’em hand strength calculator – part 1

I love to come back to old algorithm problems and try to solve them better then i did before. A good example of this is a poker hand strength calculator. If you played poker before you know that a poker hand is computed over five cards and its pretty simple to quickly decide who won.

It’s simple to write a function that determines the strength, but in order to make it really fast, you need to thinker a bit. You do not only need to calculate the rank of the hand (high card, pair, etc up to straight flush) but also between the same rank which hand is the better.

There is a total of 2,598,960 different hands in poker (order of cards doesn’t matter so = the number of combinations of 52 cards taken 5 at a time)

Rank Occurrences
Straight Flush 40
Four of a Kind 624
Full House 3744
Flush 5108
Straight 10,200
Three of a Kind 54,912
Two Pair 123,552
One Pair 1,098,240
High Card 1,302,540
Continue reading

One computer, two GPUs, three screens.

I know that nowadays this doesn’t seem anything special, but long ago I started to work on a project, which I deemed impossible, not worth to try, and I could have bet against its success. It wasn’t that long ago, but instead of just simply giving you the year it will be more fun to remember some facts, so let’s see if you can set your time machine correctly.

  • Robert Downey Jr escaped from a cave in an Iron Suit
  • We came out of Vault 101, got scared walking on USG Ishimura, and explored the universe on a ship called Normandy.
  • People were jamming in their cars singing “Pa Pa Poker Face …”
  • Smartphones just started to become a thing
  • You still had a chance to buy something called “Zune”
  • We were slowly moving to 16:9 screens from 4:3
  • Facebook celebrated its 100 million active users
  • Michael Jackson was still bla…, just kidding just kidding he wasn’t
  • We learned that the burst of some bubbles are not fun for anybody

See what I mean? It feels very long ago doesn’t it?

Continue reading

How to become a better software developer?

Well isn’t this the million dollar question? I’m a firm believer that, this needs to be answered to each person in a very individual and personalized manner, there is no golden answer to this, and you should search for an answer by discussing to people who you trust and accept feedback from.

That being said, there is something that worked to a certain extent for everybody who tried it out.

Don’t jump to coding right away. This is a mistake done by many, especially at an early stage of their career. After selecting a task, they jump into carrying out the modifications as much as they can, and after that they improvise the rest, or search for help. A reason for this could be that thinking was done while looking at the code instead of a disconnected manner.

Maybe next time start a task by trying to better visualize the outcome of it. Write out the main changes you intend to do in each component, this can serve as a “checklist” later to verify if you forgot anything.

Try drawing how the information will flow between components, not full fledged UML diagrams, just some boxes and lines on a piece of paper will do.

These practices will help you in many ways, for instance

  • You can discover early, which parts of the code you understand, and which parts you don’t. It is a good idea to invest some time to get a deeper understanding of the area you are about to change
  • You will get help a lot easier from more experienced peers, when you reach out to them. Your questions will be more coherent, more precise, plus you will gain a lots of points from them for working out a solution, instead of simply asking, “how should I do this?”
  • You will explain better. When talking to the project manager, client, even in just simple presentations, describing the issue efficiently can leave a very good impression on others. Remember if you look like a professional and sound like a professional …

Change takes time, so be patient with yourself!