News for hackers. Stuff that matters.
Re:The Terrible Technical Interview by parennoob on Saturday March 21, 2015 @02:09PM (#9243609)
As a self-taught person beginning to write software who is not in SF, your description of someone who cannot explain the advantages of the MVC pattern makes me incredibly nervous. I don't really know the MVC pattern in detail, or what its advantages are. I do know about Big O complexity, data structures, loops, registers, as well as logic gates, and the basic structure of computer processors. I can code small programs in Python and Java, and have written some basic Flask apps.

Am I totally unfit for developing software?

If not, What is the correct answer that will prevent me from getting COMPLETELY EXPOSED (in your words) if you ask me this MVC question in an interview?

Re:The Terrible Technical Interview by fsk on Saturday March 21, 2015 @02:26PM (#9243680)
>If not, What is the correct answer that will prevent me from getting COMPLETELY EXPOSED (in your words) if you ask me this MVC question in an interview?

Every interviewer has their own pet question that the candidate is COMPLETELY UNQUALIFIED if they don't know.

My short answer to "What is MVC?" is that it's a popular web development trend, but without much substance to back it up. Every MVC project that I've been supporting/maintaining was a nightmare, taking 3x-5x longer to get stuff done than what I consider reasonable.

MVC = Model-View-Controller. It's usually for web development. You structure your code in a way that separates the data logic (Model), the user presentation logic (View), and the glue that holds the bits together (Controller).

There are many popular MVC frameworks that let you churn out a lot of mediocre websites quickly (angular.js, Ruby on Rails, Zend, Django(Python), and many others). The MVC framework does a lot of routine coding for you, but it comes at a price. The code can become a nightmare to maintain, especially if you use the MVC framework incorrectly. If you do something outside what the MVC framework provides, it can become a handicap rather than a help. The MVC framework usually demands you write your whole application in its preferred style, such as spreading out your code in various directories with forced naming conventions. MVC frameworks tend to be poorly documented compared to the underlying language (For example, compare the zend documentation to php.net).

Re:The Terrible Technical Interview by slowmovintarget on Saturday March 21, 2015 @03:30PM (#9243905)
Funny thing... MVC is a pattern for GUIs (Windows and Mac desktop applications). It was simulated for the web, and none of those that you mention with the possible exception of Angular allow a real MVC pattern in a web application.

The point of it is two-fold: separation of concerns, and DRY. But the reason it so ugly on the web when it produced elegant code for GUIs is the reason that web controller schemes are not MVC.

Re:The Terrible Technical Interview by simoncion on Saturday March 21, 2015 @07:25PM (#9244689)
> Funny thing... MVC is a pattern for GUIs (Windows and Mac desktop applications).

Errm, it's a pattern often used for UI (CLI and GUI) programming that was first commercially introduced in Smalltalk-76 (in 1976). [This predates Windows and Mac by many years.]

MVC can be done -with varying degrees of difficulty- in any computer language. You don't even need a web development framework to implement it! ;-)

Re:The Terrible Technical Interview by TheOtherHobbes on Sunday March 22, 2015 @08:43AM (#9246537)
Just because it can be done, doesn't mean it can be done well.

iOS/OS X seems to do real MVC, with lightweight reusable view objects managed by ready-made controller classes. The obvious benefits are minimal memory and streamlined data flow. You only ever make/use the view objects you really need, you can recycle them to save memory, and - in OS X especially - controller objects include useful ready-made convenience methods.

Web frameworks often seem to do something that looks like MVC if you squint and don't think too hard. But when you're forced to use separate languages for logic (js), markup (HTML), and view design (CSS), and handle separate client/server environments, and there's inevitable overlap between all of the above (jquery etc) because stuff doesn't "just work", and you probably have yet another layer as a DB driver, it gets very complicated very quickly - to no great benefit.

The web has become a snarly ball of warty epicycles. That's why native is so popular - you get one common language for logic, views, and data, with a clean-ish interface to a remote server if you need one.

When everything works together like that, you can think seriously about MVC.

When the core concerns are all over the place already, it's a mess before you even start.

Which is not to say you can't work with it and build cool stuff - more that you can't just airdrop in a design pattern from a different tradition without thinking really, really hard about what, why, how, and what happens a year from now.

Re:The Terrible Technical Interview by SomeCallMeTim on Saturday March 21, 2015 @11:59PM (#9245518)
Actually, it never worked in Windows GUIs either. [1] It's just a broken concept.

Separation of concerns and DRY are both good. MVC doesn't succeed at either, except in idealized corner cases.

[1] A lot of widgets in Windows, for instance text fields, encapsulate the view (it's where the text is displayed), the model (which keeps the text in the control), and the controller (the widget handles the UI for entering text, catches and handles the mouse, etc.).

Re:The Terrible Technical Interview by ExpiredLink on Saturday March 21, 2015 @02:32PM (#9243705)
BTW, there isn't just one MVC pattern.
Re:The Terrible Technical Interview by fsk on Saturday March 21, 2015 @02:37PM (#9243728)
Yeah, I know, angular.js is MVVM and not MVC. It still sucked. The boss chose angular because he wanted to pad his resume with angular.js experience, and not because it was the right tool. That startup is still stumbling along, but wasn't as successful as it should have been.

(In angular, when you edit data in the view, the model is immediately updated, which is why it's MVVM and not MVC.)

Re:The Terrible Technical Interview by ridiculous_fish on Saturday March 21, 2015 @06:02PM (#9244351)
Once you get beyond small programs, you run into software architecture questions, which touch issues of maintainability and complexity. One of the techniques we have to manage this complexity is to break the program into components, smaller pieces that couple to each other loosely. This limits the impact of a change, since a change in one component is less likely to require changes in other components. At least that's the hope.

There's lots of ways to decompose a program, each with its own strengths and weaknesses. MVC is a particular decomposition that is useful for interactive applications. The components are named Model, View, and Controller. An example of an advantage of this decomposition is that you can apply a different user interface (e.g. a command line one) by exchanging the View, without needing to change the Model.

Other answers here have focused on MVC as it applies to web development. But MVC is from the 70s, predating the web by many years! If you look beyond the trend, you see ideas rooted in an effort to architect software well, and see MVC as just one design, one particular decomposition. The key idea is not MVC itself, but the principles behind it. Being able to place ideas into larger contexts shows mastery, in my view.

Re:The Terrible Technical Interview by StevePerkins on Saturday March 21, 2015 @02:24PM (#9243668)
As a complete beginner? No, I wouldn't call you totally unfit for developing software. I'd call you entry-level, but that's totally okay (as long as your applying for entry-level jobs and have realistic salary expectations). I didn't specify this in my comment above, but I've never really had to interview for entry-level req's. The positions that I described involved candidates with years of experience... so the fact that THEY don't have a clue about the basic design of virtually every web framework for the past two decades (i.e. MVC) is a glaring red flag.

To be honest, I'm not entirely sure that the MVC example would be a good question to ask to a younger candidate. If you had been around during the early days of web development (i.e. CGI scripts based on Perl or raw PHP, or Java where all of your logic is crammed into a JSP page), then you could say all sorts of things about the shift toward MVC being the norm. However, if you came along after that shift, and every web framework you've ever seen has been some variation on MVC principles, then it's a bit like asking a fish to describe water.

Anyway, if you're just getting started in the field, and haven't had much interview experience yet, then try not to let it get to you. Interviewing involves a TON of rejection, and that never really stops. If interviews ever start feeling easy, then it means you're selling yourself short... and you should be interviewing for more senior positions with higher salaries.

To get started though, I would suggest simply doing a Google search on "programmer interview questions", or something more specific to your background (e.g. "java interview questions"). This is exactly what the majority of your lazy interviewers are doing to come up with their questions anyway. As you encounter questions that you can't answer, then look them up and read about it (e.g. http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93cont...).

Re:The Terrible Technical Interview by bzz01 on Saturday March 21, 2015 @02:28PM (#9243691)
As an engineer with ten years of software dev experience who interviews quite a lot of candidates for my current team, I'd say don't overthink this.

BigO, data structures and having a good idea how computers work, what matters for performance both from theoretical and practical perspective, matters infinitely more to us that knowing how to play object-oriented BS bingo or subversion usage patterns.

If you know what MVC stands for, you're know enough about OO patterns to me.

Not going to argue that we got it right way(tm), just wanted to give you another perspective.

Re:The Terrible Technical Interview by sacheendra on Saturday March 21, 2015 @02:38PM (#9243732)
The MVC question is probably for candidates who have some experience in developing software. Not knowing it does not mean you are unfit for developing software. But, even if you have a little experience, you should probably know about MVC, even if you have never used it. This shows that you have familiarity with current technology. Not being familiar with current technology is definitely bad. If you are applying for a beginner position, not knowing about MVC should not be a big minus. You will only be tested on algorithms and data structures. If you don't know the answer, it is better to inform the interviewer of that and inform them of the topics you know about.
Re:The Terrible Technical Interview by tonyarkles on Saturday March 21, 2015 @10:36PM (#9245286)
As a total curiosity, what's the biggest from-scratch codebase you've ever made? In my experience so far, things like MVC don't always make a whole lot of sense until:

1) You've got a code base large enough that they matter; 2) You wrote it initially without using something like MVC; 3) And then it grew into a ridiculous monstrosity, which you then cleaned up by breaking it into models, views, and controllers.

At that point, if it turns out well, you start to "know it in your heart" instead of just being a nebulous concept that you read in a blog/textbook/whatever somewhere.