Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [coding-style]

Questions regarding code style (i.e. topics like indentation, naming, vertical alignment) and how to teach it

1
vote
2answers
37 views

Advise on a class project

Me and my friend are both in high school taking a “PLTW” Engineering class, where our goal is to design a solution to any problem and work on that solution over the course of the year. We’re reaching ...
13
votes
11answers
3k views

What should be included in a best practices C course?

At our University, we have in the first semester a very difficult C Introductory Course, that consists of presenting a shortened version of the language specification: What are for/while loops, if ...
13
votes
6answers
2k views

Attempting to prevent learning of poor techniques when self-teaching

A big problem of learning alone is that you don't always figure out the preferred style for a language, the most "pythonic" (in the case of Python) way to do it, or how to write code in keeping with ...
23
votes
10answers
4k views

Should teachers enforce standardization of spacing and braces?

On open source projects and industry teams, there are often detailed style guides about how many spaces should be used for indents, line continuation, etc., and whether braces should go on their own ...
7
votes
5answers
377 views

How to teach to write optimized code

While reviewing someone's code I found many problems, such as writing lots of loops instead of a single loop. For example let's take the case of basic square matrix multiplication. Both matrices ...
8
votes
4answers
305 views

The importance of writing understandable code [duplicate]

Many students do not see the purpose of following conventions (indentation, naming, comments, etc.) which make the code much easier to read and review. Students can learn to follow conventions, but ...
7
votes
4answers
132 views

Teaching identifier naming conventions

Currently the only thing I'm teaching for the naming of identifiers is "be consistent". Then I go ahead and use the Hungarian notation consistently, and show them a few other conventions. Is there a ...
12
votes
9answers
1k views

How to teach students not to use jump statements

We all know goto is the spawn of satan. To learners though, it seems easy and quick. In simple, short program codes having a goto or two won't turn the code into unreadable spaghetti code. So students ...
5
votes
3answers
174 views

Suggestions for encouraging good Coding Practices?

From an instructor perspective (Middle School or High School), Is there a method, or a set of guidelines, for grading early coders' projects that could enhance good coding practices as the students ...
14
votes
11answers
583 views

How can I show the value of best practices?

As someone who likes to advocate for best practices like correct use of VCS, indentation, sufficient commenting, and testing, I try and integrate them when I teach. But for all of these things, my ...
11
votes
7answers
453 views

How can I discourage poor design while using automatic grading of submissions?

Automatic grading is great for saving time on marking programming tasks, so there's more time to focus on actual teaching, but I've noticed a few flaws. Since work is essentially marked based on ...
29
votes
13answers
2k views

How to teach why indentation is important

I'm trying to teach why indentation is important, but the student doesn't indent. I asked why he doesn't indent, then he answered "That's because it’s a hassle." It's OK to say "you should indent", ...
13
votes
3answers
620 views

Do automatic style hints help students to understand the language they're learning?

Do automatic style hints (like those provided by linters) significantly increase the student's understanding of the language they're learning? I am asking because I assist in a course that uses a ...