What I Learnt Building 6 Real Estate iPhone Apps

I’ve built the following real estate related apps over the last few months. All of them are Singapore centric except for the rental yield calculator and the mortgage calculator.

  1. Progressive Payment Calculator 
  2. SG Stamp Duty Calculator
  3. Loan Affordability Calculator
  4. Property Tax Calculator
  5. Rental Yield Calculator
  6. Mortgage Calculator

Takeaways

  • When dealing with currency operations, just bite the bullet and use NSDecimalNumber. You’ll save yourself a lot of grief further down the road
  • Always try to use NSNumberFormatter for converting from NSNumber to NSString or the other way round. Don’t do things like self.label.text = @”$0.00″. Instead, do self.label.text = [self.formatter stringFromNumber:self.number] where self.formatter is a NSNumberFormatter property. Here’s how I instantiate my property.
    - (NSNumberFormatter *)formatter {
        if (!_formatter) {
            _formatter = [[NSNumberFormatter alloc] init];
            _formatter.numberStyle = NSNumberFormatterCurrencyStyle;
            _formatter.locale = [NSLocale currentLocale];
            _formatter.generatesDecimalNumbers = YES;
            [_formatter setLenient:YES];
        }
        return _formatter;
    }
  • If you’re dealing with percentages and you find yourself having to multiply/divide 100 at certain parts of your code, there’s a good chance you’re doing it wrong. Use NSNumberFormatterPercentStyle for NSNumberFormatter. Always work with the decimal form of your percent before formatting it for display at the final step.
  • Always test your app by changing the default region to another country which doesn’t have $ as it’s currency symbol. You can do so by going to Settings > General > International > Region Format. If you’re using NSNumberFormatter correctly, you should be safe.
  • Currency input sanitization can be annoying. Your sanitizer needs to handle the situations where
    • User input with currency symbol
    • User input without currency symbol

    as it was in my case. The initial input from the user doesn’t contain currency symbols. Once the formatter is applied and displayed, subsequent changes to the textfield will involve a currency symbol. It is probably worth noting that [self.formatter numberFromString:self.label.text] requires self.label.text to be in a format that contains the currency symbol otherwise it will return nil. This makes it annoying for the initial input where there isn’t a currency symbol and subsequent inputs where there is.
    My workaround for that is to enforce the currency symbol all the time. I use this little snippet to do so

To Learn, Must One Always Be In A State Of Discomfort?

Mind the Knowledge Gap

Mind the Knowledge Gap

I’ve been coding Django apps for about 2 years now. I can initiate a server running Arch Linux, get it up and running and deploy my Django app in a couple of hours. I code using Vim. I use zsh as my default terminal. I know enough unix commands to perform the usual sed/ack/grep (or Ag if you’ve downloaded Silver Searcher). Conceptually, I can explain most web development concepts (although I stil have trouble understanding exactly what a reverse proxy does). In two years, I’ve also had to learn HTML/CSS/Javascript. It’s kinda taken for granted that and self-respected web developer would auto-learn that along the way. Understanding the subtleties of Git (merge vs. rebase) and how to use it (git flow) is also one of those ‘taken for granted’ knowledge grabs. My Python isn’t the most elegant, but give me a couple rounds of refactoring, I would have spotted and corrected most of the low hanging fruit ‘mistakes’.

There were a couple of months I felt my rate of learning wasn’t improving as quickly as before. I had become somewhat comfortable in the daily routine. This didn’t last long of course. Recently, I had to build a realtime map app for one of my products,  TripEvent. To do so, I had to use gevent-socketio. Diving into this triggered a whole chain of questions that exposed my lack of understanding about what really goes on under the bonnet.

I’ve relied heavily on my pattern recognition skills (and slavish hours just practicing, building) but there is not escaping the fact that some key computer concepts still eludes me. For example: when a user lands on my website, this generates a GET request that is processed by my reverse proxy (nginx in my case) which is somehow handed off to uwsgi which then hits my django app which finally hits my database (postgres). Is this all happening on 1 process? What happens when there are 2 requests at the same time? How does tweaking my nginx worker settings affect this? How this Python’s GIL come into play? How is multi-threading or multi-processing con-currency relevant? In the context of Python, how does gevent and its greenlets overcome this? I think you guys can see where I’m getting at.

Why is it that there isn’t any resource that explains such concepts from a web developer’s point of view? Especially one that doesn’t have formal computer science training. I imagine there must be many more people like me out there, all self taught, all wondering what really goes on under the bonnet! The information as always, is all out there. It’s piecing it together and make it conceptually sound in the context of my job (web developer) that’s hard.

I am in a major state of discomfort but this is forcing to learn and read more and ultimately plug the missing knowledge gaps. I think one always needs to be in a slight state of discomfort to improve. To be comfortable and not have questions gnawing at the back of your brain is a submission that you’ve not doing anything interest or new.

