It all started about 8 years ago. I then wrote one program for mathematical calculations, and my teacher indicated that I incorrectly named variables. He was right: x, xx, xxx is difficult to distinguish in code. After renaming, they turned into redSegment, greenSegment, blueSegment (in the context of the task, the naming was appropriate). Then there were Fowler's “Refactoring,” McConnell's “Perfect Code,” a gang of four “Design Patterns” ... every day I sank deeper and deeper into the abyss.foreach (Dot d in dots) { WriteToOutput(dX, dY); } select u.* from Users u select u.UserName, b.Locked, d.PropertyValueStrings from Users u join Bindings b on b.UserId = u.UserId join Dossiers d on d.UserId = u.UserId where u.UserName = 'USERNAME' select bi.BusinessIdentifir, bia.SSAFA, IsNull(bia.Bullshit, 'Bullshit'), bis1.*, bis2.*, bis.* from businessItems bi inner join businessItemsArtifacts bia on ... inner join businessItemsSegment bis1 on ... inner join businessItemsSegment bis2 on ... inner join businessItemsSegment bis3 on ... where bia.Date = @creationDate and bi.Staus = 'RFW' AND ( (bis1.SignIn = 'Europe' and ss2.Limit = 42 and bis3.Connection not in ('Towel', 'Galaxy')) OR (bis1.SignIn = 'USA' and ss3.Limit = 146 and bis2.Connection not in ('Trump', 'Klinton')) OR (bis1.PNH = 'SP' and ss2.Limit = 21 and bis3.Connection not in ('Stan', 'Kyle', 'Cartman')) ) SELECT MFID# as MemberId, TRIM(ACX) as FirstName, TRIM(ABX) as LastName, TRIM(FGS) as Suffix, TRIM(c.DSC) as Country, TRIM(mm.CCC) as CountryCode, FROM {0}.mailfl LEFT OUTER JOIN BDSMTAMDRT.MEMFLT mm ON MFID# = mm.MMID# LEFT OUTER JOIN BDSMTAMDRT.CTRCOD c ON mm.CCC = c.CCTRY WHERE mfid# = ? var posNums = nums.Where(n => n > 0).Select(r => r); IEnumerable<int> squares = Enumerable.Range(1, 10).Select(x => x * x); List<int> evenNumbers = list.FindAll(i => (i % 2) == 0); numbers.Select(n => ...), teams.Select(t => ...) team.Select( p => p.Age > 18); Source: https://habr.com/ru/post/328278/
All Articles