Click here to Skip to main content
15,893,594 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: Do you Program in Paragraphs or Sentances? Pin
kalberts1-Jun-18 8:07
kalberts1-Jun-18 8:07 
GeneralRe: Do you Program in Paragraphs or Sentances? Pin
kalberts1-Jun-18 2:42
kalberts1-Jun-18 2:42 
GeneralRe: Do you Program in Paragraphs or Sentences? Pin
Bruce Patin1-Jun-18 4:11
Bruce Patin1-Jun-18 4:11 
GeneralRe: Do you Program in Paragraphs or Sentences? Pin
RandyBuchholz1-Jun-18 4:14
RandyBuchholz1-Jun-18 4:14 
GeneralRe: Do you Program in Paragraphs or Sentences? Pin
Bruce Patin1-Jun-18 4:43
Bruce Patin1-Jun-18 4:43 
GeneralRe: Do you Program in Paragraphs or Sentences? Pin
MSBassSinger1-Jun-18 4:39
professionalMSBassSinger1-Jun-18 4:39 
GeneralRe: Do you Program in Paragraphs or Sentences? Pin
RandyBuchholz1-Jun-18 6:18
RandyBuchholz1-Jun-18 6:18 
GeneralRe: Do you Program in Paragraphs or Sentences? Pin
kalberts1-Jun-18 8:39
kalberts1-Jun-18 8:39 
In my first university level programming course (I had been fiddeling a little around before that), the professor provided one guideline that I still think is great: A program should fit in a single page. Usually, it will be more than half a page, but never more than that. ("One page" was understood to be 60 code lines.)

You can't solve the program in 60 lines of Pascal, you say? OK, so make up another programming language in which you can solve the problem in 60 lines. Say, if an essential part of your solution is to sort a table of records backwards on the surname field, according to Swedish alphabetic sorting, then pretend that you have a language in which "sorting a table backwards on the surname field according to Swedish sorting rules" is a language primitive. When you have made a clean, readable solution in this hypothetical language, you go ahead to make another program by the same basic rules: One for doing that sorting...

I think this is a very good philosophical approach to code modularization: Make yourself a language that lets you solve the problem in 30-60 lines. Less than 30 lines provides so little detail that it is useless (like "void main(void) {solvetheproblem();}"). Make sure that the way the problem is solved is visible in the code! But don't bring in too many details; requiring more than 60 distinct operations (aka. code lines) indicates that you did not use the right language for the task. So make yourself a better suited language.

Obviously, these are main rules, not absolute. Some problems require less than 30 lines, and in any production setting you cannot expect library functions to suit your problem ideally, adding red tape. But as a way of thinking, it is a great approach: Every level of your code should add a significant, but not an excessive amount of detail. And, relate that stepwise detailing to the problem at hand, not to the libraries you use, language or other coding elements.

Even today I think this lesson, in my very first year of study to become a programmer, is one of the most valuable ones I has throughout my studies.
GeneralRe: Do you Program in Paragraphs or Sentences? Pin
Kirk 103898211-Jun-18 5:14
Kirk 103898211-Jun-18 5:14 
GeneralRe: Do you Program in Paragraphs or Sentences? Pin
Gerry Schmitz1-Jun-18 6:03
mveGerry Schmitz1-Jun-18 6:03 
GeneralRe: Do you Program in Paragraphs or Sentences? Pin
RandyBuchholz1-Jun-18 6:27
RandyBuchholz1-Jun-18 6:27 
GeneralRe: Do you Program in Paragraphs or Sentences? Pin
Gerry Schmitz1-Jun-18 6:38
mveGerry Schmitz1-Jun-18 6:38 
GeneralRe: Do you Program in Paragraphs or Sentences? Pin
RandyBuchholz1-Jun-18 7:08
RandyBuchholz1-Jun-18 7:08 
GeneralRe: Do you Program in Paragraphs or Sentences? Pin
Gerry Schmitz1-Jun-18 7:44
mveGerry Schmitz1-Jun-18 7:44 
GeneralRe: Do you Program in Paragraphs or Sentences? Pin
kalberts1-Jun-18 8:52
kalberts1-Jun-18 8:52 
GeneralRe: Do you Program in Paragraphs or Sentences? Pin
Vivi Chellappa2-Jun-18 4:21
professionalVivi Chellappa2-Jun-18 4:21 
GeneralThought of the Day Pin
OriginalGriff31-May-18 4:56
mveOriginalGriff31-May-18 4:56 
GeneralRe: Thought of the Day Pin
lopatir31-May-18 5:00
lopatir31-May-18 5:00 
GeneralRe: Thought of the Day Pin
OriginalGriff31-May-18 5:07
mveOriginalGriff31-May-18 5:07 
GeneralRe: Thought of the Day Pin
Johnny J.31-May-18 5:23
professionalJohnny J.31-May-18 5:23 
GeneralRe: Thought of the Day Pin
Richard Deeming31-May-18 5:31
mveRichard Deeming31-May-18 5:31 
GeneralRe: Thought of the Day Pin
jeron131-May-18 6:05
jeron131-May-18 6:05 
GeneralRe: Thought of the Day Pin
Eric Lynch31-May-18 7:26
Eric Lynch31-May-18 7:26 
GeneralRe: Thought of the Day Pin
Mike Hankey31-May-18 7:26
mveMike Hankey31-May-18 7:26 
GeneralRe: Thought of the Day Pin
W Balboos, GHB31-May-18 7:31
W Balboos, GHB31-May-18 7:31 

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.