| View previous topic :: View next topic |
| Author |
Message |
Monkeys I post too much
Reputation: 29
Joined: 20 Jul 2006 Posts: 2411
|
Posted: Fri Sep 16, 2011 1:42 pm Post subject: You know what I hate as a coder? |
|
|
People commenting like this:
| Code: | //Print to console:
PrintToConsole("I'm a huge ass faggot");
//Return:
return; |
Or indenting like so:
| Code: | func()
{
if(bool)
{
tar();
dool();
}
} |
When I read code like that, I always charge extra.
_________________
Get a lid on that zombie,
he's never gonna be alri-i-ight.
Oooh get a lid on that zombie,
or he's gonna feed all night. |
|
| Back to top |
|
 |
gogodr I post too much
Reputation: 125
Joined: 19 Dec 2006 Posts: 2041
|
Posted: Fri Sep 16, 2011 1:51 pm Post subject: Re: You know what I hate as a coder? |
|
|
| Monkeys wrote: | People commenting like this:
| Code: | //Print to console:
PrintToConsole("I'm a huge ass faggot");
//Return:
return; |
Or indenting like so:
| Code: | func()
{
if(bool)
{
tar();
dool();
}
} |
When I read code like that, I always charge extra. |
I remember my teacher doings this
| Code: | //Print to console:
PrintToConsole("I'm a huge ass faggot");
//Return:
return; |
and I was like WRYYYYYYYYYYYYYYYY
|
|
| Back to top |
|
 |
