Cogman
Lifer
Gah, I think I've seen the devil, and he is OpenFOAM! (not to parody ModelWorks thread too much 🙂)
Sorry, you're going to have to live with the numbers, I'm too lazy to remove them.
No comments, This isn't the worst example of bad naming schemes, but they do have pretty bad. And I don't know if you noticed it, but they put #includes in the BODY of the code! Yikes, talk about your maintenance nightmares "Oh, whats in this header, humm, source code?"
Other gems include completely inconsistent standards (Lots of mixing between C/C++), I haven't seen a comment yet beyond the GNU license, And variable names get worse, much worse, like this gem
Yay Open Source, were we can see all your crappy code!
I especially love the definition of the "ForAll" macro. It isn't what you think, I was hoping it would be a threading macro, it isn't. It really does just shorten out the for statement...
Code:
00038 int [URL="http://foam.sourceforge.net/doc/Doxygen/html/postCalc_8C.html#0ddf1224851353fc92bfbff6f499fa97"]main[/URL](int argc, char *argv[])
00039 {
00040
00041 # include "[URL="http://foam.sourceforge.net/doc/Doxygen/html/setRootCase_8H.html"]setRootCase.H[/URL]"
00042
00043 # include "[URL="http://foam.sourceforge.net/doc/Doxygen/html/createTime_8H.html"]createTime.H[/URL]"
00044 # include "[URL="http://foam.sourceforge.net/doc/Doxygen/html/createMesh_8H.html"]createMesh.H[/URL]"
00045 # include "createFields.H"
00046
00047 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00048
00049 [URL="http://foam.sourceforge.net/doc/Doxygen/html/namespaceFoam.html#501e80d1e14c94973e82f1555e7eb711"]Info[/URL]<< "\nCalculating temperature distribution\n" << [URL="http://foam.sourceforge.net/doc/Doxygen/html/namespaceFoam.html#2db8fe02a0d3909e9351bb4275b23ce4"]endl[/URL];
00050
00051 while (runTime.loop())
00052 {
00053 [URL="http://foam.sourceforge.net/doc/Doxygen/html/namespaceFoam.html#501e80d1e14c94973e82f1555e7eb711"]Info[/URL]<< "Time = " << runTime.timeName() << [URL="http://foam.sourceforge.net/doc/Doxygen/html/namespaceFoam.html#e53117a9770efe95d2d01bb5cc2c99ef"]nl[/URL] << endl;
00054
00055 # include "[URL="http://foam.sourceforge.net/doc/Doxygen/html/readSIMPLEControls_8H.html"]readSIMPLEControls.H[/URL]"
00056
00057 for (int nonOrth=0; nonOrth<=[URL="http://foam.sourceforge.net/doc/Doxygen/html/src_2finiteVolume_2cfdTools_2general_2include_2readPIMPLEControls_8H.html#060124ee45213b6f2aa5ef8f167ddfcd"]nNonOrthCorr[/URL]; nonOrth++)
00058 {
00059 [URL="http://foam.sourceforge.net/doc/Doxygen/html/compressible_2sonicFoam_2UEqn_8H.html#93f31b5949948976c8eafb225ca3e504"]solve[/URL]
00060 (
00061 [URL="http://foam.sourceforge.net/doc/Doxygen/html/namespaceFoam_1_1fvc.html#3d0f12fefe9662a52356f0c0aff94efc"]fvm::ddt[/URL]([URL="http://foam.sourceforge.net/doc/Doxygen/html/solvers_2combustion_2coldEngineFoam_2createFields_8H.html#bb80dfe0d55ec4a3a97b2dc1353d66dc"]T[/URL]) - [URL="http://foam.sourceforge.net/doc/Doxygen/html/namespaceFoam_1_1resError.html#4a0c3022439539bbef0dad2906b90d9e"]fvm::laplacian[/URL](DT, [URL="http://foam.sourceforge.net/doc/Doxygen/html/solvers_2combustion_2coldEngineFoam_2createFields_8H.html#bb80dfe0d55ec4a3a97b2dc1353d66dc"]T[/URL])
00062 );
00063 }
00064
00065 # include "write.H"
00066
00067 [URL="http://foam.sourceforge.net/doc/Doxygen/html/namespaceFoam.html#501e80d1e14c94973e82f1555e7eb711"]Info[/URL]<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
00068 << " ClockTime = " << runTime.elapsedClockTime() << " s"
00069 << [URL="http://foam.sourceforge.net/doc/Doxygen/html/namespaceFoam.html#e53117a9770efe95d2d01bb5cc2c99ef"]nl[/URL] << endl;
00070 }
00071
00072 [URL="http://foam.sourceforge.net/doc/Doxygen/html/namespaceFoam.html#501e80d1e14c94973e82f1555e7eb711"]Info[/URL]<< "End\n" << endl;
00073
00074 return 0;
00075 }
No comments, This isn't the worst example of bad naming schemes, but they do have pretty bad. And I don't know if you noticed it, but they put #includes in the BODY of the code! Yikes, talk about your maintenance nightmares "Oh, whats in this header, humm, source code?"
Other gems include completely inconsistent standards (Lots of mixing between C/C++), I haven't seen a comment yet beyond the GNU license, And variable names get worse, much worse, like this gem
Code:
00043 [URL="http://foam.sourceforge.net/doc/Doxygen/html/UList_8H.html#1a02bffef961ee015f0e9b03d336c6a9"]forAll[/URL](TCells, celli)
00044 {
00045 const typename MixtureType::thermoType& mixture_ =
00046 this->cellMixture(celli);
00047
00048 TCells[celli] = mixture_.TH(hCells[celli], TCells[celli]);
00049 psiCells[celli] = mixture_.psi(pCells[celli], TCells[celli]);
00050 rhoCells[celli] = mixture_.rho(pCells[celli], TCells[celli]);
00051
00052 muCells[celli] = mixture_.mu(TCells[celli]);
00053 alphaCells[celli] = mixture_.alpha(TCells[celli]);
00054 }
I especially love the definition of the "ForAll" macro. It isn't what you think, I was hoping it would be a threading macro, it isn't. It really does just shorten out the for statement...
Last edited: