<p>This question reminds me of the thought-provoking question: <em>Would you rather slay one horse-sized duck or 100 duck-sized horses.</em></p>

<p>For beginners, I recommend solving lots of simple problems. This practice is crucial to learning, because all the programming concepts are new, and you need to experience them. For example, sometimes it takes several programs that use a single <strong>for</strong> loop to really understand how a <strong>for</strong> loop works.</p>

<p>For advanced programmers, the hard problems can be beneficial. But what makes them hard? Is it the length of the program? Is it low-level or advanced concepts (e.g., threads). I would accept a very difficult assignment if it meant learning something useful or desirable.</p>

<p>In general, I tell my students to practice writing lots of programs, no matter how small/large, easy/difficult. Any program is better than not writing one.</p>

CC BY-SA 4.0
2018-11-14T19:28:30.653Z
2018-11-14T19:28:30.653Z
Edwin Torres
<p>It is probably a mistake to <em>always</em> do one or the other. If you are learning a hard task (becoming a competent programmer), it isn't helpful if you mix in another hard task as well (hard problems). Initially, it is good to write programs for problems that you already understand well, so that you can focus on the creation. A program has both form and content. If you work on very hard problems exclusively, it is possible that you will wind up just hacking a solution together without any elegance. </p>

<p>But if you never solve hard problems it won't become clear to you why advanced programming structures and paradigms are needed. </p>

<p>My advice would be to start out your programming education with fairly easy problems - that you can get your mind around easily. But mix in a harder problem or two as you go. Then when you become more proficient with the forms, move to harder problems and occasional very hard ones. </p>

<p>You are stretching your brain in two dimensions here. Eventually you want it to be very flexible. But you can stretch more in one dimension than the other at a time. If your problems are so difficult that you get frustrated then you may not make much progress on any dimension. </p>

<p>And, of course, problems that seem hard to a novice programmer, may not seem very hard to a pro. You learn a lot of tricks-of-the-trade as you go along. </p>

<p>Also the problem that you mentioned doesn't result in a very big program. It is a bit tricky, of course, but very small as programs go. You want to reach a place where you can intelligently create <em>very</em> large programs. </p>

CC BY-SA 4.0
2018-11-14T11:40:32.300Z
2018-11-14T11:59:54.683Z
2018-11-14T11:59:54.683Z
Buffy
<blockquote>
  <p>Is there worth of spending time to try those kind of problems or should one always try to solve problems as easily as possible?</p>
</blockquote>

<p>You should work on problems that are fun and interesting to you, and that are slightly harder than the problems you're already comfortable with.</p>

<p>Programming is a <strong>craft</strong>, similar to playing a musical instrument or playing a sport. You have to <strong>practice</strong> programming to improve, exactly the way you have to practice playing the piano or throwing a baseball.</p>

<p>When learning to play the piano, do you always play the songs that are easiest for you, or do you always try to play the hardest song ever written? When learning how to hit a baseball, do you only practice with slow underhand tosses, or do you only practice with 100 MPH curveballs?</p>

<p>The answer is none of the above. You practice by getting a little bit better every day. For piano, maybe you learn a new song that's a little bit more complicated than the song you learned last month. For baseball, maybe you practice with somebody who throws the ball a little bit faster over time.</p>

<p>The same is true of programming. You have to meet yourself where you are. Don't spend too much time on stuff you already have memorized (although, there is some merit to <a href="https://en.wikipedia.org/wiki/Kata_(programming)" rel="nofollow noreferrer">programming kata</a>), but don't spend too much time struggling on impossible problems either.</p>

<p>In other words, you should try to keep yourself just slightly outside of your own comfort zone. You also might want to read about the <a href="https://en.wikipedia.org/wiki/Zone_of_proximal_development" rel="nofollow noreferrer">zone of proximal development</a>.</p>

<p>Specifically, here's what I recommend:</p>

<p><strong>Give yourself an achievable goal.</strong> The goal should be fun and interesting to you, and it should be achievable in a reasonable amount of time. A single weekend is a good starting point. Finish that goal, and then iterate. Explore topics that you're interested in, but do it with short achievable steps.</p>

CC BY-SA 4.0
2018-11-16T02:23:43.623Z
2018-11-16T02:23:43.623Z
Kevin Workman
<p>As one learns programming, how useful it is to spend time to solve hard problems? Like, I saw a problem solving site where one task is for example to find a regular expression for decimal numbers divisible by 9 or do regular expression for a particular problem that is as small as possible (in sense of number of characters in the expression). Is there worth of spending time to try those kind of problems or should one always try to solve problems as easily as possible?</p>

