Friday, November 19, 2010

Software Developer Interviews

There seems to be a problem hiring good developers nowadays. It is apparently hard to hire people with even basic coding knowledge. The first time I really encountered this was in Jeff Atwood's blog post "Fizz Buzz", however it seems that this problem is still around.

That second article talks about basic interview screening questions that most("19/20") job candidates couldn't answer. The specific question was "Write a C function to reverse a singly-linked list". This seems unusual to me, since I've encountered harder questions during my co-op interviews.

It seems weird that some companies seem to be grilling co-op students harder than full time developers. Of course there are companies (like Google) who definitely put the full-timers through a lot to get a job. I've heard stories that it takes something like 6+ technical interviews to get a full time job at Google. This is certainly more than the hour and a half they spent with me when I interviewed with them this term.

I keep track of all the technical questions I've been asked in interviews. These questions have been collected over the course of two terms worth of interviews. Could you answer some of these? If so, then apparently you can have a comfy job as a developer.


1) What is a static function?
2) Can you have a static constructor?
3) Why would you use a static constructor?
4) What is a virtual function?
5) What's the difference between a thread and a process?
6) Fill an array of size 100 with the first 100 terms of the Fibonacci's Sequence.
7) What is the difference between a stack and a queue?
8) What is the difference between an exe and a dll?
9) What is object oriented programming?
10) Explain encapsulation, inheritance, polymorphism.
11) What is abstraction?
12) What is the difference between an abstract class and an interface?
13) What is the difference between pass by value and pass by reference?
14) What is a pointer?
15) Does Java/C# have pointers?
16) What is the difference between a pointer and a reference?
17) Implement modulus.
18) How would you overflow a stack? Heap?
19) Count the number of set bits in an n long array with 16 bit numbers? Can you improve the constant factor?
20) Worst case for a hash table?
21) Implement multiplication.
23) Write Fizz Buzz.
24) What does final mean in Java? Static?
25) How would you unit test <this>?
26) Basic question involving Distance = time * velocity.
27) Design a program to find the largest word in a paragraph
28) Design a program to extract unique values in a sorted list
29) What is normalization?
30) Get the second largest salary in a DB using SQL.
31) What's the difference between GET and POST?
32) Whats the probability of flipping 3 coins and getting heads all 3 times.
33) What is synchronization in the context of concurrency?
34) What is dependency injection? How would you implement it? How would you use it?
35) Name some differences between Java and C#.
36) How to bindings work for polymorphism?
37) How do you read a file in Java? (Stupid memorization question is stupid)
38) Given 7 "letter tiles" and a dictionary of valid words, return the set of words that can be generated using those tiles.
39) Given a file with expansion data like this:
“foo” expands to “foo” “bar” “biz”; 
“buzz” expands to "blarge" “*foo”
where *foo means expand foo, so expand(buzz) = "blarge foo bar biz"
Write a function that expands strings based on such a file.

40) Write code that will always deadlock.
41) What is a buffer overflow? How is it exploitable?
42) What is DEP?  What is ASLR? How do they help prevent buffer overflows?
43) What is BotNet? What is some of the malicious things it can do?
44) What is XSS?
45) What is a SQL injection?
46) What would you do if you found a security exploit?
47) When (if ever) is it okay to release the security exploit to the public?
48) What is an exploit? What is a vulnerability?
49) If you could enforce one programming rule to improve security, what would it be?
50) What is the difference between verification and validation?
51) What makes a good requirement? “The DB needs to be fast”. Is that a good requirement?
52) What goes into a good bug report?
53) Tracing DFAs.
54) What would you consider when designing a DB?
55) Find the memory leak in the some code.
56) What is MVC?
57) What are the 4 pillers of OOP?
58) Implement inheritance in a database.
59) Use joins (then don’t use joins) to get the data from above tables.
60) What do you do when you can’t beat a deadline? (impossible deadline)
61) String builder vs String in Java. When to use which?
62) What are JS prototypes?
63) What is AJAX?
64) What is JSON?

