Alternatively, you could get back into school, get a PhD in something applied. Say Machine Learning or Statistics. I would argue a lot of jobs in research labs (Microsoft Research, Google etc) are less about writing a load of code but about solving an interesting problem.
To your second point (research lab)- I began my career in research and have worked at two world-class industry labs, including Microsoft Research. You are right that these jobs are less about code - explains why I did well. :) After five or ten years at those firms, you'd be surprised at how many people in those places are truly satisfied with their jobs.
At my last job, an industry research lab that I quit to do product development with my current valley company, I couldn't meet a single soul in a building of a 1000 who seemed happy and excited enough to jump in the morning and get to work. Microsoft Research was a different story - but every happy, thriving individual I met there was in love with their field. I was similar for a couple of years, but couldn't sustain that. Wanting to be part of the corporate rat race as someone else pointed out, may have been a factor.
I gave up on the medicine thing because as much as I love the field of biology and human health, the lab experience wasn't so much better than coding that it would have changed my life, nor the practice of medicine so financially rewarding it would have compensated for opportunity cost as a reasonably well-paid developer. I've found that my career's had up and down cycles but overall I'm very fortunate to be in this line of work. You might as well, but I don't think you're crazy to want to leave the field either.
Whatever you end up doing, best of luck to you in the endeavor!
Lets assume you graduated at 22, and your 28 now... You have a total of 6 years of experience, and the reality is the first three of those were you unlearning computer science and starting on the path of engineering...
The problem may be what your coding. If your interested in math and science and business is the code your writing DOING those things? Programing is PART of the job, figuring out what to code is the bigger part, and if that isn't interesting then the coding is even MORE un-natrual. Does what your company does excite you in any way, are there interesting parts of it for you to chase after, and if there aren't can you name a company that does something that you think is interesting?
The other question I have is are you in the US (an Ivy school) but not FROM the US ("my country's...")? I ask because it may be compounding the issues your having.
The harder question for you is, are you having a moment of self doubt, or are you really looking to get out? If I reflect back on my on career then at points I think I have said everything you are saying... but I had folks around me who listening and giving me answers to help me keep going.
After reading through the rest of your responses in this thread let me dish out some advice
-- We all have moments of self doubt, your aware your having one, so thats huge
-- Looking at your own code and seeing the flaws, thats normal. There are actors who hate seeing themselves on film because they only see their mistakes. If you aren't looking back, and you aren't seeing problems then your either foolish or over worked.
-- Small is easy, big is hard. This is true of all things in life, if your making a holiday meal (large) its a whole hell of a lot different than making your lunch.
-- Honestly you need to read this: http://discovermagazine.com/2015/june/13-curiosity-we-have-a... if your current work culture isn't like that, CHANGE JOBS NOW. Everyone screws up, if you find it, and your willing to own it, they should support you. I once lost several hundred thousand dollars with a bug, at the end of the day my boss invited me to a meeting, I thought I was going to to get fired and he could see it. His response was "you did the right thing, and your never going to make that mistake again, your worth several hundred thousand dollars as an engineer now so relax.
-- Learning new languages sucks. Its hard and your going to be terrible for a long time. Deal with it. There is a quote from a cartoon "sucking at something is the first step to becoming sorta good at something"
-- Your use of VIM/C and unwillingness to part with it seem to say that your stuck in a rut. Vim is great don't get me wrong, and if your going to learn a new language a bare bones editor forces you to read... but in the long run your missing out on a world of tools that will make your job easier and faster! Change is hard, your going to suck at using the tools but you will get better with time
-- Reading code is even more unnatural than writing it and I think I suck at it. I have been told by several people that I have an amazing proficiency for reading code, that no one they know is faster or better at it. You know what though, I read a lot of code, a LOT of code, a good portion of my day is spent looking at other peoples work... I read peoples checkins, I read bug reports and fixes, I read things that interest me that aren't even remotely related to what I'm doing at present.
-- No one is perfect or even good at everything... so your code doesn't scale out of the box, the person next to you who's does, have you ever read it? if not go do it (read code) and figure out what THEY screwed up... keep reading it till you understand it, till you find the mistakes...
But to be perfectly honest it seems like you are in the rat race. Check out the book Happier.
Take away technology, what are you passionate about? If you founded a company, it went big, you cashed out and started a foundation, who would your foundation give money to?
Go do that.
(offt: I don't really have any connection with the SV since I'm not US based and not working for a product company. So I have no clue about current state of Bizdev/M&(t)A there... Care to elaborate?)
If you think it a worthy goal to become good at it, best way is to do it more. Otherwise, stay to something you like and do well.
Are you by any chance a perfectionist? There always will be places to improve your designs, especially if you're a perfectionist. Part of the answer is to not be such a perfectionist. You can scale perfection (or almost perfection) up to a point, but not beyond; 2000 lines seems like reasonably close to the breaking point.
Everybody's more comfortable in their preferred environment. Learning a new set of tools is not fun, because you're less effective than you would be in your normal environment, and you know it, and you compare your clumsiness with the new tool to how well you can do with the old one. But you sound like a pretty smart person, and you should be able to learn new things pretty readily. It sounds like you're unwilling to ride through the phase of uneasiness, of I-don't-know-how-to-do-anything-with-this-stupid-new-tool, of feeling dumb and clumsy, for long enough to become proficient. Look, I don't like having to do that, either. I usually kind of resist doing so for a while. But don't let it stop you from learning new stuff; whatever you go into, you're going to have to do that.
As for feeling dumb when learning new things; you may have to accept that no amount of experience/data point will let you "prove to yourself" that you will be good at a new challenge.
My software engineer/wife/best friend pretty much rocks at every job she's worked at. I've lost track of how many times she's told me "I don't know if I can do this job." when she starts a new job. She's been going through this cycle of new job=>self doubt=>mastery multiple times for over 2 decades and she still feels that way. Apparently, no amount of data points will dispel that feeling for some people.
http://www.quora.com/Reviews-of-Haskell-programming-language
From Tikhon Jelvis' answer:
"I personally rank languages on three largely orthogonal axes: productivity, maintainability and performance. That is: how quickly, comfortably and efficiently I can write code; how easy it is to ensure the code is correct, refactor it and add features; and how fast the resulting code can run. For different projects, the different axes will have different weights.
If the weights are about equal, Haskell is the best choice. Moreover, I do not know any language that can beat Haskell along any two axes: sure, there are (in fact, many) languages that perform better, and there are languages that lead to more correct, more maintainable code, and there are even languages that are more productive. But never more than one at a time."
I totally agree with the above and it's why I think Haskell is the best general programming language out there. I see it as the same niche as python, ruby, lisp, C#, Java, Go, etc.
When it becomes 10x easier to express complex ideas and algorithms with a fraction of the code by making use of built-in language features, it's a breath of fresh air. The huge ecosystem of easy-to-use libraries for most anything doesn't hurt either. I can enjoy focusing on the problem I'm trying to solve instead of how to structure my code, what design pattern I should be using due to a limited static type system, how best to avoid memory corruption or seg faults, etc. It's akin to writing pseudo code, and then having it execute.
Another great thing about Python in particular is that it ends to be extremely easy to read other people's code due to semantic whitespace and also by language design of there only being one way to do things.
If Python turns out to be your thing, it's popular in data science/machine learning. If you lean in that direction, you may be able to work more on some complex math/stats problems and less on writing/maintaining large low-level codebases.
Also, that feeling that your code is not perfect is really common. I've been programming for ~20 years and it has never gone away. What's helped me a lot is focusing on the end result of the product, and its impact on the business and the value it creates. As someone who wants every line of code to be error free, as performant as possible, and properly structured, I find comfort knowing my "good enough" solution (and sometimes not-so-good solution) is making business owners and end-users more than happy.