OOP Problems to use for Coding Tests during interv

2019-03-09 02:34发布

As a second interview I get people to sit down and write code...I try to make the problem really technology independent.

My programming problems that I have don't really exercise peoples OO abilities. I tend to try and keep the coding problem solvable within 2 hours ish. So, I've struggled to find a problem small enough and involved enough that it exposes peoples OO design skills.

Any suggestions?

标签: oop
9条回答
祖国的老花朵
2楼-- · 2019-03-09 03:22

ideally, you want to present a problem that appears difficult, but has a simple, elegant, obvious solution if you think in OO terms

perhaps:

  • we need to control access to a customer web site
  • each customer may have one or more people to access the site
  • different people from different customers may be able to view different parts of the site
  • the same person may work for more than one customer
  • customers want to manage permissions based on the person, department, team, or project

design a solution for this using object-oriented techniques


one OO solution is to have a Person, a Customer, an Account, and AccountPermissions, where the Account specifies a Person and a Customer and an optional Parent Account. the use of a recursive Account object collapses the otherwise cumbersome person/team/department/project structure a direct ERD solution might yield

查看更多
该账号已被封号
3楼-- · 2019-03-09 03:22

These aren't specifically OO Questions, but check out the other questions tagged interview-questions

Edit: What about implementing some design patterns? I don't have the best knowledge in the area but it seems as if you would be getting two questions for the price of one. You can test for both OO and Design pattens in the one question.

查看更多
男人必须洒脱
4楼-- · 2019-03-09 03:24

I've got a super simple set. The idea is mainly to use them to filter out people who really don't know their stuff rather than filtering in the rock stars.

These are all 5 minute white-board type questions, so they are really not that hard. But the act of writing up code, and talking through it reveals a lot about a candidate - and is brilliant for exposing those that can otherwise BS through the talk.

  • Write a method that takes a radius of a circle as an argument, and returns the area of the circle (You would be amazed how many people struggle on this one!)
  • Write a program that accepts a series of numbers as arguments from the command line. Add them up, and print the sum
  • Write a class that acts as a keyed counter (basically a map that keeps track of how many times each key is "counted")
查看更多
登录 后发表回答