Hopefully this is helpful to people doing interviews next semester.

Wednesday, November 17, 2010

Wolfram And Natural Language Programming

I just read Stephen Wolframs's most recent blog post on programming with natural languages. He talks about some really cool features of Mathematica 8 and Wolfram|Alpha. The examples he shows are quite impressive.

Wolfram talks about a future where programmers would be able to communicate with a computer using natural languages like English. The programmer would specify the requirements in English, and the computer would synthesis a program to actually satisfy these requirements. Although this sounds like a really interesting idea, I can see a lot of problems for them to overcome before this becomes practical.

Perhaps the largest of these problems is that natural languages are very imprecise. The amount of text required to specify a requirement accurately in pure English is huge. Massive programs with really complicated requirements would create a huge wall of text when encoded in English. Maintaining and expanding programs that are encoded like this sounds like a nightmare.

Further, English is an inconsistent language. That is, you can derive many contradictions and silly results using the English language. For example,

Consider transitivity. If A > B and B > C, then we can conclude that A > C.
Now,
let A = "A Cheeseburger"
let B = "Nothing"
let C = "True Love"

So now,
A Cheeseburger is better than nothing (A > B)
Nothing is better than True Love (B > C)
so it should follow that
A Cheeseburger is better than True Love.

Silly result is silly, but it just shows that English sucks at being precise. This silly proof was originally shown to me by Professor Shai Ben-David in Logic class. He was explaining why we can't use English as a language for Logic. The reasons are essentially the same as the reasons why we can't use English for programming.

We could solve some of these issues by creating restricted English, but figuring our a working subset of English would be a huge task in itself.

It is interesting to see how software engineering techniques would change if this were to be come popular. MVC would translate to separate paragraphs talking about views, models, and their interactions. Most design patterns could be specified with an additional paragraph. Would these design patterns even be useful anymore?

In any case, the progress in free-form linguistic parsing is really interesting, but we will probably see it applied to other fields effectively before we see it as a substitute for traditional programming languages.

Tuesday, November 16, 2010

Java's Demise?

This article talks about all the problems facing Java in the upcoming years. It'll be interesting to see how Oracle deals with all this.

I see this as a great opportunity for .NET to gain a lot of market share. According to TIOBE, Java is still ranked first, and C# is ranked 5th. I can definitely see them swapping in the next 5 years. I would be happy if C# at least swapped with C++ (currently 3rd). I wonder how C++0x and C1X will fit into the rankings whenever they actually get released.

I've enjoyed using C# a lot more than Java in the past. Java seems to be really lagging behind .NET in terms of implementing new language features (like Lambda). .NET and Mono are both progressing quite fast. Hopefully I'll get a chance to work .NET more in the future.

In other news, OS A3 has been released and work with DB is raging on. Busy busy.

Sunday, November 14, 2010

Planning

I think a large part of our problem for OS came from a lack of planning. We were making design and algorithm decisions during our slip day. Not good. :/

We should have sat down and planned out the project in its entirety before we started programming. We were trying to do things sections at a time, as if it were an agile project or something. Unfortunately, pretty much everything in the system was intricately intertwined so looking at some of those modules in isolation didn't really make sense a lot of the time.

I think we'll make it a point to do much for A3. That is, I would like to have the project fully planned out and designed before we write a single line of code. Hopefully this will make the project go much smoother than A2.

There's three weeks of classes left, and A3 hasn't been assigned yet. This is going to be fun.

On a related note, our next DB project has been fairly well planned out. I think that we are making great progress, and our architecture is solid. I am actually a little proud of our dinky design, even though it's just a simple MVP architecture. With three weeks until the deadline, I think we won't be pulling any late nights with this one.

Saturday, November 13, 2010

Language Expertise.

Sometimes I read articles about languages and I realize how little I actually know about these languages. I feel like I should read a nice technical book from front to back. Something like Head First C#, rather than Code Complete. I eventually want to read both, but I feel like I should know my languages in more detail before I learn more about engineering techniques.

