<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://teaching.healthtech.dtu.dk/22113/index.php?action=history&amp;feed=atom&amp;title=Good_code</id>
	<title>Good code - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://teaching.healthtech.dtu.dk/22113/index.php?action=history&amp;feed=atom&amp;title=Good_code"/>
	<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22113/index.php?title=Good_code&amp;action=history"/>
	<updated>2026-04-28T22:56:26Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22113/index.php?title=Good_code&amp;diff=13&amp;oldid=prev</id>
		<title>WikiSysop: Created page with &quot;Evaluating code can be done from a number of criteria. In the course we are using two: Correctness and Quality, each have a number of sub criteria. Any evaluation done by teachers will follow this, and when you evaluate your own or your peers code you should use this.  === Correctness === This is simply to which degree does the solution(s) give the right answer when using the data set supplied with the exercise - &#039;&#039;&#039;or&#039;&#039;&#039; similar natural data sets.&lt;br&gt; &quot;Natural data sets...&quot;</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22113/index.php?title=Good_code&amp;diff=13&amp;oldid=prev"/>
		<updated>2024-03-06T13:22:00Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;Evaluating code can be done from a number of criteria. In the course we are using two: Correctness and Quality, each have a number of sub criteria. Any evaluation done by teachers will follow this, and when you evaluate your own or your peers code you should use this.  === Correctness === This is simply to which degree does the solution(s) give the right answer when using the data set supplied with the exercise - &amp;#039;&amp;#039;&amp;#039;or&amp;#039;&amp;#039;&amp;#039; similar natural data sets.&amp;lt;br&amp;gt; &amp;quot;Natural data sets...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Evaluating code can be done from a number of criteria. In the course we are using two: Correctness and Quality, each have a number of sub criteria. Any evaluation done by teachers will follow this, and when you evaluate your own or your peers code you should use this.&lt;br /&gt;
&lt;br /&gt;
=== Correctness ===&lt;br /&gt;
This is simply to which degree does the solution(s) give the right answer when using the data set supplied with the exercise - &amp;#039;&amp;#039;&amp;#039;or&amp;#039;&amp;#039;&amp;#039; similar natural data sets.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;Natural data sets&amp;quot; in this context are data set, that&lt;br /&gt;
* are NOT specially constructed to catch minor flaws in the programming.&lt;br /&gt;
* do NOT differ significantly from what has been used in exercises.&lt;br /&gt;
* are NOT unlikely to occur in Real Life.&lt;br /&gt;
&lt;br /&gt;
=== Quality ===&lt;br /&gt;
The quality of the code is reflected in a lot of properties.&lt;br /&gt;
* Easy to read&lt;br /&gt;
* Easy to maintain&lt;br /&gt;
* Easy to extend&lt;br /&gt;
* Easy to use&lt;br /&gt;
* Explicit code&lt;br /&gt;
* Comments explaining the code - what is happening. Usually 10-20% of the chars used should be comments. There is such thing as too many comments - when you have more comments than code you are over the limit.&lt;br /&gt;
* Well-chosen placement of comments. They should not disrupt the reading of the code.&lt;br /&gt;
* Well-chosen descriptive names for variables, subroutines, etc.&lt;br /&gt;
* Modular construction of the code&lt;br /&gt;
* No special cases, but general programming&lt;br /&gt;
* Not bloated code - slim and elegant&lt;br /&gt;
* Demonstrating overview of the problem&lt;br /&gt;
* Avoiding using &amp;#039;&amp;#039;break&amp;#039;&amp;#039; and &amp;#039;&amp;#039;sys.exit&amp;#039;&amp;#039; in ways that break the natural flow of the code&lt;br /&gt;
* Catches errors in the input - and explains what the error is&lt;br /&gt;
* Code is optimized and logical&lt;br /&gt;
* Code does not unnecessarily use memory - like slurping files for no good reason&lt;br /&gt;
* Using correct data structures and understanding the basis of the various types&lt;br /&gt;
* Using efficient and clear algorithms&lt;br /&gt;
* Correct use of Python idioms, concepts and constructs&lt;br /&gt;
Many of these properties overlap to a lesser or greater extent. It does not matter. What matters is that they explain in different ways what code quality is.&lt;br /&gt;
The teachers solutions are (mostly) examples of good code. Often various solutions to the same problem are shown and pro&amp;#039;s and con&amp;#039;s of each discussed - read them.&lt;br /&gt;
&lt;br /&gt;
* Online: [https://teaching.healthtech.dtu.dk/material/22113/clean_code.html Clean Code] by Lukasz Dynowski. This resource gives a lot of practical advice on how to make good code.&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
</feed>