Wikipedia:Sandbox
![](http://upload.wikimedia.org/wikipedia/commons/thumb/e/ef/CamelCase.svg/220px-CamelCase.svg.png)
CamelCase (stylizedAs camelCaseOr CamelCase;AlsoKnownAs camelCapsOrMoreFormallyAs medialCapitals)IsThePracticeOfWritingCompoundWordsOrPhrasesSuchThatEachWordOrAbbreviationInTheMiddleOfThePhraseBeginsWithA capitalLetter,WithNoInterveningSpacesOrPunctuation.CommonExamplesInclude "iPhone", "eBay", "FedEx", "DreamWorks",And "HarperCollins".ItIsAlsoSometimesUsedInOnlineUsernamesSuchAs "JohnSmith",AndToMakeMulti-word domainNamesMoreLegible,ForExampleInAdvertisements.
SomeSystemsPreferCamelcaseWithTheFirstLetterCapitalised,OthersNot.[1]<refName=nfrmwk>Template:CiteWeb</ref>[2]ForClarity,ThisArticleCallsTheTwoAlternatives upperCamelCase (initialUpperCaseLetter,AlsoKnownAs PascalCase)And lowerCamelCase (initialLowerCaseLetter).SomePeopleAndOrganizations,Notably Microsoft,<refName=nfrmwk/>UseTheTerm camelCaseOnlyForLowerCamelCase. PascalCaseMeansOnlyUpperCamelCase.
CamelCaseIsDistinctFrom TitleCase,WhichCapitalisesAllWordsButRetainsTheSpacesBetweenThem,AndFrom TallManLettering,WhichUsesCapitalsToEmphasizeTheDifferencesBetweenSimilar-lookingWordsSuchAs "predniSONE"And "predniSOLONE".
TheName "CamelCase"IsNotRelatedToThe "CamelBook",ThePopularNicknameOfTheBook ProgrammingPerlDueToThePictureOfACamelOnItsCover,WhichUsesAll-lowercaseIdentifiersWith underscores (sometimesCalled snakeCase)InItsSampleCode.
VariationsAndSynonyms
TheOriginalNameOfThePractice,UsedIn mediaStudies, grammarsAndThe OxfordEnglishDictionary,Was "medialCapitals".OtherNamesSuchAs "InterCaps"Or "CamelCase"AreRelativelyRecentAndMoreCommonInComputer-relatedCommunities.OtherSynonymsInclude:
|
|
TheEarliestKnownOccurrenceOfTheTerm "InterCaps"OnUsenetIsInAnApril 1990PostToTheGroup alt.folklore.computersByAviRappoport.<refName="compoundNames" />TheEarliestUseOfTheName "CamelCase"OccursIn 1995,InAPostByNewtonLove.[12]LoveHasSinceSaid, "WithTheAdventOfProgrammingLanguagesHavingTheseSortsOfConstructs,TheHumpinessOfTheStyleMadeMeCallItHumpyCaseAtFirst,BeforeISettledOnCamelCase.IHadBeenCallingItCamelCaseForYears. ...TheCitationAboveWasJustTheFirstTimeIHadUsedTheNameOnUSENET."[13]
TraditionalUseInNaturalLanguage
InWordCombinations
TheUseOfMedialCapitalsAsAConventionInTheRegularSpellingOfEverydayTextsIsRare,ButIsUsedInSomeLanguagesAsASolutionToParticularProblemsWhichAriseWhenTwoWordsOrSegmentsAreCombined.
InItalian,PronounsCanBeSuffixedToVerbs,AndBecauseTheHonorificFormOfSecond-personPronounsIsCapitalized,ThisCanProduceASentenceLike nonHoTrovatoIlTempoDiRisponderLe ("IHaven'tFoundTimeToAnswerYou" -Where LeMeans "you").
In German,TheMedialCapitalLetter I,Called Binnen-I,IsSometimesUsedInAWordLike StudentInnen ("students")ToIndicateThatBoth Studenten ("maleStudents")And Studentinnen ("femaleStudents")AreIntendedSimultaneously.However,Mid-wordCapitalisationDoesNotConformTo GermanOrthography;ThePreviousExampleCouldBeCorrectlyWrittenUsing parenthesesAs Student(inn)en,AnalogousTo "congress(wo)man"InEnglish.[14]
In Irish,CamelcaseIsUsedWhenAnInflectionalPrefixIsAttachedToAProperNoun,ForExample iNGaillimh ("in Galway"),From Gaillimh ("Galway"); anTAlbanach ("theScottishPerson"),From Albanach ("ScottishPerson");And goHÉirinn ("to Ireland"),From Éire ("Ireland").InRecent ScotsGaelicOrthography,AHyphenHasBeenInserted: anT-Albannach.
ThisConventionIsAlsoUsedBySeveralWritten BantuLanguages (e.g., kiSwahili, "SwahiliLanguage"; isiZulu, "ZuluLanguage")AndSeveralIndigenous languagesOfMexico (e.g. Nahuatl, Totonacan, Mixe–Zoque,AndSome Oto-MangueanLanguages).
In DutchTheLetter JIsCapitalizedIfItIsImmediatelyPrecededByACapital I,ForExampleInTheCountryname IJsland.
InEnglish,MedialCapitalsAreUsuallyOnlyFoundInScottishOrIrish "Mac-"Or "Mc-"Names,WhereForExample MacDonald,McDonald,And MacdonaldAreCommonSpellingVariantsOfTheSameName,AndInAnglo-Norman "Fitz-"Names,WhereForExampleBoth FitzGeraldAnd FitzgeraldAreFound.
InTheirEnglishStyleGuide TheKing'sEnglish,FirstPublishedIn 1906, H.W.And F.G.FowlerSuggestedThatMedialCapitalsCouldBeUsedInTriple compoundWordsWhere hyphensWouldCauseAmbiguity—theExamplesTheyGiveAre KingMark-like (asAgainst KingMark-like)And Anglo-SouthAmerican (asAgainst Anglo-SouthAmerican).However,TheyDescribedTheSystemAs "tooHopelesslyContraryToUseAtPresent."[15]
InTransliterations
InTheScholarlyTransliterationOfLanguagesWrittenInOtherScripts,MedialCapitalsAreUsedInSimilarSituations.ForExample,InTransliterated Hebrew, ha'<spanStyle="font-family:TimesNewRoman">IvriMeans "theHebrewPerson"Or "theJew"And b'YerushalayimMeans "inJerusalem". In TibetanProperNamesLike rLobsang,The "r"StandsForAPrefixGlyphInTheOriginalScriptThatFunctionsAs toneMarkerRatherThanANormalLetter.AnotherExampleIs ts<spanStyle="font-family:TimesNewRoman">Iurku,ALatinTranscriptionOfThe ChechenTermForTheCappingStoneOfTheCharacteristic MedievalDefensiveTowersOf ChecheniaAnd Ingushetia;TheCapitalLetter "<spanStyle="font-family:TimesNewRoman">I"HereDenotingA phonemeDistinctFromTheOneTranscribedAs "i".
InAbbreviations
MedialCapitalsAreTraditionallyUsedInAbbreviationsToReflectTheCapitalizationThatTheWordsWouldHaveWhenWrittenOutInFull,ForExampleInTheAcademicTitles PhDOr BSc.InGerman,TheNamesOfStatutesAreAbbreviatedUsingEmbeddedCapitals,E.g.StGB (Strafgesetzbuch)ForCriminalCode,PatG (Patentgesetz)ForPatentAct,BVerfG (Bundesverfassungsgericht)For FederalConstitutionalCourt,OrTheVeryCommonGmbH (GesellschaftMitBeschränkterHaftung)For CompanyWithLimitedLiability.InThisContext,ThereCanEvenBeThreeOrMore "CamelCase"Capitals,E.g.InTzBfGForTeilzeit-UndBefristungsgesetz (ActOnPart-TimeAndLimitedTermOccupations).InFrench,CamelCaseAcronymsSuchAs OuLiPo (1960)WereFavoredForATimeAsAlternativesToInitialisms.
CamelCaseIsOftenUsedToTransliterateInitialismsIntoAlphabetsWhereTwoLettersMayBeRequiredToRepresentASingleCharacterOfTheOriginalAlphabet,E.g., DShKFrom Cyrillic ДШК.
HistoryOfModernTechnicalUse
ChemicalFormulae
TheFirstSystematicAndWidespreadUseOfMedialCapitalsForTechnicalPurposesWasTheNotationForChemicalFormulaeInventedByTheSwedishChemist JacobBerzeliusIn 1813.ToReplaceTheMultitudeOfNamingAndSymbolConventionsUsedByChemistsUntilThatTime,HeProposedToIndicateEachChemicalElementByASymbolOfOneOrTwoLetters,TheFirstOneBeingCapitalized.TheCapitalizationAllowedFormulaeLike "NaCl"ToBeWrittenWithoutSpacesAndStillBeParsedWithoutAmbiguity.[16][17]
Berzelius'SystemContinuesToBeUsed,AugmentedWithThree-letterSymbolsSuchAs "Uue"ForUnconfirmedOrUnknownElementsAndAbbreviationsForSomeCommonSubstituents (especiallyInTheFieldOfOrganicChemistry,ForInstance "Et"For "ethyl-").ThisHasBeenFurtherExtendedToDescribeThe aminoAcidSequencesOf proteinsAndOtherSimilarDomains.
EarlyUseInTrademarks
SinceTheEarly 20thCentury,MedialCapitalsHaveOccasionallyBeenUsedFor corporateNamesAndProduct trademarks,SuchAs
- DryIceCorporation (1925)MarketedTheSolidFormOf carbonDioxide (CO₂)As "DryIce",ThusLeadingToItsCommonName.<refName="AboutDryIce">Template:CiteBook</ref>
- CinemaScopeAnd VistaVision,Rival widescreen movieFormats (1953)
- ShopKo (1962)
- MisteRogers,The CanadianVersionOf MisterRogers'Neighborhood (1962)[18]
- AstroTurf (1967)
- ConAgra,FormerlyConsolidatedMills (1971).
- MasterCraft (1968)
ComputerProgramming
![]() | This section possibly contains original research. fewCitationsAndInternetSearchShowsNoOriginalSources,OnlySourcesThatGotItFromWikipedia (May 2011) |
InThe 1970sAnd 1980s,MedialCapitalsWereAdoptedAsAStandardOrAlternative namingConventionForMulti-word identifiersInSeveral programmingLanguages.ThePreciseOriginOfTheConventionInComputerProgrammingHasNotYetBeenSettled.A 1954ConferenceProceedings[19]OccasionallyInformallyReferredToIBM's SpeedcodingSystemAs "SpeedCo". ChristopherStrachey'sPaperOn GPM (1965),[20]ShowsAProgramThatIncludesSomeMedialCapitalIdentifiers,Including "NextCh
"And "WriteSymbol
".
Multiple-wordDescriptiveIdentifiersWithEmbeddedSpacesSuchAs endOfFile
Or charTable
CannotBeUsedInMostProgrammingLanguagesBecauseTheSpacesBetweenTheWordsWouldBe parsedAs delimitersBetween tokens.TheAlternativeOfRunningTheWordsTogetherAsIn endoffile
Or chartable
IsDifficultToUnderstandAndPossiblyMisleading;ForExample, chartable
IsAnEnglishWord (ableToBeCharted).
SomeEarlyProgrammingLanguages,Notably Lisp (1958)And COBOL (1959),AddressedThisProblemByAllowingA hyphen ("-")ToBeUsedBetweenWordsOfCompoundIdentifiers,AsIn "END-OF-FILE":LispBecauseItWorkedWellWithPrefixNotation (aLispParserWouldNotTreatAHyphenInTheMiddleOfASymbolAsASubtractionOperator)AndCOBOLBecauseItsOperatorsWereIndividualEnglishWords.ThisConventionRemainsInUseInTheseLanguages,AndIsAlsoCommonInProgramNamesEnteredOnA commandLine,AsInUnix.
However,ThisSolutionWasNotAdequateForMathematically-orientedLanguagesSuchAs FORTRAN (1955)And ALGOL (1958),WhichUsedTheHyphenAsAnInfixSubtractionOperator.TheseEarlyLanguagesInsteadAllowedIdentifiersToContainUnrestrictedEmbeddedSpaces,DeterminingTheEndOfTheIdentifierByContext.ThisApproachWasAbandonedInLaterLanguagesDueToTheComplexityItAddsTo tokenization. (FORTRANInitiallyRestrictedIdentifiersToNoMoreThanSixCharacters,EffectivelyPreventingMulti-wordIdentifiersExceptThoseMadeOfVeryShortWords,SuchAs "GOTO"="GOTO".)
ExacerbatingTheProblem,Common punchedCardCharacterSetsOfTheTimeWereUppercaseOnlyAndLackedOtherSpecialCharacters.ItWasOnlyInTheLate 1960sThatTheWidespreadAdoptionOfThe ASCIICharacterSetMadeBothLowerCaseAndThe underscoreCharacter _
UniversallyAvailable.SomeLanguages,Notably C,PromptlyAdoptedUnderscoresAsWordSeparators,AndIdentifiersSuchAs end_of_file
AreStillPrevalentInCProgramsAndLibraries (asWellAsInLaterLanguagesInfluencedByC,SuchAs PerlAnd Python).However,SomeLanguagesAndProgrammersChoseToAvoidUnderscores—amongOtherReasonsToPreventConfusingThemWith whitespace—andAdoptedCamelCaseInstead.
CharlesSimonyi,WhoWorkedAt XeroxPARCInThe 1970sAndLaterOversawTheCreationOfMicrosoft'sOfficeSuiteOfApplications,InventedAndTaughtTheUseOf HungarianNotation,OneVersionOfWhichUsesTheLowerCaseLetter(s)AtTheStartOfA (capitalized)VariableNameToDenoteItsType.OneAccount[citation needed]ClaimsThatTheCamelCaseStyleFirstBecamePopularAtXeroxPARCAround 1978,WithThe MesaProgrammingLanguageDevelopedForThe XeroxAltoComputer.ThisMachineLackedAnUnderscoreKey,AndTheHyphenAndSpaceCharactersWereNotPermittedInIdentifiers,LeavingCamelCaseAsTheOnlyViableSchemeForReadableMultiwordNames.ThePARCMesaLanguageManual (1979)IncludedACodingStandardWithSpecificRulesForUpperAndLowerCamelCaseThatWasStrictlyFollowedByTheMesaLibrariesAndTheAltoOperatingSystem.
The SmalltalkLanguage,WhichWasDevelopedOriginallyOnTheAltoAndBecameQuitePopularInTheEarly 1980s,MayTemplate:AccordingToWhomHaveBeenInstrumentalInSpreadingTheStyleOutsidePARC.CamelCaseWasAlsoUsedByConventionForManyNamesInThe PostScriptPageDescriptionLanguage (inventedBy AdobeSystemsFounderAndEx-PARCScientist JohnWarnock),AsWellAsForTheLanguageItself.InAddition, NiklausWirth,TheInventorOf Pascal,CameToAppreciateCamelCaseDuringASabbaticalAtPARCAndUsedItIn Modula,HisNextProgrammingLanguage.
SpreadToMainstreamUsage
WhateverItsOriginsWithinTheComputingWorld,ThePracticeSpreadInThe 1980sAnd 1990s,WhenTheAdventOfThe personalComputerExposedHackerCultureToTheWorld.CamelCaseThenBecameFashionableForCorporate tradeNames,InitiallyInTechnicalFields;MainstreamUsageWasWellEstablishedBy 1990:
- (1962) PolyGram,FormerlyOneOfThe majorLabelsOfThe musicIndustry.
- (1971) AeroVironment
- (1976) InterCity 125
- (1977) CompuServe, UnitedHealthCare (nowUnitedHealthcare).[21]
- (1978) WordStar
- (1979) MasterCard, SportsCenter, VisiCalc
- (1980) EchoStar
- (1982) MicroProse, WordPerfect
- (1983) NetWare
- (1984) BellSouth, LaserJet, MacWorks, iDEN
- (1985) PageMaker, EastEnders
- (1986) SpaceCamp
- (1987) ClarisWorks, HyperCard, PowerPoint
- (1990) HarperCollins, SeaTac,Iconic WorldWideWeb
DuringThe dot-comBubbleOfTheLate 1990s,TheLowercasePrefixes "e" (for "electronic")And "i" (for "Internet",[22] "information", "intelligent",Etc.)BecameQuiteCommon,GivingRiseToNamesLike Apple's iMacAndThe eBoxSoftwarePlatform.
In 1998,DaveYostSuggestedThatChemistsUseMedialCapitalsToAidReadabilityOfLongChemicalNames,E.g.WriteAmidoPhosphoRibosylTransferaseInsteadOf amidophosphoribosyltransferase.[23]ThisUsageWasNotWidelyAdopted.
CamelcaseIsSometimesUsedForAbbreviatedNamesOfCertainNeighborhoods,E.g.NewYorkCityNeighborhoods SoHo (SouthOf HoustonStreet)And TriBeCa (Triangle Below CanalStreet)AndSanFrancisco's SoMa (SouthOf Market).SuchUsagesErodeQuickly,SoTheNeighborhoodsAreNowTypicallyRenderedAs Soho, Tribeca,And Soma.
InternalCapitalizationHasAlsoBeenUsedForOtherTechnicalCodesLike HeLa (1983).
CurrentUsageInComputing
ProgrammingAndCoding
Template:MainArticle TheUseOfMedialCapsForCompoundIdentifiersIsRecommendedByThe codingStyleGuidelinesOfManyOrganizationsOrSoftwareProjects.ForSomeLanguages (suchAs Mesa, Pascal, Modula, JavaAnd Microsoft's .NET)ThisPracticeIsRecommendedByTheLanguageDevelopersOrByAuthoritativeManualsAndHasThereforeBecomePartOfTheLanguage's "culture".
StyleGuidelinesOftenDistinguishBetweenUpperAndLowerCamelCase,TypicallySpecifyingWhichVarietyShouldBeUsedForSpecificKindsOfEntities: variables, recordFields, methods, procedures, types,Etc.TheseRulesAreSometimesSupportedBy staticAnalysisToolsThatCheckSourceCodeForAdherence.
TheOriginal HungarianNotationForProgramming,ForExample,SpecifiesThatALowercaseAbbreviationForThe "usageType" (notDataType)ShouldPrefixAllVariableNames,WithTheRemainderOfTheNameInUpperCamelCase;AsSuchItIsAFormOfLowerCamelCase.
ProgrammingIdentifiersOftenNeedToContain acronymsAndInitialismsThatAreAlreadyInUpperCase,SuchAs "oldHTMLFile".ByAnalogyWithTheTitleCaseRules,TheNaturalCamelCaseRenderingWouldHaveTheAbbreviationAllInUpperCase,Namely "oldHTMLFile".However,ThisApproachIsProblematicWhenTwoAcronymsOccurTogether (e.g., "parseDBMXML"WouldBecome "parseDBMXML")OrWhenTheStandardMandatesLowerCamelCaseButTheNameBeginsWithAnAbbreviation (e.g. "SQLServer"WouldBecome "sQLServer").ForThisReason,SomeProgrammersPreferToTreatAbbreviationsAsIfTheyWereLowerCaseWordsAndWrite "oldHtmlFile", "parseDbmXml"Or "sqlServer".However,ThisCanMakeItHarderToRecogniseThatAGivenWordIsIntendedAsAnAcronym.[24]
WikiLinkMarkup
CamelCaseIsUsedInSome wikiMarkupLanguagesForTermsThatShouldBeAutomaticallyLinkedToOther wikiPages.ThisConventionWasOriginallyUsedIn WardCunningham'sOriginal wikiSoftware, WikiWikiWeb,AndCanBeActivatedInMostOtherWikis.SomeWikiEnginesSuchAs TiddlyWiki, TracAnd PmWikiMakeUseOfItInTheDefaultSettings,ButUsuallyAlsoProvideAConfigurationMechanismOr pluginToDisableIt. WikipediaFormerlyUsedCamelCaseLinkingAsWell,ButSwitchedToExplicitLinkMarkupUsing squareBracketsAndManyOtherWikiSitesHaveDoneTheSame.SomeWikisThatDoNotUseCamelCaseLinkingMayStillUseTheCamelCaseAsANamingConvention,SuchAs AboutUs.
OtherUses
The NIEMRegistryRequiresThat XMLDataElementsUseUpperCamelCaseAndXMLAttributesUseLowerCamelCase.
MostPopular command-lineInterfacesAnd scriptingLanguagesCannotEasilyHandleFileNamesThatContainEmbeddedSpaces (usuallyRequiringTheNameToBePutInQuotes).Therefore,UsersOfThoseSystemsOftenResortToCamelCase (orUnderscores,HyphensAndOther "safe"Characters)ForCompoundFileNamesLike MyJobResume.pdf.
MicrobloggingAnd socialNetworkingSitesThatLimitTheNumberOfCharactersInAMessage (mostFamously Twitter,WhereThe 140-characterLimitCanBeQuiteRestrictiveInLanguagesThatRelyOnAlphabets,IncludingEnglish)ArePotentialOutletsForMedialCapitals.UsingCamelCaseBetweenWordsReducesTheNumberOfSpaces,AndThusTheNumberOfCharacters,InAGivenMessage,AllowingMoreContentToFitIntoTheLimitedSpace. Hashtags,EspeciallyLongOnes,OftenUseCamelCaseToMaintainReadability (e.g. #CollegeStudentProblemsIsEasierToReadThan #collegestudentproblems).
InWebsiteURLs,SpacesAre percent-encodedAs "%20",MakingTheAddressLongerAndLess humanReadable.ByOmittingSpaces,CamelCaseDoesNotHaveThisProblem.
ReadabilityStudies
CamelCaseHasBeenCriticisedAsNegativelyImpactingReadabilityDueToTheRemovalOfSpacesAndUppercasingOfEveryWord.[25]
A 2009StudyComparing snakeCaseToCamelCaseFoundThatCamelCaseIdentifiersCouldBeRecognisedWithHigherAccuracyAmongBothProgrammersAndNon-programmers,AndThatProgrammersAlreadyTrainedInCamelCaseWereAbleToRecogniseThoseIdentifiersFasterThanUnderscoredSnake-caseIdentifiers.[26]
A 2010Follow-upStudy,UnderTheSameConditionsButUsingAnImprovedMeasurementMethodWithUseOfEye-trackingEquipment,Indicates: "WhileResultsIndicateNoDifferenceInAccuracyBetweenTheTwoStyles,SubjectsRecognizeIdentifiersInTheUnderscoreStyleMoreQuickly."[27]
SeeAlso
References
- ^ Template:CiteWeb
- ^ Template:CiteWeb
- ^ [1] Archived 2008-04-11 at the Wayback MachineAt PurdueUniversityCollegeOfTechnology
- ^ Template:CiteWeb
- ^ Template:CiteWeb
- ^ [2],ByNannetteThacker (05/01/1999)
- ^ Template:CiteBook
- ^ Template:CiteWeb
- ^ Template:CiteWeb
- ^ Template:CiteWeb
- ^ Template:CiteWeb
- ^ Template:CiteWeb
- ^ [3]Template:DeadLink
- ^ Template:CiteBook
- ^ Template:CiteBook
- ^ JönsJacobBerzelius (1813). EssayOnTheCauseOfChemicalProportionsAndOnSomeCircumstancesRelatingToThem:TogetherWithAShortAndEasyMethodOfExpressingThem. AnnalsOfPhilosophy 2, 443-454, 3, 51-52; (1814) 93-106, 244-255, 353-364.
- ^ HenryM.Leicester &HerbertS.Klickstein,Eds. 1952, ASourceBookInChemistry, 1400-1900 (Cambridge,MA:Harvard)
- ^ Template:CiteWeb
- ^ Template:CiteWeb
- ^ Template:CiteJournal
- ^ Template:CiteWeb
- ^ Template:CiteNews
- ^ Feedback, 20June 1998Vol 158No 2139 NewScientist 20June 1998
- ^ Template:CiteJournal
- ^ Template:CiteNews
- ^ Template:CiteJournal
- ^ Template:CiteJournal