Not to mention I know very little about some fields of development, like web development. Hopefully I will get a nice crash course in web development during my work term.

My goal is to get through a lot of books this Winter. I should be able to do it since I won't be worrying about OS or DB all the time. :P Hopefully I won't be too distracted by Roslin house/video games.

On my to read list (in order):
- Head First Java
- Re-read Clean Code
- Code Complete 2

I will be happy if I can get through those in 4 months, but more would be nice.

Anyway, I should probably do something productive. Maybe I'll fail at Algorithms for a bit. :/

Thursday, November 11, 2010

Web Technologies

I just got back from meeting my co-workers. Everyone seems nice. It's a pretty small office (about a dozen people). It's also an open office, so it seems really fun. I wasn't a big fan of the cubicles at my last job.

I get to use GWT to make web-based applications in Java. I'll be using Eclipse running on Macs. This will be my first real exposure to web development, and I'm pretty excited. Hopefully I will have some time to get to know GWT before I start in January. I should be able to find some time after exams or something.

Anyway, I'm off to spontaneous sushi with Girl. :)

Wednesday, November 10, 2010

Maclean's "Too Asian" Article

Maclean's published an interesting article entitled "Too Asian" (Edit: It seems that Maclean's has taken down the article. Hopefully they will put it back up at some point. Check the comments for a kinda-sketchy repost of the full article.). Waterloo gets more than a few mentions, as well as UofT and UBC.

I think some of these pre-frosh are just being stupid. If you want to go to University just to drink and party, I promise you will find like-minded people at any university. It's not like nobody drinks and parties in Waterloo. Just look down King street on Saturday night, or the line up outside Mel's (RIP) at 2am. You will not have to go far if you are living in UWP and are looking for a party. I have several high school friends that lived there and tell me all about "Wasted Wednesday" and "Man-down Mondays".

I also think it's silly to go to university just to party. If you want to drink all day, there are certainly cheaper ways to do this. It's that mommy and daddy won't pay for you to live in a studio apartment and drink all day instead of working.


Here's my favorite quote:
"The division is perhaps most extreme at Waterloo, where students have dubbed the MC and DC buildings—the Mathematics & Computer Building and the William G. Davis Computer Research Centre, respectively—“mainland China” and “downtown China,” and where some students told Maclean’s they can go for days without speaking English."

That last bit sounds plausible, though I can't say that I've seen it personally. I actually heard these nicknames in 3A for the first time.

Tuesday, November 9, 2010

Life After OSA2

With OS done, I finally have some spare time. Woo! I am assignment free for a whole week! I feel  like I have so much free time now. I am going to be an Arts student for a week and do nothing productive.

So, I randomly took up Starcraft. lol. I won my first game today, with the help of Girl. Woo! I miss having time for games. I look forward to going back to gaming during my co-op term.

Speaking of co-op terms, I am meeting my co-workers on Thursday! Ahh! We are going to talk about all the projects I could work on and the related technologies. Hopefully I will have time to actually look into some of those things. I will get a lot of practice with Java with the upcoming DB project. We are (most likely) using Java, with JDBC and JUnit.  I am actually pretty excited for the DB project. We have a lot of freedom. We get to choose pretty much any technologies involved (other than the DB itself. We are stuck with DB2 for that :|). Jesse and I also get to do some architecture, something we both want to get into later. :) Weee! Our professor has a software engineering background, so hopefully we can impress him with our beautiful and pragmatic design.