How To Hire A Programmer When You’re Not A Programmer

37 Signals has a post on how to hire a tech guy if you’re not techie yourself. It’s a good high level post. Here are some of my additional thoughts from a techie point of view.

Is He On Stackoverflow?

If the programmer doesn’t have a Stackoverflow(SO) account, that’s -1 point for me. Having an SO account is a prerequisite these days. Ok, so he has an SO account, what is his activity rate like? Does has ask more questions then answers? Generally speaking, having a high score from asking questions is not as impressive as having a high score from answering questions.

Is He On Github Or Bitbucket?

It’s a very bad sign if he’s not on either sites. Look into the number of repositories he’s created and if they are popular as indicated by number of stars and forks. Also, check out the projects he has forked. Forked projects indicate an itch he’s trying to solve for his own project which shows he’s able to:

  1. Trouble shoot his own problems
  2. Get things done
  3. Use an existing solution, tweak it without re-rolling this own solution which would undoubtedly take longer and potentially be buggier

Does He Display An Ability To Learn

Programming is one of those industries which redefines the goal posts every year. To use the cliche, change is really the only constant. It is of utmost importance that he possess a growth mindset and has the ability to learn autonomously. One way of spotting this trait is by looking at his background. Some of the most effective programmers I know are autodidacts who started their career in a completely different field.  Of course, this is by no means a litmus test but it does shed light on the candidate.

Is He Intellectually Curious

This point is heavily correlated with the previous point. Most of the best programmers are intellectually curious; not necessary in programming itself. I find the best way to see this in a person is through an informal conversation. Looking at this pet projects or what he does in his free time is also a good place to start. Does he hack on arduino projects in his free time? Is he learning to play a musical instrument? Does his twitter feed contain good observations about current affairs?

Communication

Communication is an a key trait that most people overlook. A “good” programmer that is unable to communicate his ideas well is a bad programmer. Most projects that go south stems from misunderstanding of project requirements. Again, the best way to see this is having a face to face chat and see how he articulates his thoughts. If he maintains a blog, read it. If he is on twitter, follow him. One side point: if he keeps a blog that is mostly tech-oriented, that’s good sign that he’s passionate about what he does.

If you’re bringing him on trial, take note of his responsiveness and willingness to ask questions. The more initiative he takes in seeking to clarify uncertainties, the better.

Does He Give Back To The Community

No one likes to work with an asshole. One good litmus asshole test is to see if he gives back to the community. Does he hold meetup sessions? Is he answering questions on Stackoverflow? Does he blog about this discoveries? Does he active in the local user group that he specialises in? Does he respond to newbie questions in a polite manner as opposed to RTFM?

At the end of the day, you should beg/borrow/steal another programmer to screen him for his actual technical competence. If he can’t produce fizzbuzz in under 5 minutes, you’ve got a stinker no matter how well he passes all the points I’ve listed above. To quote Jeff Atwood:

“Maybe it’s foolish to begin interviewing a programmer without looking at their code first”

Sounds like a no-brainer to me.

Explain It Like I’m 5: What’s a database?

In layman terms, a database is a place where information is stored. If you are familiar with Microsoft Excel, a database is conceptually the same thing. In Excel, each worksheet contains a logical set of information presented in columns and rows. So if you have an employee worksheet, the first column could be Name, the second column Age and so forth. The rows will then represent individual employees.

This is exactly what a database does except it stores these information much more efficiently and effective. So, once you have about 100,000 rows in Excel, it starts to get slow. A database allows you to store millions of records without making it slow for you to retrieve data.

Persistence

stay on target...stay on target...

I tried learning both French and Spanish during my uni days but didn’t get beyond muy bien and deco. All my life I have also sucked at my mother tongue, Mandarin. So anyone else, I pretty much concluded that languages was not my forte.

Fast forward to today. I’ve been learning Python/Django for the last 7 months now. I can put together a databound website quite easily now. Couple of weeks ago, I dived into Vim, an IDE. For the uninitiated, the learning curve for Vim is generally kind of steep. This is coming from hardcore techies themselves. I’ve tried and given up a couple of times over the last few months. I almost gave up again during my latest attempt when I couldn’t figure out how to copy and paste from different documents correctly. But this time however, I was determined to get my tech cred and I stuck with it. Switching to Vim was probably one of the best decisions I’ve made in my short hacking journey so far (the other was picking Python over Ruby :P)

So now I’m thinking back on my hate-hate relationship with foreign languages and realised that the reason why I didn’t get very far was because:

  1. I didn’t stick with it long enough
Simple as that.
If I had gritted my teeth and overcame the early inertia that one inevitably faces when learning something new for the first time, I would have been a quad linguist by now. Obviously passion and interest plays a big role in determining your motivation for sticking with the learning. But 9 times out of 10, it’s not the lack of talent that gets you down, it’s the lack of patience.