Aniblaze Grandmaster Cheater Supreme
Reputation: 138
Joined: 23 Apr 2006 Posts: 1757 Location: The Netherlands
|
Posted: Fri Sep 16, 2011 3:20 pm Post subject: Re: You know what I hate as a coder? |
|
|
| Monkeys wrote: | People commenting like this:
| Code: | //Print to console:
PrintToConsole("I'm a huge ass faggot");
//Return:
return; |
Or indenting like so:
| Code: | func()
{
if(bool)
{
tar();
dool();
}
} |
When I read code like that, I always charge extra. |
The commenting I can understand if you're a teacher who's teaching first year students without a coding background. The indenting is annoying as fuck, but decent IDEs have a refactoring tool which can make the indents as they should be in a second.
EDIT: For example, I recently made this for a friend who's learning to code PHP:
| Code: | <?php
/**
* This is the album class which handles everything pertaining to the generating
* of an album based on the file and folder structure of the 'image' folder,
* which it is set to by default. You can change this default folder to whatever
* you want: I don't even care, smartass. In total there are six variables which
* you can change in the constructor.
*
* If you install this script on a UNIX filesystem, it is important to set the
* fucking rights of the 'image' folder, or whatever you set the default folder
* to, to 775. If you contact me about not having proper rights, my only
* response will most likely be me calling you an idiot while pointing and
* laughing at you. Not really important if the version you're using does not
* have the admin panel implemented yet though.
*
* The file might contain variables or functions not yet (fully) implemented,
* that's because this is a work in progress, thus the project is still in beta.
* The official release date is scheduled around whenever I feel like it.
*
* @author Stefan van Beusekom
* @since September 9th, 2011
* @version 0.0.1
*/
class Album {
private $rootFolder;
private $urlPath;
private $systemPath;
private $username;
private $password;
private $resultsPerPage;
private $directoryHandle;
private $fileExtensions;
public $albumName;
/**
* Constructor of the class. Handles basic actions for all other functions,
* as well as variables which can be changed to suit your own taste.
*
* @author Stefan van Beusekom
* @since September 9th, 2011
*/
public function __construct($urlGET) {
// Variables which can be changed to suit your taste.
(string) $this->albumName = "Demo album";
(string) $this->username = "demo";
(string) $this->password = "demo";
(int) $this->resultsPerPage = 20;
(Array) $this->fileExtensions = array('jpg', 'png', 'gif');
(string) $this->rootFolder = "image";
// Variables that take care of themselves. Best not to touch these.
(string) $this->urlPath = ($urlGET['path'] == "") ? $this->rootFolder . "/" : $urlGET['path'] . "/";
(string) $this->systemPath = realpath($this->urlPath) . "/";
(Array) $this->directoryHandle = scandir($this->systemPath);
}
/**
* Returns an array of all directories in the directory currently being
* viewed. This does not include parent or current directories.
*
* @author Stefan van Beusekom
* @since September 10th, 2011
* @return array
*/
public function getDirectories() {
// Sets an empty array to contain directory URL's used as categories in
$returnDirArray = array();
// Loop through all items in the current directory
foreach ($this->directoryHandle as $key => $value) {
// Set the web path
$tempDir = $this->systemPath . $value;
// Check if the item is a directory, and not a reference
if (is_dir($tempDir) && substr($value, 0, 1) != ".") {
// Push the item onto the array
array_push($returnDirArray, ($this->urlPath . $value));
}
}
// Return the directory array
return $returnDirArray;
}
/**
* Returns an array of all images in the directory currently being viewed.
* This does not include images from parent or child directories.
*
* @author Stefan van Beusekom
* @since September 10th, 2011
* @return array
*/
public function getImages() {
// Sets an empty array to contain images URL's in
$returnImgArray = array();
// Loop through all items in the current directory
foreach ($this->directoryHandle as $key => $value) {
// Set the web path
$tempFile = $this->systemPath . $value;
// Check if the item is a file, and not a directory or reference
if (is_file($tempFile)) {
// Retrieve pathinfo
$fileExt = pathinfo($tempFile);
// Extract the file extension, and make the result lowercase to
// ensure comparison is done correctly.
$fileExt = strtolower($fileExt['extension']);
// Check if the extracted extension is in the array with allowed
// file extensions.
if (in_array($fileExt, $this->fileExtensions)) {
// Push the item onto the array
array_push($returnImgArray, ($this->urlPath . $value));
}
}
}
// Return the image array
return $returnImgArray;
}
/**
* Destructor of the class. Will remove resources which should/are not being
* used anymore.
*
* @author Stefan van Beusekom
* @since September 9th, 2011
*/
public function __destruct() {
unset($this->directoryHandle);
}
}
?> |
|
|
| Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Fri Sep 16, 2011 3:39 pm Post subject: |
|
|
| that's not that bad. sort of similar to javadocs. take a look at openjdk
|
|
| Back to top |
|
 |
Aniblaze Grandmaster Cheater Supreme
Reputation: 138
Joined: 23 Apr 2006 Posts: 1757 Location: The Netherlands
|
Posted: Fri Sep 16, 2011 3:43 pm Post subject: |
|
|
| Slugsnack wrote: | | that's not that bad. sort of similar to javadocs. take a look at openjdk |
But that's still Java right? I'm using http://phpdoc.org/ to create something similar to javadocs, but for PHP.
|
|
| Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Fri Sep 16, 2011 3:49 pm Post subject: |
|
|
| what do you mean it's still java ?
|
|
| Back to top |
|
 |
Aniblaze Grandmaster Cheater Supreme
Reputation: 138
Joined: 23 Apr 2006 Posts: 1757 Location: The Netherlands
|
Posted: Fri Sep 16, 2011 3:50 pm Post subject: |
|
|
| Slugsnack wrote: | | what do you mean it's still java ? |
Well the dude I talked about is trying to learn PHP.
|
|
| Back to top |
|
 |
Josheh Expert Cheater
Reputation: 1
Joined: 28 Aug 2011 Posts: 155
|
Posted: Fri Sep 16, 2011 3:51 pm Post subject: Re: You know what I hate as a coder? |
|
|
| Monkeys wrote: | People commenting like this:
| Code: | //Print to console:
PrintToConsole("I'm a huge ass faggot");
//Return:
return; |
Or indenting like so:
| Code: | func()
{
if(bool)
{
tar();
dool();
}
} |
When I read code like that, I always charge extra. |
The commenting doesn't bother me so much but the spacing does -- it's difficult to read.
|
|
| Back to top |
|
 |