I am going to work on that now actually (I guess I won't act like an Arts student after all...)

Monday, November 8, 2010

The Defeat of OS A2!

Wooooo! Gwaba Gwaba Gwaba!

We finally finished OS A2! It took about 800 kernel and countless man-hours, but we are finally done! That was a nightmare. We spent the last 3 days straight programming. We didn't go to sleep until 4am every night. We were on the brink of insanity, but it was totally worth it.

I am now going to not worry about OS for a long, long time (read: until A3). Maybe I should play some Starcraft or something.

Gwaba Gwaba Gwaba Gwaba Gwaba!

Saturday, November 6, 2010

Code Reuse Myth

Code Reuse Myth

Allan Kelly makes some interesting points about code reuse. He argues that code reuse is a bad development goal, since most code designed for reuse is never actually reused. Often, developers want to create reusable code, not because they think the code will be reused, but because the final code will be better engineered. Specifically, the code will be have properties like low coupling, modularity, and testability. However, creating "reusable" code costs a lot. Kelly thinks that it's something like 3 times more expensive.

I think that code re-usability should not be a direct goal of software architecture. It's silly for this to be a direct goal, if it's never a requirement. This is especially true because of the cost. However, code properties that accompany re-usability(like low coupling) should be software architectural goals. This has real benefits to everyday development, and has a side effect of creating code that can be easily reused, with minor modifications. This would probably cost a lot less, since not every component of the system needs to be abstracted to some generic, reusable code section. To make things worse, planning for everything to be reused is often over engineering. The resulting code is a nightmare to understand. Code that abstracts too much becomes much less clean, and as a result, much harder to work with.

Lesson: Plan to write code that is testable and well engineered, and you get reusable code. Don't plan to write reusable code that happens to have positive software architectural properties.

Also, hi

Friday, November 5, 2010

Genetic Algorithms and Mario

Genetic Algorithm for Mario AI

So genetic algorithms are getting really cool. I wish I had more time to play with these things. I wonder how much more they can do with these kinds of algorithms. Maybe if it gets more popular, Waterloo would ever offer a course on it. I would take it.

Hopefully I will be able to take the Machine Learning course at some point. It's one of those 'special offering' courses that get offered at very arbitrary times, so I have to hope I get lucky. Apparently the wheels of beaurocracy are turning for making this an official course. I hear those wheels turn very slowly though... :/

I wonder if it's possible to do machine learning through genetic programming, like having a genetic algorithm find spam rules or something. Maybe I'll ask Shai Ben-David if I ever see him on campus. Or if I can catch that course.

In other news, OS is coming along nicely. Todo checklist:
- Fork
- Waitpid
- Exit
- Execv
- Miscellaneous testing and bug fixes

Thankfully, those first 3 points are well underway and will, hopefully, be done today.

*Sigh* Back to work.

Wednesday, November 3, 2010

Minecraft on OS/161.

Woo! Willis and I are making progress with OS. A good chunk of the file system calls are done. There is still some work to do there (like solving some synchronization concerns), but I think we can make the deadline.

I can run 2 player Tic-Tac-Toe now! Woo. Next step: Minecraft. That better be worth bonus marks or something. I wonder how hard it would be to get the JVM running on OS/161. Perhaps I should get basic files working properly first...

I am getting more and more excited for Winter term. A bunch of us will be in Waterloo this time, so it should be a lot of fun. I've never had a work term in Waterloo, so I'm excited to see all the antics I can get into with university friends. :P

In other news, I saw Red a few days ago. It was phenomenal. It reminded me a little of Kick-ass, though I'm not sure why. Both were outrageous and hilarious.

Okay, I'm off to figure out how to deal with EOFs in sys_read. Exhilarating, I know. :)

Monday, November 1, 2010

Job!

I official got matched for Karos Health for next semester. I feel really bad since a lot of the other jobs I had offers for went unfilled. Hopefully they will all find other candidates to fill the roles in the continuous phase or something.

I'm so excited. I want to just start my co-op term now. Instead, I have algorithms and OS to finish. :/

So battle plan:
- Finish Algorithms. There is one more little bug to iron out in my Levenstein distance, and I should be done.
- See a movie with Girl. Maybe The Social Network, maybe Red. I am cool either way.
- OS OS OS OS. I have to finish all the file stuff, then execv and exception handling. There's exactly a week left and the pressure is building. This is going to be busy week.