Remembering code formatting

Do I need to remember all the coding formatting etc as, there is a lot to remember being a programmer?

HI @teststuffreally !

If you are working with a good code editor with some linting extensions in place like EsLint or Prettier, then your code formatting will be taken care of.

But you should know that basic best practices for formatting.

For example, in HTML, indentation is used so we can see the nested elements better.

Instead of stuff like this

<!--Don't do this-->
  <ul>
  <li>cat nip</li>
  <li>laser pointers</li>
  <li>lasagna</li>
  </ul>

You should use indentation like this

  <ul>
    <li>cat nip</li>
    <li>laser pointers</li>
    <li>lasagna</li>
  </ul>

Same principles go for other languages like css and javascript.
Making sure you are indenting for functions and if/else, etc.

There are other languages, like python, that will throw errors if you don’t indent at all.

1 Like

I am still a beginner so wondering if the answer is the same as I am still learning?

1 Like

Also I don’t remember how and when to use codes?

and what codes to use?

Yes my answer is still the same :slight_smile:

While you are going through the challenges, you can also study the existing code in the editor and you will start to get a sense of how it is formated.
You will also see the proper indentation that I was talking about earlier.

Code formatting basically comes down how readable your code is by other developers.

You are still pretty early on in your journey so this is completely normal feeling.

My suggestion is the work your way through the first certification and build the projects.
Ask for feedback on those projects and implement those changes from the feedback you receive.

The more projects you build the more you will remember in terms of coding.
It is impossible to remember everything but you will start to remember a lot of the basics and become a stronger developer.

It just takes time and practice.

2 Likes

If I get stuck is it cheating to look for the answer and use the answer to help me out by copying the code by typing it out in the way the answer is?

Looking at code teaches you how to read code. It doesn’t really teach you how to write code. Save looking at other people’s solutions to challenge problems until after you have your own working solution.

Now, looking up specific syntax is totally different and totally normal.

1 Like

I’d say you can learn from the solution code if you study it. Not so much as the answer to the challenge but just as code doing something and you figuring out what it does and how it works. Which you can learn a lot from. You get to debug the code and figure out the logic. It is like a reverse puzzle where you reverse engineer the code to learn what it does.

You do however miss out on a very important step which is thinking through a problem and coming up with your own solution. The thought process is what matters here, even if you fail at getting to the solution, the process alone is very educational and teaches you something that is unique to that process.

1 Like

me too please I am still a beginner so wondering if the answer is the same as

1 Like