HI, I live in Anchorage and am a management consultant and writer. I'm founder of www.bullywhisperer.com™, www.workplacecoachblog.com and www.thegrowthcompany.com. I'm author of Solutions and Beating the Workplace Bully, AMACOM. I author.
Today I'm talking about the tough issue of whether to reveal an early pregnancy during a job search.
I’m three months pregnant and looking for a job. It’s not yet obvious because I’ve kept in shape. I’m afraid if I say I’m pregnant, no one will hire me, and I really need the job.
Do I need to own up to being pregnant when I interview? If I’m offered the job, do I need to let the employer know at the time of the offer? What if I’m asked if I’m pregnant by an interviewer who notices I’m starting to get thick around the middle?
I’d rather work for at least a month and let them see that I’m a great employee and then tell them. I’m afraid, though, that they’ll feel I was unethical, and I feel bad about this.
Can you advise me?
You don’t need to mention your pregnancy during an interview. You’re also correct that some employers won’t hire pregnant applicants despite federal and state laws that make discrimination against pregnant women illegal. These employers simply cite other reasons for not hiring expectant moms.
Further, although it’s counterintuitive, you don’t need to answer truthfully to an illegal question asked by an interviewer, such as, “Are you pregnant?”
At the same time, you’re absolutely right that an employer may feel betrayed when they learn you’re pregnant just a month after hiring you and realize you hid this information during your interview. Anytime you begin an employment relationship hiding a fact most employers would want to know, you risk losing trust, a necessary ingredient in a healthy employer-employee relationship.
You have two ethical ways to face this challenge.
First, you can tell the truth. If you plan on working after you deliver your child, HR-savvy employers will still hire you if you present yourself well and are the most qualified candidate.
Second, apply for temporary jobs. Many employers hiring temporary employees actually prefer hiring applicants who don’t want a long-term job because they fear that if they hire those who seek long-term employment, those newly hired employees will continue their job search.
Alternatively, seek work through a temporary agency. Temporary agencies offer job seekers a valid way to earn money on a short-term basis. Then you can work as long as you’re able and restart as soon as you’re ready after childbirth. Also, you may find a great part-time temporary gig, allowing you to stay home part time after you deliver.
Finally, if you tell the truth and a friendly interview suddenly turns cold, visit your state’s Human Rights Commission, and ask them to help you out.
If you don’t build your dream someone will hire you to help build theirs.
Is this you, building your dream, are you working to build one for someone else, or did you hire her to build part of your dream for you?
This quote is about your future, and what your plans for it might be. If you have no specific plan, or aren’t working on your dreams, what will you be doing?
According to this quote, you’ll probably be working on the dream of someone else. While that’s not improper, illegal, or fattening, you could be working on your dream instead. Or better yet, if at all possible, work on both at the same time.
But why wouldn’t you be working, at least part time, on your dreams? Do you not have anything that motivates you enough to overcome your tendency to procrastinate? Are you uncertain how to get there, and stuck in analysis paralysis? That’s not good, is it?
Why is having a dream important?
Dreams are what give us the drive to get things done. A dream is what gets us up off the couch and doing things we might not otherwise want to do. For some people, work is what they do to earn the money to use in the chasing of their dreams.
Or, perhaps, they’re using it to hire others to build their dream for them. We don’t always have the talent to realize our dreams. Sometimes you have to hire it out to those with the skills. Most of us don’t learn to fly just to go on vacation, we pay someone else to do that for us, and go along for the ride.
The pilot has a job, but most of them are there because they love to fly. They get paid to do their job, but their job is also part of their dream. In this way, they get to build their dream, while being paid to do what they love. Wouldn’t that be great?
Where can I apply this in my life?
Well, if you’re a pilot, you’re probably already living the dream. The rest of us will have to work a little harder to make it work. What is your ultimate dream? I’d prefer an active dream, not just sitting on a beach somewhere. That gets old after a few years. What then?
The first step in this process would be to recognize how many dreams we actually have. Think of all the things you really love to do, or would love to learn to do. Consider all the different parts of your life where you have dreams or aspirations.
What is your dream job? What kind of people are your dream friends? What social groups would you join, if you had the choice? Take a few moments and think about what you are interested in doing, where you want to go, and the people with whom you’d like to do these things.
Grab some paper and write down all of these things. Try to get something from all the different parts of your life, including hobbies and other distractions, as well as skill sets, places, and improvements you’d like to make to your life. Make as big a list as you want.
Now for a little reality check. What would you have to do to get from where you are to where you want to be? The distance isn’t as important as your motivation. If you’re willing to do what it takes to get from here to there, you can keep it on the list.
If you don’t believe you can do it, or won’t do the work necessary to make the dream come true, put a single line through it. Who knows, you may change your mind later on and come back to wanting it. You never know what will happen, what doors might open, or how your tastes might change.
Take a look at what is left on your list, and see if there are any patterns. Do you have some hobbies that are also part of your work, or could become your work? I happen to love playing with computers, but if that didn’t work out, working on cars would be another great way to earn a living.
What do you do, or could you do, that might help you build your dreams? Can you hire anyone else to help make things happen? Hire a travel agent to make arrangements? Hire an airline to fly you there? Hire a baggage company to make your luggage?
None of these things need to be custom or made to order, it can be regular commercial flight or off-the-shelf bags. My point is you didn’t have to do it, you had someone else help you build your dream. That is part of the beauty of the quote, to me. You work on your dream, and enlist others to help as well.
Anything you are willing to work for can happen. But your dream needs to be bigger than the obstacles. How hard are you willing to work for your dreams? Or will you settle to working on the dreams of others?
confirmed at : it’s from his own twitter feed (similar to a Jim Rohn, also occasionally attributed to any number of other people)
5 signs that you should hire a programmer on the spot
Bringing a programmer in for an interview and a coding test can lead to some interesting experiences, both for the interviewer and the interviewee. Most end up with the hiring manager telling them that they’ll “be in touch,” but sometimes a candidate just nails it. That’s when you consider extending a job offer before they get a chance to leave the building.
At TimeTrade we run a coding test during interviews that, for the majority of programmers, should take about 2 hours in total to complete. The whole test is comprised of a number of small problems to solve, each harder than the one before. That gives us a good initial gauge of performance based purely on completion time: if everything has been solved in under an hour, we’ll be smiling. But if two hours pass and even the first problem still hasn’t been solved, the candidate will most likely just be shown the door.
Above and beyond just solving test problems quickly, here are some signs that a programmer is truly awesome and should be handed a job offer before they leave your building:
I recently interviewed a programmer who solved an entire set of tests twice: once with iterative solutions, and again recursively. I quickly made him an offer. Finding multiple solutions to a problem is a skill that engineers will need to use every day.
Last year I interviewed someone who was so diligent, so detailed and so professional about his work that he created full Javadoc and comments for his code before he considered the solution complete. He even wrote fully automated unit tests and checked their coverage percentage. When I came back into the room at the 2-hour mark and found him typing furiously I initially thought he was having trouble with the test, but he was actually in the process of adding HTML formatting to his Javadoc. Engineers who do this intuitively are the kind you’ll want on your team.
We deliberately create tests that have some minor issues lurking within them, purely to see if the candidate (a) spots them and (b) is willing to fix them. It might be an inconsistent usage of quotation marks for strings, misleading variable names or anything along those lines. Candidates that look at all of the provided code as the test — not just the pieces we’ve asked them to write — are the ones who will do the same in our real product once they join our team.
An engineer who is willing to tell a potential employer that the supplied test contains problems shows that they consider the quality of their work to be more important than just agreeing to do what they’re told. Hire them and they’ll likely work wonders for your product, going above and beyond their assigned areas to make improvements where they are needed.
Most candidates like to get a solution working, then sit back and breathe a sigh of relief that they finished it successfully. That’s good, but rarely good enough to justify an on-the-spot job offer. The candidates that solve the problem but then jump right back in to refactor it are in a different category entirely. Their choice of algorithm doesn’t feel right, and they can’t ignore the feeling that it could be more efficient. Their code has some duplication in it, and that burns them up inside. These are the candidates who refactor, rewrite and improve their solution until it’s been crafted.
This can be a double-edged sword, though. If the candidate just keeps rewriting because they’re not happy until they reach a mythical point of “perfection”, there’s a chance they are one of those programmers who doesn’t know when to stop (and similarly, ship). However if they watch the clock carefully and are able to both solve the problem and refactor their solution before their time runs out, that’s a really good sign that you should consider an offer.
Sometimes there are plenty of non-technical signs that you’ve found the right candidate. Your other team members take you aside and tell you, “We have to hire this lady.” Their personality feels like a great fit for the team. They have relevant and recent experience in what they’ll need to do. You know some people who have worked with them before and they tell you they are wonderful to have on a team (and that they’d hire them again in a second). The candidate is excited about the company and the opportunity and is hungry to start contributing.
If the candidate passes technical muster and all other signs point to “hire,” why wait? If you do, you may lose the candidate to another employer who knows how to read the same signs faster than you can. Instead, be decisive and make the offer fast, thereby telling the candidate how much the company wants them on board. It will help start the whole relationship off on the right foot, for both parties.
So the next time you’ve got a wonderful candidate in your building, don’t assume someone even better will arrive the next day. Make them an offer and get yourself – and the candidate – back to work.
This blog entry has since been translated into Spanish (by Maria Ramos/Web Hosting Hub) and French (by Hinault Romaric/Developpez.com).
147 thoughts on “ 5 signs that you should hire a programmer on the spot ”
What kind of coding test do you guys give? I’d like to see if I can do a quality job in 2 hours.
Send us your resume and we might bring you in to do so
Sounds tempting, but I’m in deep south Texas and Massachusetts is too far.
Maybe just a hint of what the test consists of? Is the test geared towards algorithms or actual code design?
I’d also love to take a peak not because I’m looking for an offer but because your test has me really curious. I’d love to see any of it you’re willing to share.
Perhaps posting some question analogous to those on the “test” might be a good idea! It will attract the attention of the people you want, discourage the people you don’t, and gain you and TimeTrade some valuable mind share in the software development community.
We tailor the tests to the position for which we’re hiring, because a one-size-fits-all test wouldn’t tell us much. If it’s a web developer position, it’s going to involve adding new features to an existing web app (and require knowledge of HTML5, CSS3, AJAX, jQuery, PHP, etc). If the position is focused more on server-side stuff then the problem will likely touch on multithreading, scalability, architecture, implementation patterns, etc.
One thing I didn’t make clear in the article above is that we bring engineers in to interview only after they’ve passed a technical phone screen. That’s where we cover CS basics like algorithm complexity and data structures, and then have them code online to solve the usual quickie problems that should take 5-10 minutes each to code up. The phone screen is a pretty effective filter, and you wouldn’t believe how many people self-select out of the process once they’re asked to actually prove they can code.
The interview itself is as close to a simulation as we can get of what the work environment would be for them, should they be hired. We’re looking to find out if they can operate effectively in our environment and within our organization’s culture. In the few hours that interviews typically provide, we’ve found it to be a pretty good mechanism for hiring the right people.
Brian can you tell me know how do you conduct that technical phone screen, to me it seems like quite a time consumer. I mean what if you have cca 50 candidates, do you phone screen each candidate? That doesn’t seem efficient at all and the worst of all that phone screen needs to be conducted by some developer because you cannot pass this task to non-technical staff member. That seems like taking quite some developer’s time from the production.
In the previous company I worked they would tailor the tests for the required position, similar as you do, but they would invite participants to solve them online. True this does not have the benefits of testing how the candidates behave in your environment and in collaboration with other developers, but it is quite a time saver because you filter out very large percentage of candidates without interaction.
If I remember correctly this was the recruitment procedure; first they would send you an online test (I believe it was from these coding test site: TestDome.com), after that you get invited on follow-up interview in which you discuss about the test code, about their previous work, etc. but most of the discuss is non-technical related
Mario – we filter candidates pretty aggressively before they get a phone screen (which as you’ve correctly noted, takes a lot of time from developers to conduct). We have also recently added a new stage to our hiring process that filters them even further: candidates cannot even submit a resume to us unless they solve some technical puzzles within the job description itself. That screens out the “tire kickers”, gives us some confidence in their technical abilities, and saves us a lot of time phone screening candidates that are great at crafting resumes but are terrible at programming.
I see, well in that case I must admit you have a great recruitment strategy, I like it :).
“candidates that are great at crafting resumes but are terrible at programming”
It’s sad but the truth is that there are quite a lot of them …
I can provide you a copy of the test, I was so diligent, detailed and professional that I did everything twice.
I’ve done a lot of these sort of code tests and while your points are good, I’d add another. Always ask the prospective new code what blogs they follow and if they start to elaborate enthusiastically it’s a really good sign that they actually care about their craft.
I like your first point especially, though it really depends on what sort of questions you pose and how difficult they are.
I hate those types of questions. Do you really want some code monkey who lives to code? While those guys are usually awesome coders, coding is only part the job. The other half involves understanding and appreciating the business as well as interacting with the non-technical people who generate the revenue in most companies.
We don’t hire code monkeys at our firm as we really need people who can work with the business. If I need a code monkey for his ninja skills, I will call in a consultant for a few weeks and then show him the door when the project is done.
I agree with your comment.
Totally agree here
“If I need a code monkey for his ninja skills, I will call in a consultant for a few weeks….” Teams definitely needs skills balance to be healthy, but candidly, I believe that your philosophy here means you’ll _never_ have a world-class team, or even have a realistic hope of working towards one. Superstars advance the state of everyone’s art, when their skills are leveraged appropriately.
Being in tune with the community is so much more than coding. If you are following blogs it usually means you also are keeping up with methodology, best practices, recruiting and requirement analysis. All of which aren’t about code but vital in understanding what actually makes both software and users tick. All blogs aren’t about ninja hardcore coding tech.
“Always ask the prospective new code what blogs they follow….” I agree. I use a similar question that’s a little broader, “What do you read?” The answer says a lot about how well the candidate stays abreast of new technologies, and in what areas they’ve been working to advance the state of their skillset. It’s even more telling when they can’t answer the question right away.
As a potential customer, this gives me more confidence in your company — you guys have a great product and obviously a great culture of excellence
I’m curious as to the contents of your interview questions as well. Especially since it doesn’t sound like someone’s in the room with these candidates, hearing their thought process, solving hard problems together, or traditional white-boarding techniques.
Have you thought about this in-person factor? Did you intentionally trade that for another benefit (like ability to screen a huge number of candidates and still get work done) while developing this method?
Actually, someone is always in the room with them during the test. It’s a collaborative experience where the candidate gets to ask clarifying questions if they wish, because that’s they way they’d be working with the rest of the team if they were hired.
Have you ever followed up on candidates you didn’t hire? In other words, have you evaluated your method.
What kind of follow-up are you referring to, Martin? Are you asking if we contact them a month after rejecting them to find out if they’re happily employed, or something else?
You partition the set of candidates in two; those you hire and those you don’t. You assert that your method is effective, at least in your context. You seem to conflate/correlate effectiveness of your method with the situation of your product and/or company.
Unfortunately, you probably lack a control group, hires hired using some other method. You could evaluate your hiring method in several ways. Here is one way. A year later, arbitrary: rate your hires; compare them to each other, developers in other companies, to those you rejected. It might not be easy but attempt to survey rejects about their current job, salary, etc.
I understand your point of view here, and can’t deny that someone that can handle those tasks in two hours under interview conditions is exceptional. However I do want to caution against using this as a sole judgement. I’ve been developing for over 12 years, and I have to tell you this process is so abused that messes with the average developers head. I recently took a coding challenge for an up and coming software company that asked me to complete a coding challenge. I did my best work. I used the latest technologies, fixed problems in their sample code, and so on, as you mentioned above. I falied the test. Why? Because they expected me to work within the parameters that I have been given. They wanted to know if I could work with poorly named variables, code from 10 years ago, provide solutions without resorting to libraries, etc.
OK, so at another proespective company two weeks later – another code challenge. This time I took what I learned from the last test, worked within the parameters I was given, provided custom solutions within the framework I was given – but in the comments noted how I would fix it if not given those parameters. Failed the test. They were disappointed that I didn’t go outside the box, scrap what they gave me and do it “right” using new technologies and levering common libraries. UGH!
At the end of the day, you need to give a LITTLE direction to your potential hire, and if he fails the “test”, then ask him why before showing him the door. If he just didn’t know to do something, then OK, maybe he is not the right guy. But if had a different vision or maybe does perform well in an interview climate, ask for code samples, documents, screen shots, whatever from his previous work.
Good points, and I agree. A couple of things: we don’t use a binary pass/fail system with the test, and the 5 points aren’t our sole criteria for instant hiring (just a few of the ones we’ve used in the past).
I also wouldn’t classify our tests as coding challenges, rather they’re more like simulations of what it’s like to work with the team. You collaborate with an engineer and build something together, and there’s plenty of direction and feedback throughout.
Thanks, you made me laugh at 5:40 AM, before I started pounding on some code-retooling my coding, languages and skills “repertoire” :O)
Todd, this article isn’t about average developers… it’s about how to identify exceptional developers. The article is lacking, in that it only provides one possible method of doing that – but it’s a good method. I’m fond of saying I could walk into any kindergarten class in America and pick out the potential good programmers – but how do I do that? I can identify smart kids by the way they play. I could also give them a test, of course, and that would be effective, but other methods are effective as well. Average programmers may be flummoxed by the test, but exceptional programmers won’t be, and there are other methods of identifying exceptional programmers.
I like this… I wish I got hired like this. In my current job, I had to explain my past work, tough situations and how I solved them and all. That’s normal stuff you’re always prepared for. When it came to technical specifics, they asked really simply questions like basic, foundational stuff we learn in high school and I was applying for a senior level developer position. I felt bad during the interview and they could notice the slight changes in my facial expressions due to shock and awe at the type of questions (what’s a class, abstract class, interface, sql joins etc). Then I actually jutted in and told “these are actually basic questions” and then they showed me a pile of resumes of people claiming senior level experience who couldn’t even answer these and at that point they just wanted to hire the next person who could explain their past experience and knew the basics.
They hired me. Well, I consider myself average when I compared myself to most people at stackoverflow and I think my boss was lucky that I happened to be as good as they required someone for their position but they hired someone else using the same technique and he’s a total snob who can’t even google properly or clear his own compile errors not to mention that he can’t even refactor his own code. They’re thinking of firing him now.
Seriously… I consider myself as average but when I see more people in the market like him, my ego gets a boost and the people that are involved with hiring me or managing me treat me more special. If that’s how they treat me then boy, have standards come down.
I don’t believe in rubrics for hiring anyone on the spot. Programming tasks during interviews allow you to observe behavior, but not its motivation. Is the candidate testing, documenting, and refactoring, because that’s how s/he usually operates, or is it because s/he is trying to pass an interview and knows that’s what some interviewers expect?
A far greater predictor of engineering behavior is, IMHO, is the development culture in the workplace. An engineer who’s spent the last ten years refactoring, unit-testing, and documenting will either discontinue these practices or become resentful in an environment that does not value and encourage these practices. On the other hand, an engineer who has not been sufficiently exposed to these practices will be under social (and managerial) pressure to adopt them once immersed in a healthy engineering culture. If the candidate demonstrates the ability and willingness to learn from mistakes and grow beyond his or her established preferences, then that candidate may still be a fit for a culture that will challenge him or her to do better.
So the only reason why anyone should hire an engineer “on the spot”, is because that engineer would fit into and thrive in the culture of the workplace. Tragically, there are many workplaces, where the hypothetical engineer described in this post, would be grievously out of place.
Great points, Yev. On the motivation question: that’s for the interviewer to figure out. In my experience it’s pretty obvious to tell if someone is pandering to the interviewer or if they’re naturally inclined to just write things like unit tests because of their past experiences.
Another challenge for an interviewer is the detection of raw talent, and whether a candidate exhibiting innate awesomeness (but who might not yet gravitate to things like automated tests, etc) could be allocated the time and mentoring effort while on the job to develop those skills.
I totally agree with your last point. There’s no way I would hire someone for reasons #1-#4 if they obviously wouldn’t fit in with the team or the culture. I don’t think it’s tragic that there are many workplaces where the hypothetical engineer would be out of place, though – it would be tragic to hire them into one of those places and have them doomed to failure from their first day on the job.
I would be very interested to see if I could pass your test (not that I am looking for a job, but because I consider myself very good one-man-company developer – as I have several business applications that are commercially used (www.zpas.hr))
This is an excellent point…I have been a Senior Engineer for years and have been through these types of test and as a previous comment stated…Failed. But companies that hired me found I picked up the culture, was a team player and once learned my place and how to best contribute became the best employee they had on staff. Tests and pre-screening apart from culture fit and personality will not gain anything but a robot coder with zero personality
Code tests are a complete waste of both parties time and effort as its more around a pissing contest then it is on quality of a candidate.
Phsycologically speaking your doing more harm to unearth potential than good, as some folks may have deep insights into problem solving skills that often require more thought but in most cases code tests put an emphasis on fire drilling code checking / mathematic hurdles.
If you have two hours to solve a customers problem and you need to grab a random developer from your resource pool – sure you can now define that list.
Ultimately engineers need to stop finding mathematical benchmarks to rationalize a human to human metric. I’d hire a engineer who enjoys learning but failed a pop quiz vs am engineer who nailed pop quizzes but can’t interact socially or is highly introverted – worse – isn’t passionate about the role on offer
Establishing whether a candidate is a good technical fit is why you have probationary periods, as now you have them on real problems that need real solutions.. But more importantly you have these candidates also fitting on socially and culturally within your teams..
You can spot a fail within the first 3weeks quite easily.
I blame Joel on software for this lunacy around “every programmer should be tested before hiring”. It’s pandering to elitism that assumes your hiring the top 5%
News flash : top. 5% don’t sit tests and aren’t looking for jobs.
If our coding tests were administered blindly (IOW, without regard for personality fit, approach, nervousness of the candidate, etc) then I would agree with you. However, that’s just not what we do.
We make a concerted effort to simulate the candidate’s potential future work environment for the in-person interview so that both parties can figure out if it’s a good fit. It’s not an exam, nor is it a check-box of pass/fail on some super-high nerd-bar of difficulty. It’s an experiment conducted by both sides to see if the working relationship would succeed. It’s better to hire the right person who is a great fit than to let someone go after 3 weeks because you didn’t vet them correctly. Sure, that can still happen – but we prefer to drastically reduce the chance of that happening through a solid technical interview.
I would consider myself in the top 5% and I like tests. What I can’t stand is a company who clearly doesn’t care if I have the skills I said I have and doesn’t want me to prove it. That indicates a management problem, and may indicate that I’ll be working with people whose skills aren’t up to par, on the assumption that they were hired with the same non-objective process. I agree with Joel Spolsky on this, because I don’t like working on teams with people who schmoozed the interview and were never tested on their skills, and who drag the team down with their lack of ability. I am a good developer, and I’m ready to prove it, and if you’re good enough, you should be willing to prove it too.
People in positions they are not qualified for is a rampant problem in the software industry. Testing addresses that issue in an objective way. Of course, the test has to be good, and I think this article describes one good testing method. There are bad testing methods as well, such as the Microsoft Certifications – many of the certified folks I’ve worked with obviously passed the test, but they couldn’t do the job.
very true. Durning our interviews we have a senior and a “lower” level developer in the interview process. I’m the “lower” level dev I’m basically highering my team lead.. Most of the interviews I’ve done are with people who have 10+ years while I have 5. (Side note I haven’t been impressed with most about 90%) During the interview I tell them my experience level and I ask them questions that someone at my level should answer. Depending on the response I’ll either ask them more generic questions or lead them to something thats more complex that a “newer” developer might need an explanation and see how they respond.
Also on a side note that I really haven’t seen too many responses indicate that is very important the the person that being interviewed is someone who you’d enjoy to work with everyday. Don’t get me wrong that a developer who aces everything is great, but if she/he can’t hold a conversation about the weather is a big flag in my book.
I think that an objective process is definitely key… but making a ‘good’ test is really tricky and it should be geared towards evaluating the type of skills that are the MOST important (or at least somewhat important… cmon) for the job that you are applying for. The tests should have well-defined constraints and instructions, and once the tests are complete the code should be the basis for a discussion about why certain choices were made.
I’ve basically received the same type of coding test from 10 different companies for the Sr. DevOps roles that I’m looking at… and it’s really sad honestly to see what they’re asking me to do. It’s basically high-school CS where I’m supposed to open one file and pull out specific parts of that file and then compare it with a second file and output only certain lines from the second file based on a comparison with the lines from the first file.
The instructions are poor, and I’m expected to clarify each time with these kinds of questions: “Ok do I need to worry about memory?” “Does this need to work for files of arbitrary sizes?” “Does this need to handle error checking?” “Is it important that the code is readable & documented?” “How long do I have to complete this test?” etc…
But in DevOps, I am given a specific situation that I know a lot about… and based on the situation I am used to answering these questions myself. I should be given a specific and relevant situation… and then create a solution to solve it based on my experience and knowledge of what the constraints are when dealing with that kind of situation…
If I’m given a situation that compares the /etc/passwd file with the /etc/group file, I’m not assuming that it’s reasonable/possible in even a system set up by the most bumbling sysadmin that those files would be millions of lines long each… And if they’re blank or corrupt we definitely have other issues… If this script needs to run unattended for a long period of time it should have error checking and logging. But if it’s just run once I wouldn’t need to do everything in software as long as I:
1) make backups of the files
2) ‘less’ into the files and take a quick look to make sure that there aren’t any surprises.
3) Run a test on copies of the files…
Wayyy back in CS 101 did it ever really matter if a one-time piece of code executes in 0.0000000001 seconds versus 0.000000000099999 ? If that is important to you, then please give me a real-world example that requires optimization. Or just specify that the solution needs to be as fast as possible. My recollection was that highly optimized code often needed to be rewritten when future assignments built on the code written in the earlier assignments.
Also fyi for interviewers… if I’m using a scripting language there might be some behind the optimizations that alters the typical CS understanding of the performance characteristics of sets, hash maps/hash tables, and arrays. (See php and python for example) It seems that any question that *CAN* use a hash map probably should use one in a programming interview… Scripting languages can also handle errors in a pretty amazing way that interviewers may not be familiar with. For example, splitting a string a=”a:b:c. ” in python by using b=a.split(‘:’) works just fine and results in b=[‘a’, ‘b’, ‘c’, ”, ”, ”, ”, ”, ”, ”, ”].
Which brings up a final point… in the *real-world*, writing a first version of your code in a more generic and unoptimized way leads to code that you can more easily adapt in the future when you rewrite or refactor due to changing requirements. And less optimized code is generally more readable and for other coders who may actually need to read your code and make future changes it can be easier to spot problems or make changes many months or years after you finish your version. But in a coding interview, always assume that they want the most optimized version of the code… but make sure to ask anyhow just in case. Some people may actually care to see if you can code in a way that balances between speed and maintainability.
Testing is important, but it is extremely important to design tests in a way that helps reveal the characteristics that are important to the job you are hiring for.