Aviar³ Grandmaster Cheater
Reputation: 50
Joined: 03 Jan 2008 Posts: 655 Location: Canada
|
Posted: Fri Sep 16, 2011 3:59 pm Post subject: |
|
|
You code professionally?
P.S.: That looks fine to me, unless you mean the fact that the person used a string literal and that the second source both lacks function parameter and return type decleration, as well as using the bool reserved word in the if statement. hue hue hue
_________________
This is the inception of deception, checking the depth of your perception.
 |
|
| Back to top |
|
 |
Cryoma Member of the Year
Reputation: 198
Joined: 14 Jan 2009 Posts: 1819
|
Posted: Fri Sep 16, 2011 4:22 pm Post subject: |
|
|
| I don't comment anything lol, if someone else wants to use my code they will just have to know what it means.
|
|
| Back to top |
|
 |
Aniblaze Grandmaster Cheater Supreme
Reputation: 138
Joined: 23 Apr 2006 Posts: 1757 Location: The Netherlands
|
Posted: Fri Sep 16, 2011 4:23 pm Post subject: |
|
|
| Cryoma wrote: | | I don't comment anything lol, if someone else wants to use my code they will just have to know what it means. |
I had a colleague like that. He doesn't work at our company anymore.
|
|
| Back to top |
|
 |
booingthetroll Expert Cheater
Reputation: 0
Joined: 30 Aug 2011 Posts: 114 Location: ::1
|
Posted: Fri Sep 16, 2011 4:26 pm Post subject: |
|
|
It's like mirroring the code previously
//print "\n"
print "\n"
|
|
| Back to top |
|
 |
Cryoma Member of the Year
Reputation: 198
Joined: 14 Jan 2009 Posts: 1819
|
Posted: Fri Sep 16, 2011 4:47 pm Post subject: |
|
|
| Augustine wrote: | | Cryoma wrote: | | I don't comment anything lol, if someone else wants to use my code they will just have to know what it means. |
I had a colleague like that. He doesn't work at our company anymore. |
Well I don't work for anyone so I don't really give a fuck, it's not like commenting is hard if I had to.
|
|
| Back to top |
|
 |
Aviar³ Grandmaster Cheater
Reputation: 50
Joined: 03 Jan 2008 Posts: 655 Location: Canada
|
Posted: Fri Sep 16, 2011 4:49 pm Post subject: |
|
|
| Cryoma wrote: | | Augustine wrote: | | Cryoma wrote: | | I don't comment anything lol, if someone else wants to use my code they will just have to know what it means. |
I had a colleague like that. He doesn't work at our company anymore. |
Well I don't work for anyone so I don't really give a fuck, it's not like commenting is hard if I had to. |
You would be surprised. Its easy to do too much or too little. Either way, somethings better than nothing.
_________________
This is the inception of deception, checking the depth of your perception.
 |
|
| Back to top |
|
 |
Aniblaze Grandmaster Cheater Supreme
Reputation: 138
Joined: 23 Apr 2006 Posts: 1757 Location: The Netherlands
|
Posted: Fri Sep 16, 2011 4:52 pm Post subject: |
|
|
| Aviar³ wrote: | | Cryoma wrote: | | Augustine wrote: | | Cryoma wrote: | | I don't comment anything lol, if someone else wants to use my code they will just have to know what it means. |
I had a colleague like that. He doesn't work at our company anymore. |
Well I don't work for anyone so I don't really give a fuck, it's not like commenting is hard if I had to. |
You would be surprised. Its easy to do too much or too little. Either way, somethings better than nothing. |
At least the 'doc' part is good to do. Just a short description and the important '@' definitions. Generating proper documentation has never been easier.
|
|
| Back to top |
|
 |
|