46 points · by Tmp1234 · 8y ago · 68 comments
I take an extremely long time to come up with solutions to any problems. I enjoy trying to solve problems and coming up with a high level solution, but I get stuck for hours on details or miss vital parts of the algorithm so often it becomes a drag. Personal projects take me an extreme amount of time too and I haven’t made any of note. I’m not good at organizing code and I am not detail orientated which means I tend to get a lot of one off type errors and can take hours to find them. Even problems I’ve seen before, I’ll likely forget the solution or fail to recreate it.
To give a concrete example of some of the above, just this morning I tried to code the brute force solution following problem: Give two sorted arrays return the median. I spent over an hour trying to implement the brute force solution involving linearly going through each array and couldn’t code it in Python. The entire time I was struggling to figure out how to increase the respective index variables given different cases, how I would ensure one of the numbers the indices landed was the median, how to differentiate which of the array indices I was keeping track of was the actual median and finally how to determine the next number I needed if the lengths of both arrays were even.
Many problems go the same way. I don’t know what the difference between the normal struggle associated with coding is and the sort of struggle that means it’s just not for me. I'm not looking for encouragement per se, but objective feedback on which group I belong to and practical advice on how to move forward.
Programming is akin to building a house. Once the blueprint is figured out, the actual act of building (putting bricks together, etc) is actually pretty straightforward. The key though, is good the planning.
By good planning, in your example of returning the median, you should solve the problem before touching your computer. Use either pencil-and-paper or whiteboard method as much as possible. For example, I'd plan it as follow: 1. Solve it in a high-level manner, as if you're trying to teach someone who never codes a program before 2. Write down all the function definitions you need (don't code the body, just know what each does) 3. Write down how all the functions are to interact (again, don't write the body of any of the functions yet, just assume you have them) 4. Write down pseudocode for each of the functions 5. Code
I've seen lots of beginner programmers tried to skip over to 5 without concrete plan only ended up confusing himself over trivial problem. No matter how tempting it is, jumping straight to 5 without concrete plan is only going to confuse you.
I forgot whether it was Leslie Lamport or Edsger Dijkstra, but one of them said that a good programmer should have the skill to fully plan out a computer program without coding it.
The need to make what I'm thinking precise and understandable to the computer or the oversight of edge cases or, sometimes, an entire set of cases I didn't have in mind originally when coming up with the high level solution, evades me until I hit a wall. I don't know how to know what I don't know- I don't know how to see what I'm overlooking when it sounds like a solid and complete algorithm on a high level.
Then there are times when I simply don't know where to start and nothing comes to me. I think your outline is good, but I'm not sure what to do with it if the ideas and logic simply don't come to my head.
To me this sounds like you should spend more time in the planning phase. Sounds like your plan needs to be more detailed and concrete. If you hadn't yet come up with a high-level solution, jumping straight to code wouldn't help either, it'll only make it more confusing.
>>but I'm not sure what to do with it if the ideas and logic simply don't come to my head.
What sort of ideas and logic are you specifically having problem with? If they're about algorithms, try reading more algorithm books (Thomas Cormen's Introduction to Algorithm is really good), do more practice programming (I used to practice a lot here https://practiceit.cs.washington.edu/). In general I'd suggest try to see more problems where the solutions are available, but don't immediately see the solutions. Try to do it yourself first.
To be concrete, yesterday I tried to solve this question: https://leetcode.com/problems/wildcard-matching/ I spent 45 minutes on the planning phase which would be the entire time I'd have for the problem in an interview. I had some pseudocode, thought through it, tried an example or two and then decided to code it up. As I did I realized a few more examples which I added in. Finally, I had some code that seemed even more correct than the code I thought was already correct. I run it and test cases fail. I spent 2.5 hours in total trying to get them all to pass without realizing the central issue of the question is what to do when you hit a * character. The necessity to try all the combinations of the string after a * doesn't not occur to me in 2.5 hours; I kept tweaking for specific cases I was failing. I ask a friend about the problem and in less than two minutes he realizes you need to try all combinations.
>>What sort of ideas and logic are you specifically having problem with?
It seems everything. Sure, some problems turn out to have an algorithm that I didn't know about it. Like the other day I was trying to do a problem that basically needed topological sort and I never really learned top sort. But then I read in the solution in CTCI that it's reasonable to derive that on one's own in a 45 minute interview so there goes that. More generally, it just seems when a problem reaches a certain level of difficulty my brain simply can't solve it. I suspect it's an intelligence thing. I just don't have a high enough IQ to get passed a certain point.
I will look at the resources you mentioned.
Alas, not all is lost. Screw what you did wrong yesterday and in the past, and start fresh today.
For personal projects, keep the scope minimal. Better to finish something than not finish anything at all. And if you're struggling with something as basic as type errors, then your approach to programming is wrong. You have to drill this to your head: code a little, test a little.
Of course, all of this on the assumption that you have speckles of ember left to turn it into a fire - to have the drive to learn and improve.
Best of luck.
Coding is not an activity reserved for the "gifted". Your daily thought processes are far more complicated than coding, and it's highly likely you have all the capacity you'll ever need to be good at it. Before you know it, you'll know 5-10 different languages and pick new ones up in days. You'll be able to solve problems in a dozen different ways, and translate problems from one structure to another; much the same way that you can already do with human language.
Ask yourself if you give-a-f*ck enough to stick with it. That's the main factor in most pursuits, the other considerations are for suckers and mostly benefit someone else.
For the past 14 years I've run my own web dev company but I understood my limitations and hired people who are actually good at coding and I've stuck to what I'm good at.
From what you write, there doesn't appear to be a passion for coding - avoiding assignments & now struggling with core constructs point to that. But something at some point got you into this field - perhaps there's something to the side that might suit your skills/passion more? Testing, QA, project management, client management, business analysis... there's lots of roles that benefit of understanding programming concepts that don't rely on you actually being a gun programmer.
I got into programming for the money and because I like problem solving and concrete results. I honestly think it would be perfect match if I had +10 IQ points. As for your suggestion, I wouldn't know where to begin looking for things "on the side" as you put it.
- You need better practice, not more practice
- There's a difference between <being able to be hired by google> and <being able to be hired by a small company that needs a programmer>.
- Go through the MOOC "learning how to learn", sleep 8 hours, eat some ice cream, get hired by a small company, become a programmer.
Thank me in a couple of weeks for that.
With that said, think about why you chose to major in computer science and what classes you enjoyed the most. Maybe there's a specialty you really want to do, maybe you would prefer to do something tangential to programming like project management, information security or data analysis. You may find more it more interesting and easier to work on practical projects. It's probably worth trying some web development work (especially in languages such as ruby or python with foreach semantics where you won't need to worry about off by one errors as much)
I chose cs because I like problem solving, having a concrete end result and because it's a way to make good money without an extreme amount of years in school.
This is especially relevant if you think your disability is affecting the quality of your practice. You made need to engage in different strategies to get the most out of practice. (or to manage the kinds of problems you're working on).
It's possible that you would have a lot of difficulty with a career in programming, but I wouldn't even consider that until a skilled tutor or two feel that way.
There are few prodigies in the field. Most people make it through sheer work ethic and self-belief. Do everything you can to hangout with other passionate people (if they're more skilled than you even better). The best way to do this is just get your foot in the door somewhere. Do whatever it takes. One year in a work environment gaining real world experience is priceless and your skills will skyrocket if you challenge yourself and step outside your comfort area.
Best of luck to you (whether you continue pursuing programming or something else)!
PS: For what it's worth, just understanding the above problem you described is half the battle. The other half is getting comfortable implementing different algorithms. For this, you can seriously just copy paste someone's solution from stack exchange and execute the code to observe the effects of your tweaks. It's kind of like how most people need to practice solving the math problems before being able to grasp the concepts behind the solution.
Some disabilities can be helped with aggressive nutritional support.
You can also learn coping mechanisms to help you work around your weak areas more easily. The exact mechanism will depend very much on the disability in question.
I'm speaking from firsthand experience.
I'm medically handicapped. I have days when I'm fairly together and days when nothing comes easily. I do a lot of self care and I have learned coping mechanisms. I am more productive than I used to be and some tasks are just easier for me than others.
I also raised and homeschooled two sons who have disabilities. They still live with me.
> Some disabilities can be helped with aggressive nutritional support.
What do you mean? Any examples you could give?
When I did a high school paper on functional hypoglycemia in the 1980s, at that time, the only known effective treatment was high dose vitamin therapy and a modified diet.
Studies suggest that children with issues like ADHD benefit more from certain supplements than from standard drug therapies.
Years ago when my now 31 year old son was 8, I found a vitamin therapy protocol on the internet for Aspie kids. He has never been formally diagnosed, but he reads as very Aspie. It was some B vitamins, magnesium and one other thing, I can't recall what the last item was. After a few months on it, his severe handwriting issues improved and he began comprehending social things better. To this day, when he makes me too crazy about certain things, the solution is to get more B vitamins into him -- though we no longer use supplements and the solution these days is beef. He gets a steak for dinner when he is making me apoplectic.
Magnesium helps with noise sensitivity. I frequently run fevers. Afterwards, I am often noise sensitive. At that point, I eat dark chocolate and cashews for their magnesium content.
Firsthand personal experience suggests that many neurological issues can be ameliorated with sufficient B vitamins, good quality salt and the right fats, including cholesterol, found in foods like eggs and bacon.
I have a CS degree, and although I managed all my programming assignments just fine, I didn't really feel that I "knew" how to program for a few years after that. OOP took a long time to "click" for me, and every year I can look back at code I've written and see terrible mistakes I've made.
What's funny about that now is that I've built systems that are being used by millions of people, and despite them (in my mind) being a horrible mess of inefficiencies, poor coding practices, and questionable decisions, they're still working.
To me, it sounds like you're beating yourself up over nothing. It's easy to read comments on HN and assume that everyone else is a shit-hot programmer and that you must be useless, but in the real world programming is really fucking hard! Having a good CS education helps, but I've worked with fantastic developers with zero education or bootcamp experience, and CS graduates from Oxbridge that couldn't write real-world code if they lives depended on it.
I'd recommend simply getting a job. Find a company with a set of good senior-level developers, and learn from them. Even with a degree you'll be near the bottom of the ladder, and you'll be learning constantly, but that's why you're there. You'll be surprised at how much you'll pick up once you get stuck in.
2. You will get better with practice.
3. Nobody is born knowing how to code. It's fairly absurd to imagine Nature carefully selecting the ability to configure Dockerfiles. There may be genetic markers for neurobiological traits that accelerate learning in certain fields, but this acceleration is only an advantage if you're trying to master as many things as possible within a lifespan, or you're working under some other deadline. If you really want to code (whether out of personal interest, financial interest, or some other motivation), you can do it as long as you practice correctly and put in the time.
4. Practicing correctly is important. I'd recommend the "Learning How to Learn" course. I personally keep this quote taped to my computer:
"The most effective learning requires a well-defined task with an appropriate difficulty level for the particular individual, informative feedback, and opportunities for repetition and corrections of errors."
From here:
Of course the alternative is to not be a programmer; there are still plenty of related disciplines you can choose from.
Ultimately it's up to you to decide if you even love doing programming; recall why you chose this major; do some soul-searching and decide whether you have the motivation and interest to continue. Maybe take a short break go to the mountains or somewhere else, and clear up your mind.
Some developers I've worked with are incredibly smart, but also know that of themselves and (with that knowledge) prefer to work without the constraints of having to explain themselves to others. However genius doesn't scale well, and this kind of attitude can make them less effective in teams. So learning to be a team player and adopting scalable ways of working can be a strength of your lack of ego, if you choose to see it that way.
Don't just think there's one set of criteria that all employers are looking for. Present your best self and I'm sure you'll find somewhere to work.
merged = sorted(a + b)
median = merged[len(merged) / 2]
Like twunde said, you just sound rusty. How often do you write code? Do you use Python or something else? It sounds like you're putting too much pressure on yourself.Granted it does take a knack to be a good programmer, attention to detail a feel for what's wrong when tracking down a bug.
But every problem will be a struggle the first time but as you get more experience things will get easier and easier and your programming intuition of what to do and what's wrong will become better and better.
There is a wide variety of jobs out there. Maybe test out a few frameworks and see what you like.
I always recommend learning Rails or Laravel because working on web applications is always interesting and both frameworks have great communities and learning resources.
Don't give up if you enjoy it. I think you're making it harder than it is. Your degree just gets you in the door. You're going to learn and do so much that wasn't covered in your classes.
Good luck.
Let's say you want to make a single player Tetris game right now, on a platform of your choice. Could you do that?
Single player Tetris, maybe not. I don't know graphics libraries. Maybe, if I just continually printed a 2d array on screen then I could figure out the logic, I think.
Sit down in front of a piece of paper with a pen. Draw diagrams to visualize the data structures that you're working with. Sketch different corner cases (for example, arrays of odd and even length). Informally (playfully) derive an algorithm to do what you want and convince yourself that it does what you want. Play through different cases on paper, maybe use markers (coins) to keep track of where you are. Write down the details so you don't have to keep them in your head.
I have plenty of experience now, but I still use paper and pencil when I have to solve a problem I haven't solved before. It's just so much easier to explore the problem on paper, to think about corner cases, to visualize the inputs, outputs, and intermediate data structures, and to wrap your head around everything.
My gut feeling is you won’t like that statement because you do want to be a programmer. Stick at it, you will be fine.
You are lacking in confidence. I created a saas product 10 years ago as a sysadmin with a quality of coding that would bring a tear to many programmer’s eyes.
My kids appreciate the code though as it has paid for about half a dozen trips to Disney.
If you want to work in programming you will. Part of the problem with your age group is expectation. Society has told you that you are all awesome which obviously can’t be true. You may be awesome, you may be good, you may be ok. Be confident and do the best you can when you get a job.
Ps. Some of my coding errors have involved editing the wrong file and spending several hours troubleshooting. A colleage also nicknamed me arraybreaker as I often abused 0 index arrays. Your problems are much more advanced :-)
It's easy to get sucked into a coding problem and fight with it for days like it's a personal challenge to your abilities. That can turn into a habit. It did for me. Screw that. Admit you have a problem and then get over it.
The goal of working is to produce something, and not necessarily, or even very often, to invent something new or even invent a new way of doing something. Coding is no different.
The truth is for most of us coding is more often akin to assembling something even when you're designing and building something new. That's how I approach it anyway.
When I switched from coding mainly Perl to Javascript I learned (the hard way) to start searching for answers first instead of banging my head on my desk for hours (even days) over what were often times really just syntax issues or things that already had boilerplate solutions publicly available.
Learning to search for answers first made a huge difference in my productivity and in how much I enjoyed coding. Getting stuff done provides a sense of accomplishment and we all need that to inspire us to keep working.
And it's made me a better coder too. I have learned so many new and better ways to do things, as well as how not to do them, and found great explanations on the "whys" and "hows" in the process. And I learn them when they're relevant to what I'm working on too, not in some abstract way that is easy to forget or dismiss.
The truth is there is way more to learn about coding than we can possibly learn already and that gap is constantly expanding. That's really a great thing though because learning on a need to know basis makes it so much easier to get stuff done. It lets us focus on one problem at a time and not worry about what comes after. We can learn what we need when we get there and by then there might be a new and better way.
When I first started making a habit of searching for answers and example code for how to do something I was amazed a few times to find an answer. Now I'm more surprised when I don't find one easily.
To me, that's what a "hacker" is in the truest sense. You find and write and hack together code. There's nothing wrong with that. It's why we have "open source" code and in fact it's truly awesome.
It all comes down to this. To get really good at this (or anything) requires such an investment in time, and for you to push through all the stops when things get really difficult or tiring.
I know many entrepreneurs have said this repeatedly, but it's something I've really only learnt in the last few years. It's better to find some way to make money doing what you love, than learn to love what will make you money.
I pivoted in my business to an area that made more money and I got a lot more clients. And I was also really good at that area. But as the work load grew, and more clients came on, I started struggling with motivation because I really didn't love the work. I started letting clients down because I just couldn't motivate myself to put in even more hours to really excel for the client. I struggled to find people to hire because the skills were so rare, and that's part of the reason why clients were paying so much. Even though the money was great, it didn't solve the problem of the lack of motivation. It was a real struggle to even get started, and then to continue to work, even with the money.
Now I'm lucky in that I do know what I love to do. But I still haven't found a way to make as much money doing that. But what I did do is scale back the paying work that I didn't love to make way for more of the work I did love. I think with experimentation and persistence I may be able to pivot and find an income stream doing what I love. But one thing is for sure. I am much happier and much more motivated. So I am doing more work in general and of a higher quality. I feel like my life has more purpose, and that it's not 'going to waste'.
So If I were you I'd ask myself that. Do I love programming? Do you really love it? If you don't, what do you love to do? You may have been carried a bit through your degree, but you have it now, and it can open a lot of doors. The tech field is enormous. How can you take what you do love, take your degree, and combine it into a job that can earn you some money doing what you love, and providing your life with purpose?
And I mean practice on some project that you are personally interested in completing, some genuine goal, not an exercise or theoretical. /academic challenge.
Everyone struggles as they strain to reach the next level. Do you enjoy the struggle or its outcome? If you're not having fun now, programming as a career will seriously suck for you. If you are having fun, don't worry about your speed or how well you grok algorithms - find a job, any job, and try to kick ass at it. That'll set you up for a better job. Rinse and repeat.
Even those people who invented these algorithms took years to do it. How do you expect yourself to do this in minutes?
Ability to not solve leetcode problems is a very bad proxy to measure anything with regards to your skills in delivering software.
There are lots of jobs that are coding adjacent. Technical SEO is an example. A mate of mine does installations of software inhouse.
You don't have to code, per se, you can likely find a job where coding knowledge helps but is not specifically what you do.
There is a lot s scope in IT beyond coding, and I'd consider exploring that.
You may be surprised to find you're able to help people solve technology problems that comp sci majors struggle to understand.
Keep moving, inward, onward, upward.
When I work on my own things, I waste a lot of time trying different ideas/implementations because there's no time constraints or due date.
"...the simplest solution tends to be the right one..."
Although its not the intended context, its extremely useful to remember when building software (at least to begin with)
Your code example is trivial for me. But I've been a professional programmer for nearly 30 years. I've been programming for 41 years. I programmed at least a little bit almost every single day of those 41 years (I'm not sure if I have ever spent even 1 month away from the keyboard). When you have done the same thing as I have done, then this problem will be trivial to you too.
Doing a 4 year CS degree is waaaaay too short a time to decide whether or not you are going to be successful at this stuff. Yeah, some people are super talented and pick it up right away. But then, some of the people that look like they are super talented are that way because they've been programming since they were able to read.
If you are struggling now, then you will struggle at work too. You will probably have to work harder than the people who are talented or the people who appear talented because they have already put in a decade or two before you even started. You may find that the 9-5 work day is not enough for you to make the kind of progress you want in your career. There is nothing wrong with this.
The question you have to ask yourself is, "Do I want to do this?" If you are struggling, do you want to struggle? I struggle too -- even after more than 4 decades of programming every day. I pick away at it slowly, by slowly, by slowly. I have this super, ridiculous ego that fuels me, but I've also gotten old enough to realise that my ego is just that thing that let's me ignore how crap I am -- sometimes you have to do that. "Yeah, whatever. I seem to suck now, but just wait until you see my super awesome computer program that I'm doing on the side." (And... I never finish my side projects either... Don't tell anybody!)
On the other hand, there are lots of jobs in this world. You don't have to be a programmer. There are lots of reasons not to be a programmer and none of them revolve around whether or not you are talented at the job. It's lonely. It's stressful. It's stupifyingly hard to concentrate every second of the day all day long. People yell at you for fucking things up even when you've done a good job. Nobody can agree on what's good and what's not good and often sit around arguing about it all day long. because it's a super ridiculously details oriented job, most of your successful colleagues will have some kind of OCD related mental problem. Because it's a super ridiculously details oriented job, nobody will understand what you do for a living and everyone will think to themselves, "But that's easy. I could do that in 15 minutes. God you suck". The pay is good, but it's never enough to put up with the crap you have to take -- seriously, ask people why they want a raise; the answer is always, "Because if I'm going to have to put up with that crap, I want a lot more money".
So, be a programmer if you want to be a programmer. Not being talented is the least of your worries. That's just a matter of putting in the time and effort. Your rewards will be internal. If you love what you are doing, then the rewards will be great.
And I have a confession. If I did that coding example, I would definitely make an off by one mistake. Definitely. :-)