От исходного кода разновидности UNIX веб-браузера Netscape, приблизительно 1997:
/* HP-UX sucks wet farts from dead pigeons' asses */
Такой жемчуг был, к сожалению, удален, прежде чем Moz пошел открытый исходный код...
Это - фактический код, который я когда-то должен был поддерживать. После попытки постигать логику в AstaSaysGooGoo и AstaSaysGaaGaa (где намного больше astaTempVars объявлялось и использовалось) я был готов сдаться. Я наконец искал и видел комментарий "@author", и все это начало, имеет смысл.
/*
* @author Andrew Asta
*/
public class AstaClass{
private String astaVar1;
private String astaVar2;
private String astaVar3;
private String astaVar4;
private String astaVar5;
private String astaVar6;
private String astaVar7;
private String astaVar8;
private String astaVar9;
private String astaVar10;
public void AstaSaysGetData(){
//JDBC statement to populate astavars 1 through 10
//...
String astaSqlStatment = "Select astaCol1, astaCol2, astaCol3... From AstaTable Where...";
//..
//...
}
//Perform data manipulation on astavars...
public void AstaSaysGaaGaa(){
[removed for sake of brevity]
}
//Perform more data manipulation on astavars...
public void AstaSaysGooGoO(){
[removed for sake of brevity]
}
public void AstaSaysPersist(){
//JDBC statement to save astavars to DB
String astaSqlStatment = "Update AstaTable set astaCol1 = @astaVar1
, set astaCol2 = @astaVar2
, set astaCol3 = astaCol3...
Where...";
}
}
пз я изменил фактическое настоящее имя авторов, чтобы избежать меня входящий в любые споры и т.д.
aComment = 'this is not aComment' # this is aComment
class T(object):
def f(this):
this is not aComment
-- Comment this later
, Который был строкой 2 из 4000 + строка МН процедура / процедура SQL. И единственный комментарий. 4 года после той процедуры были разработаны, позже все еще не прибыл...
Был некоторый старый код JavaScript, довольно правильно написанный tho. Тогда была строка комментария
// and there is where the dragon lives
сопровождается функцией, 4 человека провели день для понимания то, что она делает. Наконец мы поняли, что это даже не используется и ничего не делает.
//If you're reading this, then my program is probably a success
не знайте, забавно ли это это или печально.. но у одного интерна, у меня была работа со мной, был этот небольшой драгоценный камень для вычисления цены на единицу
...
// get the units from the form
int numUnits = Integer.parseInt(request.getParameter("num_pieces")); // this break at random times
//price
float price = Float.parseFloat(request.getParameter("price")); // same as above
// Under certain conditions the following code blows up. I don't know those conditions.
float pricePerUnit = price / (float)numUnits;
...
//Woulda
if(x) {}
//Shoulda
else if(y) {}
//Coulda
else {}
// If you delete the credits, I will fucking kill you.
найденный в joomla модуле.
//Visual Studio Bug Workaround:
//http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=101677
//To fix 'CJumpToHelper::GetInstance()' : undeclared identifier compiler errors, change the number lines below
//until the file compiles correctly. (This needs to be done anytime a change is made to this file)
//////////////////////////////////////: There should be 1-10 of these lines
//////////////////////////////////////: There should be 1-10 of these lines
//////////////////////////////////////: There should be 1-10 of these lines
//////////////////////////////////////: There should be 1-10 of these lines
//////////////////////////////////////: There should be 1-10 of these lines
//////////////////////////////////////: There should be 1-10 of these lines
//////////////////////////////////////: There should be 1-10 of these lines
//////////////////////////////////////: There should be 1-10 of these lines
//////////////////////////////////////: There should be 1-10 of these lines
//////////////////////////////////////: There should be 1-10 of these lines
Q: "Каков лучший комментарий в исходном коде, с которым Вы когда-либо встречались?"
А: Легкий - тот, который помог мне решить любую проблему, которую я имел в то время, и существуют многие из тех!
Почти лучший те, которые помогают вести новую разработку от предотвращения известных ловушек.
От Google кодируют проект:
# This job would be great if it wasn't for the fucking customers.
При записи некоторого Perl несколько лет назад, я добавил эти комментарии наверху и нижнюю часть:
# <magic type="voodoo">
...
# </magic>
следующий парень, который посмотрит на него, не был настолько горячим в Perl и потратил некоторое время, ища документацию то, что сделали 'волшебство' и 'вуду'. С тех пор я попытался добавить более полезные комментарии...
Я вижу этого партия :
// TODO make this work
catch (Ex as Exception)
{
// oh crap, we should do something.
}
Ничто как пустой блок выгоды для создания одного чувства, что код устойчив....
/// <summary>
/// The possible outcomes of an update operation (save or delete)
/// </summary>
public enum UpdateResult
{
/// <summary>
/// Updated successfully
/// </summary>
Success = 0,
/// <summary>
/// Updated successfully
/// </summary>
Failed = 1
}
//The following 1056 lines of code in this next method
//is a line by line port from VB.NET to C#.
//I ported this code but did not write the original code.
//It remains to me a mystery as to what
//the business logic is trying to accomplish here other than to serve as
//some sort of a compensation shell game invented by a den of thieves.
//Oh well, everyone wants this stuff to work the same as before.
//I guess the devil you know is better than the devil you don't.
// .==. .==.
// //`^\\ //^`\\
// // ^ ^\(\__/)/^ ^^\\
// //^ ^^ ^/6 6\ ^^ ^ \\
// //^ ^^ ^/( .. )\^ ^ ^ \\
// // ^^ ^/\| v""v |/\^ ^ ^\\
// // ^^/\/ / `~~` \ \/\^ ^\\
// -----------------------------
/// HERE BE DRAGONS
У меня нет доступа к исходному файлу, потому что я там больше не работаю, но это было что-то очень похож на эту картину. Это было наверху файла, который всегда вызывал проблемы, которые мы должны были исправить, но не позволили потратить время, чтобы действительно исправить. (Университетская политика)
when :orientation
## Avoid matching gay people with straight people - they hate it, they do, they really do.
query_parameter = "(users.orientation = 'Bi' OR (users.orientation = 'Straight' AND users.gender IN ('#{user.opposite_genders.join('\',\'')}')) OR (users.orientation = 'Gay' AND users.gender IN ('#{user.same_genders.join('\',\'')}')))"
С сайта знакомств ...
Мой старый босс всегда говорил о том, как мы должны использовать наши собственные продукты для себя, т.е. собачья еда ... »
Много лет спустя я обнаружил, что в каком-то источнике есть информация о временном сотруднике, каждая функция, к которой он прикоснулся, помечена:
/* NOT FIT FOR HUMAN CONSUMPTION */
В строковом выражении GIGANTIC 800, где-то посередине:
// Joe is sorry
Несколько сто строк спустя ...
// Harry is sorry too
Этот комментарий был в блоке, содержащем интерфейсы, которые использовались для привязки связи между основным приложением и различными сторонними драйверами.
//**************************************
// Dear code maintainer:
//
// This source contains COM interfaces, not to be confused with interfaces
// of any other sort, please do not just willy-nilly add additional methods
// to these interfaces as they are truely immutable, unlike the interfaces
// that other software vendors like Microsoft maintain. IF you need to add
// new functionality, then go thru the trouble of creating a NEW interface
// and implement this functionality on only the objects you need.
//
// While the money is good for fixing all of the problems caused by not
// following the rules, I would rather work on things which actually have
// an impact on the future of the product rather than curse and yell
// obsenities at the screen because someone didn't bother to understand the
// true meaning of IMMUTABLE.
//**************************************
Stating the obvious?
/** Logger */
private Logger logger = Logger.getLogger();
Чтобы защитить виновных, значения были изменены
Это было оставлено подрядчиком, который работал над фрагментом кода, отвечающего за тестирование логинов электронной почты. Мы были в неверии, поэтому мы попробовали это, и это был действительный вход в его личный кабинет; мы дважды проверили историю ревизий, и у него было две регистрации, которые отредактировали его: одну, чтобы добавить код, а другую, чтобы закомментировать.
Мы добавили иллюстрацию и оставили остальные; другой разработчик решил, что было бы интересно отправить ему электронное письмо от его будущего «я» (ala The Office), и сказал, что потребовалось почти две полных недели ежедневных электронных писем, прежде чем логин перестал работать.
' ROFL:ROFL:LOL:ROFL:ROFL
' ______/|\____
' L / [] \
' LOL===_ ROFL \_
' L \_______________]
' I I
' /---------------/
'TODO: REMOVE MY INFO AND REPLACE WITH USER CREDENTIALS
'Private TEST_LoginName As String = "DurgshA@Exmaple.org"
'Private TEST_Password As String = "Humsal892"
'Private TEST_Server As String = "imap.secureserver.net"
Моя любимая часть не в том, что он это сделал или что он случайно оставил его на месте для регистрации - но когда он натолкнулся на него, он просто закомментировал его, а не удалил.
Однажды мне пришло в голову то, что я считал элегантным решением особенно сложной проблемы, в ретроспективе это было чем-то вроде умопомрачения и интенсивно использовало макропрограммирование. Спустя годы я нашел этот комментарий от программиста по техническому обслуживанию
/* Description: The Total Perspective Vortex derives its picture of the whole Universe on the principle of extrapolated matter analyses. To explain - since every piece of matter in the Universe is in some way affected by every other piece of matter in the Universe, it is in theory possible to extrapolate the whole of creation - every sun, every planet, their orbits, their composition and their economic and social history from, say, one small Macro. The man who invented the Total Perspective Vortex did so basically in order to annoy the IT department. Steve Weet - for that was his name - was a dreamer, a thinker, a speculative philosopher or, as some would have it, a slacker. And they would nag him incessantly about the utterly inordinate amount of time he spent staring out into space, or mulling over the mechanics of Chelsea FC, or doing spectrographic analyses of macros. "Have some sense of proportion!" they would say, sometimes as often as thirty-eight times in a single day. And so he built the Total Perspective Vortex - just to show them. And into one end he plugged the whole of reality as extrapolated from one macro, and into the other end he plugged the IT department: so that when he turned it on they saw in one instant the whole infinity of creation and theirselves in relation to it. To Steve Weet's horror, the shock completely annihilated ' their brains; but to his satisfaction he realized that he had proved conclusively that if life is going to exist in a Universe of this size, then the one thing it cannot afford to have is a sense of proportion. */