Questions tagged [coding-style]
Questions regarding code style (i.e. topics like indentation, naming, vertical alignment) and how to teach it
17 questions
2
votes
1
answer
62
views
Style guide for short comments?
Sometime in the last few months here on SE I saw a link to a major language style guide that walked through the thought process of refining very short comments in code. I think it took an example ...
1
vote
1
answer
254
views
What's the difference between a Hacker and a Cracker as an Ethics Discussion?
The term hacker didn't originate at MIT rail road club, it's as ancient as press, or mass publications, and the same argument still exists. How do we tie the common definition and word use by ...
1
vote
3
answers
138
views
How to prevent organization/OS students from becoming premature optimizers?
While I'm sure that the comp-sci 101 mistake of having a triple nested loop with two recursive calls is sure to be cured by a decent comp-org class, it can have the unintended side-effect of turning ...
2
votes
2
answers
79
views
Projecting the In- class demo screen
I want to do an in-class demo for students.
I am wondering if there's a way I can project my code editor for students to see, and still have a document with written code (like a cheat sheet) which ...
3
votes
2
answers
91
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
11
answers
4k
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
6
answers
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 ...
24
votes
10
answers
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
5
answers
932
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
4
answers
756
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
4
answers
204
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 ...
11
votes
9
answers
2k
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
3
answers
210
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
11
answers
694
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 ...
12
votes
7
answers
714
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 ...