r/learnprogramming • • Feb 08 '19

Two mistakes that trap new programmers

Most aspiring programmers get trapped and fail to move forward. As a teacher, I get to observe how some programmers keep moving forward. Here's two signs you are trapped.

Trapped coders focus on anything but coding.

Trapped programmers love to debate which language or framework is best. They spend their time figuring out what to learn and end up learning nothing at all. So let me answer all your questions.

Learn Python.

But what if I need to learn C#?
Learn C# after.

Isn't Javascript the language of the future?
Learn Javascript after.

My developer friend told me I should learn C++ because all languages are based on it.
Learn C++ after.

New programmers fear they could be wasting time learning the "wrong language". Programming is the fastest industry in history. Good developers learn new languages and frameworks on a yearly basis. Three years from now, your knowledge will be outdated. If that scares you then find a different career.

Trapped coders following directions too well.

Trapped programmers follow tutorials like mindless robots. Copying pasting code doesn’t teach you anything. Imagine starting a python tutorial that taught you how to print “hello world”.

print(“hello world”)

Most people copy/paste this and move on. If you were my student, I'd push you farther.

  1. Change the code so it prints “howdy”.

  2. Print two alerts. One that says “whats up?” and “take care”.

  3. Continue with the tutorial (usually goes to variables). After a few problems, print “hi” from mental recall.

  4. Since we probably encountered variables by now, what will the code print below? Why?

    greeting = “howdy”
    print(greeting)
    print(“greeting”)
  5. Fix the code below so it prints “hello”.

    Print(hello)

By the end of my exercises, you would have a strong idea of how print statements work. A simple line of code can create a myriad of problems. Most people brush past it only to get stuck in the future. I always recommend finding a school or mentor for guidance. If you can't do that, be proactive with your learning and keep at it.

Good luck!

1.7k Upvotes

349 comments sorted by

View all comments

Show parent comments

9

u/Yithar Feb 09 '19

JS is not for beginners. It's messy, behaves weird, and is hard to write clean code. An experienced programmer can deal with these things, but a beginner will just end up developing bad habits that will be hard to unlearn.

Honestly, it's hard to argue with what you say.

TFW my co-worker graduated from a coding bootcamp that only taught Javascript and it's hard to teach her good habits. We use Typescript at work for our frontend, but she still has a lot of bad habits (using any a lot, forEach instead of map/filter/reduce, etc.).

0

u/[deleted] Feb 09 '19

[deleted]

2

u/Yithar Feb 09 '19

Because it takes more brainpower.

http://frontendcollisionblog.com/javascript/2015/08/15/3-reasons-you-should-not-be-using-foreach.html

Any fool can write code that a computer can understand. Good programmers write code that humans can understand.

I really think there are some people here that just like their for loops for some reason, but they're introducing incidental complexity that doesn't need to be introduced. I'm not wrong in any way.

0

u/[deleted] Feb 09 '19

[deleted]

2

u/Yithar Feb 10 '19 edited Feb 10 '19

Yes, and please take no offense to this, that's why you're an amateur and not a professional. I can look at map and filter and know exactly what's going on with less work and brainpower. With forEach, I have to keep track of extra state in my brain. I'm trying to make sure the software truly works and avoid errors and bugs. The more state you have to keep track of, the more likely something is to go wrong.

Honestly, I feel this is also the difference between my co-worker and me. I truly want the software to be perfect and at professional level of quality. She just wants the software to "work".

https://www.reddit.com/r/learnprogramming/comments/ajaqai/whats_the_difference_between_a_bad_good_and_great/eeu3vqw/

Expert programmers have lost patience with thinking about every part of the system at all times, and have cultivated techniques to construct the system in such a way that they never have to.

0

u/[deleted] Feb 10 '19

[deleted]

3

u/Yithar Feb 10 '19

I think I see your point, and it's helping me to understand what my co-worker may be feeling as well. Because I have a background in functional programming, map and filter are staple functions that a programmer should know. I honestly feel that any programmer programming in Javascript should know what those functions do.

Basically, map and filter are much more declarative like SQL or CSS while forEach is imperative. In my opinion, the code should get straight to the point about what needs to be done, like a story. forEach gets into the nitty-gritty of how, which is just noise. Like I don't care how exactly the values are mapped into a new array; I don't care about the implementation of the control flow; I just want it done. There may be a variety of ways map is actually implemented under the hood depending on the browser itself.

3

u/WikiTextBot btproof Feb 10 '19

Declarative programming

In computer science, declarative programming is a programming paradigm—a style of building the structure and elements of computer programs—that expresses the logic of a computation without describing its control flow.Many languages that apply this style attempt to minimize or eliminate side effects by describing what the program must accomplish in terms of the problem domain, rather than describe how to accomplish it as a sequence of the programming language primitives (the how being left up to the language's implementation). This is in contrast with imperative programming, which implements algorithms in explicit steps.

Declarative programming often considers programs as theories of a formal logic, and computations as deductions in that logic space. Declarative programming may greatly simplify writing parallel programs.Common declarative languages include those of database query languages (e.g., SQL, XQuery), regular expressions, logic programming, functional programming, and configuration management systems.


[ ^PM | Exclude ^me | Exclude from ^subreddit | FAQ / ^Information | ^Source ] Downvote to remove | v0.28

3

u/Yithar Feb 10 '19

Good bot.

3

u/AlaskanIceWater Feb 09 '19

She has to learn that on her own. But I'm going to a bootcamp now that teaches JS. I started with python though, and it's for sure easier to understand.