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.
Sign up now to get your free ebook of "How to self-publish an online magazine". Your email is kept confidential, and is used only to send information about the magazine.



Hi! I write about maths and programming and other topics of esoteric interest. I'm also the editor of the online magazine Singularity, and you can get the latest issue at the top (it's free!).