CC BY-SA 4.0
2018-11-14T14:36:42.093Z
Challenging yourself is good but I have doubts as to the value of code-golf style challenges. If you enjoy it, though, go for it --- but remember that you would never want to have to support someone else's code written in that style. (Brevity is good, but not at the cost of clarity.)
Adam
<self-learning>
Should one study programming by doing hard problem?
# Should one study programming by doing hard problem?

(Asked by: username_0 on 2018-11-14)

As one learns programming, how useful it is to spend time to solve hard problems? Like, I saw a problem solving site where one task is for example to find a regular expression for decimal numbers divisible by 9 or do regular expression for a particular problem that is as small as possible (in sense of number of characters in the expression). Is there worth of spending time to try those kind of problems or should one always try to solve problems as easily as possible?

**Tags:** self-learning

> **Comments:**
> **username_1**: Challenging yourself is good but I have doubts as to the value of code-golf style challenges. If you enjoy it, though, go for it --- but remember that you would never want to have to support someone else's code written in that style. (Brevity is good, but not at the cost of clarity.)  

---

## 3 answers

### Answer by username_2 on 2018-11-14. Score: 3

This question reminds me of the thought-provoking question: *Would you rather slay one horse-sized duck or 100 duck-sized horses.*

For beginners, I recommend solving lots of simple problems. This practice is crucial to learning, because all the programming concepts are new, and you need to experience them. For example, sometimes it takes several programs that use a single **for** loop to really understand how a **for** loop works.

For advanced programmers, the hard problems can be beneficial. But what makes them hard? Is it the length of the program? Is it low-level or advanced concepts (e.g., threads). I would accept a very difficult assignment if it meant learning something useful or desirable.

In general, I tell my students to practice writing lots of programs, no matter how small/large, easy/difficult. Any program is better than not writing one.


---

### Answer by username_3 on 2018-11-14. Score: 3

It is probably a mistake to *always* do one or the other. If you are learning a hard task (becoming a competent programmer), it isn't helpful if you mix in another hard task as well (hard problems). Initially, it is good to write programs for problems that you already understand well, so that you can focus on the creation. A program has both form and content. If you work on very hard problems exclusively, it is possible that you will wind up just hacking a solution together without any elegance.

But if you never solve hard problems it won't become clear to you why advanced programming structures and paradigms are needed.

My advice would be to start out your programming education with fairly easy problems - that you can get your mind around easily. But mix in a harder problem or two as you go. Then when you become more proficient with the forms, move to harder problems and occasional very hard ones.

You are stretching your brain in two dimensions here. Eventually you want it to be very flexible. But you can stretch more in one dimension than the other at a time. If your problems are so difficult that you get frustrated then you may not make much progress on any dimension.

And, of course, problems that seem hard to a novice programmer, may not seem very hard to a pro. You learn a lot of tricks-of-the-trade as you go along.

Also the problem that you mentioned doesn't result in a very big program. It is a bit tricky, of course, but very small as programs go. You want to reach a place where you can intelligently create *very* large programs.


---

### Answer by username_4 on 2018-11-16. Score: 2

> Is there worth of spending time to try those kind of problems or should one always try to solve problems as easily as possible?

You should work on problems that are fun and interesting to you, and that are slightly harder than the problems you're already comfortable with.

Programming is a **craft**, similar to playing a musical instrument or playing a sport. You have to **practice** programming to improve, exactly the way you have to practice playing the piano or throwing a baseball.

When learning to play the piano, do you always play the songs that are easiest for you, or do you always try to play the hardest song ever written? When learning how to hit a baseball, do you only practice with slow underhand tosses, or do you only practice with 100 MPH curveballs?

The answer is none of the above. You practice by getting a little bit better every day. For piano, maybe you learn a new song that's a little bit more complicated than the song you learned last month. For baseball, maybe you practice with somebody who throws the ball a little bit faster over time.

The same is true of programming. You have to meet yourself where you are. Don't spend too much time on stuff you already have memorized (although, there is some merit to [programming kata](https://en.wikipedia.org/wiki/Kata_(programming))), but don't spend too much time struggling on impossible problems either.

In other words, you should try to keep yourself just slightly outside of your own comfort zone. You also might want to read about the [zone of proximal development](https://en.wikipedia.org/wiki/Zone_of_proximal_development).

Specifically, here's what I recommend:

**Give yourself an achievable goal.** The goal should be fun and interesting to you, and it should be achievable in a reasonable amount of time. A single weekend is a good starting point. Finish that goal, and then iterate. Explore topics that you're interested in, but do it with short achievable steps.


---

