Click here to Skip to main content
15,902,938 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Mmmm - it' s nice to know that they care about me... Pin
OriginalGriff31-May-18 8:00
mveOriginalGriff31-May-18 8:00 
GeneralRe: Mmmm - it' s nice to know that they care about me... Pin
Eddy Vluggen31-May-18 8:16
professionalEddy Vluggen31-May-18 8:16 
GeneralRe: Mmmm - it' s nice to know that they care about me... Pin
OriginalGriff31-May-18 8:22
mveOriginalGriff31-May-18 8:22 
GeneralRe: Mmmm - it' s nice to know that they care about me... Pin
Eddy Vluggen31-May-18 8:38
professionalEddy Vluggen31-May-18 8:38 
GeneralRe: Mmmm - it' s nice to know that they care about me... Pin
Daniel Pfeffer31-May-18 9:30
professionalDaniel Pfeffer31-May-18 9:30 
GeneralRe: Mmmm - it' s nice to know that they care about me... Pin
OriginalGriff31-May-18 9:51
mveOriginalGriff31-May-18 9:51 
GeneralRe: Mmmm - it' s nice to know that they care about me... Pin
Michael Martin31-May-18 11:20
professionalMichael Martin31-May-18 11:20 
GeneralDo you Program in Paragraphs or Sentences? Pin
RandyBuchholz31-May-18 5:57
RandyBuchholz31-May-18 5:57 
This was inspired by Marc Clifton's post Dumbing down code so it can be maintained by junior devs

I'm a horizontal programmer. I write chainable methods with (short) descriptive names. The top of my methods usually consists of a few "sentences" composed of these "words". If I can put my code on one line, (braces, etc.) I usually do.
Eg, simple method:
// Not me
string Foo(int x)
{
  if(x == 1)
    { 
       return "one";
    }
    else
    {
       return "not one";
    }
  }
}

// sometimes me
string Foo(int x){
  if (x == 1) {
    return "one";
  } else {
    return "not one";
  }
}

// usually me
string Foo(int x) => (x == 1) ? "one" : "not one";

// often me
string Foo(this int x) => (x == 1) ? "one" : "not one";

I do things like this. (Not really this weird though Smile | :) ).
public static List<TSource> WhenNotEmpty<TSource>(this List<TSource> item) => (item.Count > 0) ? item : null;
public static string Prepare(this string item, out string prepared) => ((prepared = item + "Appended") == "HelloAppended") ? "ok" : null ;
public static void Manipulate(this string item, string stuff) => Debug.WriteLine($"{item}:{stuff}");

So I can write in sentences
var list = new List<string> {"a", "Hello", "c"};

list.WhenNotEmpty()?.ForEach(s => s.Prepare(out var r)?.Manipulate(r));

Instead of paragraphs. (something like (methods would be a little different))
var list = new List<string> {"a", "Hello", "c"};
if(list.count > 0){
  foreach(var i in list){
    var (condition, temp) = Prepare(i);
    if(condition != null){
       Manipulate(temp);
    }
  }
}
Getting to the point, (finally Sleepy | :zzz: )

The paragraphs approach is clearer at the micro level (the details are clear), but the sentences is clearer at the macro level (the overall intent is clear).
Of course you can wrap this paragraph in a method. But when you don't:

Do you tend to write more at the macro/sentence level or micro/paragraph level?

modified 1-Jun-18 8:58am.

GeneralRe: Do you Program in Paragraphs or Sentances? Pin
lopatir31-May-18 6:14
lopatir31-May-18 6:14 
GeneralRe: Do you Program in Paragraphs or Sentances? Pin
S Houghtelin1-Jun-18 1:13
professionalS Houghtelin1-Jun-18 1:13 
GeneralRe: Do you Program in Paragraphs or Sentances? Pin
Maximilien31-May-18 6:33
Maximilien31-May-18 6:33 
GeneralRe: Do you Program in Paragraphs or Sentances? Pin
RandyBuchholz31-May-18 6:46
RandyBuchholz31-May-18 6:46 
GeneralRe: Do you Program in Paragraphs or Sentances? PinPopular
Slacker00731-May-18 7:04
professionalSlacker00731-May-18 7:04 
GeneralRe: Do you Program in Paragraphs or Sentances? Pin
RandyBuchholz31-May-18 8:08
RandyBuchholz31-May-18 8:08 
GeneralRe: Do you Program in Paragraphs or Sentances? Pin
Mycroft Holmes31-May-18 13:35
professionalMycroft Holmes31-May-18 13:35 
GeneralRe: Do you Program in Paragraphs or Sentances? Pin
PIEBALDconsult31-May-18 7:08
mvePIEBALDconsult31-May-18 7:08 
GeneralRe: Do you Program in Paragraphs or Sentances? Pin
Eric Lynch31-May-18 7:22
Eric Lynch31-May-18 7:22 
GeneralRe: Do you Program in Paragraphs or Sentances? Pin
RandyBuchholz31-May-18 7:48
RandyBuchholz31-May-18 7:48 
GeneralRe: Do you Program in Paragraphs or Sentances? Pin
Slacker00731-May-18 9:27
professionalSlacker00731-May-18 9:27 
GeneralRe: Do you Program in Paragraphs or Sentances? PinPopular
dbrenth31-May-18 7:31
dbrenth31-May-18 7:31 
GeneralRe: Do you Program in Paragraphs or Sentances? Pin
Marc Clifton31-May-18 9:05
mvaMarc Clifton31-May-18 9:05 
JokeThat's not the question Pin
CodeWraith31-May-18 7:40
CodeWraith31-May-18 7:40 
GeneralRe: Do you Program in Paragraphs or Sentances? Pin
W Balboos, GHB31-May-18 7:40
W Balboos, GHB31-May-18 7:40 
GeneralRe: Do you Program in Paragraphs or Sentances? Pin
Scott Serl31-May-18 7:43
Scott Serl31-May-18 7:43 
GeneralRe: Do you Program in Paragraphs or Sentances? Pin
RandyBuchholz31-May-18 7:55
RandyBuchholz31-May-18 7:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.