Can you make small changes in an unknown language?
If you’re tasked to make minor changes to an existing program in a programming language that you’ve never used before, can you do it? Consider the following fictitious interview question:
You’re writing code in a programming language that you’ve never used before. You have no documentation about the language except the other code. Complete the following function: …
Let’s make this easier. Can you do it if you’re only slightly unfamiliar with the programming language?
When I learned new programming languages, I looked for how to:
- declare and initialise variables
- do loops (such as
forandwhilein the C family) - do conditionals (the
ifstatement) - do multi-conditionals (
switchfor C#,select casefor VB.NET) if available - take in input and print output
- write and use functions
You might have a different list, and that’s ok. It’s how I look for patterns.
With that in mind, if you had sufficient lines of code, you should be able to figure out what the code did. Even if you’ve never seen the programming language before. Then you could make the minor changes you’re tasked with some level of confidence.
It’s not like you code in assembly, right? … Are you?
I don’t have a code sample to show you. Alright fine, I’m too lazy to think up one… Do you have something to show? Post in the comments, and I’ll rack my brains on it…
Puzzle of 7 points and 6 straight lines - 2nd solution
This is the second solution to this puzzle: Construct a geometric shape with 7 points such that there are 6 straight lines, and each line must pass through 3 points. The first solution was already discussed last week.
And here’s the construction:

The 7 points are labelled A to G. The 6 lines are ADB, AFC, AGE, DGF, DEC and FEB. No, I didn’t label the points so I’ll have AGE and the short forms of the months December and February. It just happened that way…
The construction starts with point A, and you draw two lines down to get points B and C. The lines AB and AC must be of the same length. Then from point B, draw a perpendicular line to meet line AC. That meeting point is F.
From this construction, angles AFB, AFE, CFB and CFE are right angles (90 degrees).
Do the same thing from point C and draw a perpendicular line to meet line AB, and you’ll get point D. Similarly, angles ADC, ADE, BDC and BDE are right angles.
The point E is formed from the cross point of lines DC and FB that was just formed.
Draw a line joining D and F. Draw another line joining A and E. The cross point of lines DF and AE is point G.
The first solution focused on getting the points right, and then forming lines to fit them. This solution focused on constructing the lines, and the required points magically appear.
On hindsight, we didn’t need the right angles to be there. As long as D and F meet the lines AB and AC respectively in the same ratio, the solution is still valid. There are 2 criteria to meet:
Lines AB and AC must be of the same length. This allows symmetry.The length ratios AD:AB and AF:AC must be equal. This is dependent on the previous criteria.
[Update] Yes, that is one heck of a correction. 3 criteria:
- Points B, A, and C don’t form a straight line (they’re not collinear)
- D is somewhere on the line AB (and D not equal to A nor B)
- F is somewhere on the line AC (and F not equal to A nor C)
Then follow similar construction steps for points E and G and as Eric puts it, the rest just happens. Thank you Eric for pointing this out.
Ok, 2 solutions were presented. I hope you had fun reading and thinking about the puzzle.
Response to Stack Overflow podcast 15
The recent Stack Overflow podcast is fantastic! Check it out here. Their fantasticness might have to do with Jeff and Joel answering listener questions more than directionless rambling. Some of the questions were interesting, and I want to add to their answers.
The one on time management
Like Jeff, I don’t really have a system. Like Joel, I got halfway through Getting Things Done and I decided the whole system is still too complex and I could have actually done something already. The concept of transferring tasks from your brain onto something, like paper (have a look at Todoodlist) or a PDA or a computer, is great though. I use my mobile phone to keep track of personal tasks, and the Outlook calendars and tasks to keep track of office work.
That said, my “system” if you want to call it that, is to keep people from annoying me.
Given similar levels of urgency, first do that task which has the most number of people irritating you.
It’s served me well so far.
The one on code review
I’ve never had a code review of my code. It’s not that I’m that good (it helped though), or I’m a pompous buffoon (I’m not). It’s that the people I’ve worked with, don’t care about code quality but more about whether the software worked. When the software failed, or was slow, then the code was checked.
The other reason is the small team I’m currently working in. There’s no one else available to check my code. My team leader trusts that I do my job and I’m grateful for that. The downside is, I don’t have anyone to talk to in my team. I’m the .NET guy! Or the front-end guy.
This is getting depressing. Moving on…
The one on interviews
I don’t know what it’s like in America, where the geographical context of Jeff and Joel’s conversation is. What I do know is, there was only one interview where I had to read and explain some code. It was something to do with string concatenation optimisation in Java. I believe it was an actual production issue, and the interviewers wanted to get a free answer from the interviewees.
Just go prepared. Read up on the company, prepare some questions of your own and revise some of the basic programming stuff. It might look bad if you asked for access to Google so you can find out the parameter signature of a basic function.
[Update] Joel also mentioned something about suits. If you’re not used to wearing office wear, and the company you’re interviewing for requires you to wear suits, well guess what? Practise wearing suits. My current job only required me to wear a long sleeved shirt, pants and (leather) shoes. And belts help too. Don’t you read fashion magazines? *smile* I remember squirming in that alien outfit for my first few interviews because I’m not used to wearing them… Don’t be like me.
I’ve heard of the puzzle questions in Microsoft and Google interviews. I’ve actually had one too. The puzzle had something to do with a cube.
The ones on managerial role and outsourcing
I’m linking them together because my answer is related to both: Offshoring. Occasionally, I’m in charge of a developer stationed in China. I had to write out instructions, program specifications, design layout and database table structures.
The only code reviews ever done was on the code of our Chinese colleagues. We’re (as in the Singapore team) supposed to be training them.
As I understand it, outsourcing means you delegate tasks to another company, usually in another country. Offshoring means you delegate tasks to another part of the mother company in another country.
Oh, you might want to read about my first outsourcing episode.
And that’s all from me. If you hadn’t done so, go listen to the podcast.
Featured demo - Inflorescence
Today’s featured demo is Inflorescence by mfx. Download it here. It’s about 4 minutes in length and 19.5 MB in size.
Since I’ve discovered Capped, I am happy to announce that you can now watch demos even if you have a sucky, I mean, graphics-card-challenged computer.
[Update: If the video doesn't appear in your feed reader, please click through to the post or go direct to the source. If you know how to embed a video from Capped into an RSS feed so it shows up, let me know.]
My first impression? Very X-Files…
The demo makes heavy use of a technique called bump mapping. It allows you to create detailed surfaces with less polygons. For example, we have here a curved surface:

Perhaps we want it to be rougher in texture. Instead of pulling and pushing vertices out of alignment on the curved surface, we could use bump mapping. Tada!

Recalculating vertex normals so that light falls on the surface and create shadows correctly (due to physically shifting the vertices) is expensive. The cheaper way is to use the same 3D model, and add a processing step before the lighting calculations. Thus it looks like the vertices are physically changed, but aren’t.
I take psychic submissions too
I don’t know how to put this. Things have been a little … quiet around here. So I’ve decided to put my analytical and intuitive skills to the test, and hopefully gain some answers…
So, over the past one year or so of blogging, I collected what little information I had. Some emails, some comments, some Stumbles, and a delicious bookmark or Reddit or so.
You are probably from the United States. In fact, you are 41.54% likely to be from the United States (courtesy of Google Analytics). Or you’re 9.35% likely to hail from Harry Potter’s country (urgh… Dementors). Ok fine, I don’t really know anything. You could be from, let me see, Canada, India, Singapore (helllooo!), Australia or some other fine place on Earth.
And now, I’m going to reveal an embarrassing fact. My blog traffic is about 50 unique visitors per day, spiking up once in a while when a post gets Stumbled or Reddit. Page views are about 1900 to 2100 per month. Rest assured you’re more than a web site statistic. I love talking to you (even if you’re a bit shy talking back sometimes…). R.E.S.P.E.C.T.
Despite the low number of web visitors, I have about 35 RSS readers (thank you mem!) and a PageRank of 4. I’m not sure exactly what Google’s algorithm does, but I think 4 is a good value.
Now, the page views thing wouldn’t have been a big deal, until I read Daniel Scocco’s answer to a reader question
6000 page views per month means you are getting around 200 page views daily, right? Well, I think that is a pretty low number for a website that has been online for 3 months. I would aim for some 2,000 page views after 3 months.
Mother of all source code! I’ve been blogging for over a year, and have only about 2000 page views per month. And I’m supposed to have surpassed that after 3 months? Oh man, I so totally suck at this…
Yeah, it’s been a long lonely journey sometimes… Which is why this came in at the right time
Yes, I feel like giving up sometimes. But I know I won’t. And I hope you’ll stick it out too.
You thought I’d stop the math lessons, did you? *smile*
Where was I? Oh right, analysing data. I’ve had someone come through from Dream In Code, highly probably a student. He emailed and asked me a studently programming question and I gave him an answer and pointers. How do I know he’s a student? Because another person asked the same question in the forums. Probably not from the same professional programming team, so rival classmates?
The only thing I wanted to handle better was that I should not have given the answer in the forums too. He came all the way here to ask me something. I should’ve treated him better. So whoever you are, mysterious student, I’m sorry and I should have respected you more.
Speaking of students, my intuitive senses tell me that you are probably in your twenties, probably a student still in school. Yes, I’m guessing, but based on data from the few comments and emails I received (tonality, grammar, and gut feeling). Hah, that’s something Google Analytics don’t have!
Even if you do comment, you don’t put your web site down. You’ve also given me false emails. This is fine, it’s just an observation, and I’m just happy I got a human response. Do you know how deliriously happy I get when I see 3 emails in my blog inbox and I think “Ooh, someone commented/emailed/asked something!” and I expect to find 1 email from a human (because, you know, the other 2 are spam)? I dance around waving my hands in the air for about 10 seconds. I’m not kidding.
There’s this other observation. The no-web-site part. This tells me you are either really cautious, or you really don’t have a blog or web site. Which means I get less links, even if you like my posts (you do like my posts, right?), since you’ve got nowhere to link them from. Well, you could always share a post you like on a bookmarking site or email your friends. Yes I still respect you even if Google or some other web arachnid thinks my blog isn’t worth much.
Combating this undesirable serenity, in my free slots in the space-time continuum of weekends, I practised hard. I pored over ancient texts, meditated on the future of programming, and bent my body into all manner of uncomfortable positions. And I’ve finally achieved it.
Other than my current super power, I am now also psychic! I understand that clicking through from a feed reader to comment on something, or even using my contact form may be too much trouble for you. So I’ve come up with a solution. If it’s too much hassle to submit something to me, then think it to me.
Complementing the 24 by 7 nature of the web, I am now psychically receptive to thought submissions. Because of this new service, I have decided to give up sleeping, which I usually do around 12 midnight to 6 am (1600 - 2200 UTC). I am dedicating this sacred 6 hour period to be attuned to the thought waves travelling around the world to this blog.
No more filling out names, email addresses, web sites, your question/comment, credit card numbers, phone numbers, home addresses! Everything will be autopsychically filled for you! I may look like I’m just lying in bed, but I’m really maximising my psychic receptivity. No, that’s not me snoring.
You can still psychically submit stuff to me in the other 18 hours. I’m just totally devoted to receiving psychic messages from you in the designated time slot.
To encourage submission, I’ll tell you a bit more about myself, so you’ll have fodder for questions.
- Worked at a startup company for exactly 6 weeks
- Have more than 5 years of professional programming experience
- Studied for 4 years in university, majored in Applied Mathematics and Computational Science
- Worked at 3 distinct companies (I repeated working at one of them)
- Speak 2 languages fluently (English/Chinese or C#/VB.NET. Take your pick)
- … And a partridge in a pear tree *smile*
Since I’m new at this, I may not always get your message, or even get the correct message. Psychic receptivity isn’t an exact science, you know. Your best bet is still emailing me directly.
Hmm… and you picked the card Ace of Spades, right?

