LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 11-19-2009, 01:33 PM   #46
johnsfine
Senior Member
 
Registered: Dec 2007
Distribution: Mepis, Centos
Posts: 4,012

Rep: Reputation: 731Reputation: 731Reputation: 731Reputation: 731Reputation: 731Reputation: 731Reputation: 731

Quote:
Originally Posted by ghostdog74 View Post
Yes, bad indentation IS a big deal, if you are the one reading and maintaining code written by others
Fixing bad code written by others is practically my profession. It certainly is a large fraction of my job.

I don't recall bad indenting ever getting near membership in the top twenty flaws I must battle in code written by others.

For contrast, consider this flaw common to all the large Python projects I've had the misfortune to try to correct:

1) Certain member names are duplicated across almost every object type in the project, so text based searching for those names finds everything, which is the equivalent of finding nothing.

2) Every important object type has member contributions scattered all over a giant project. No object type has any place where its purpose or contents are documented or encapsulated.

Clearly (2) is more the fault of the few specific programmers responsible, rather than entirely the fault of the language. (1) isn't even necessarily bad. In many C++ projects with decent support tools, it isn't a problem at all. But the combination of (1) and (2) ends up being deadly in Python, while in C++, (2) is impossible and (1) isn't very harmful.

Before I ever saw a Python program, one of the things I thought was a flaw in most object oriented languages, including C++, is the excess emphasis on encapsulation:

C++ makes you entirely define an object when you define it. That object definition must declare everything that goes into that object (either directly or by pulling in previously defined sub objects). Member functions etc., might be defined later, but they all must be declared in the object definition.

On occasion, that is a very painful restriction and leads to much uglier code than would be required if the encapsulation rules were a bit less severe.

Back then, I foolishly thought that professional programmers tend to be professional, so they would encapsulate when they should even if the language makes it easy to not encapsulate.

Now I understand they won't. Python makes it too easy to not encapsulate. C++ makes it too hard, which isn't great either. But looking at the results from ordinary professional programmers in both languages, I'm convinced that most programmers most of the time will mess up big project structure more in a language that makes not encapsulating too easy.
 
Old 11-19-2009, 02:39 PM   #47
Garry | K | E
LQ Newbie
 
Registered: Nov 2009
Location: location, location.
Distribution: Ubuntu, Back Track 4
Posts: 15

Original Poster
Rep: Reputation: 1
Before a mod sees this thread and locks it, I'd like to point out I only wanted a little bit of advice as to which I should pick. Not to start a flame war
 
Old 11-19-2009, 03:04 PM   #48
Komakino
Senior Member
 
Registered: Feb 2004
Location: Somerset, England
Distribution: Slackware 10.2, Slackware 10.0, Ubuntu 9.10
Posts: 1,938

Rep: Reputation: 52
Quote:
Originally Posted by Garry | K | E View Post
Before a mod sees this thread and locks it, I'd like to point out I only wanted a little bit of advice as to which I should pick. Not to start a flame war
I don't really think you have. Other than one idiot who maintains you have to know C to be a programmer everyone else was just contributing their thoughts on the different languages. I think most people have made good points even when their opinion on your choice of language differs from mine.
 
Old 11-19-2009, 03:23 PM   #49
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: back to Arch
Posts: 16,689

Rep: Reputation: 427Reputation: 427Reputation: 427Reputation: 427Reputation: 427
Quote:
Originally Posted by Garry | K | E View Post
Before a mod sees this thread and locks it, I'd like to point out I only wanted a little bit of advice as to which I should pick. Not to start a flame war
I don't think anyone suggested that you started a flame war....

Here's a little truism about fora such as LQ: Sometimes you get less than you asked for, and sometimes more.....

PS: I'm a mod, I've seen it, not closing it ......yet.

Last edited by pixellany; 11-19-2009 at 03:27 PM.
 
Old 11-19-2009, 03:27 PM   #50
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: back to Arch
Posts: 16,689

Rep: Reputation: 427Reputation: 427Reputation: 427Reputation: 427Reputation: 427
Quote:
Originally Posted by Komakino View Post
I don't really think you have. Other than one idiot who maintains you have to know C to be a programmer.....
careful---I think you meant to say:
"A purist with possible evangelical tendencies"
 
Old 11-19-2009, 03:33 PM   #51
Komakino
Senior Member
 
Registered: Feb 2004
Location: Somerset, England
Distribution: Slackware 10.2, Slackware 10.0, Ubuntu 9.10
Posts: 1,938

Rep: Reputation: 52
Quote:
Originally Posted by pixellany View Post
careful---I think you meant to say:
"A purist with possible evangelical tendencies"
You're right...my fingers slipped
 
Old 11-19-2009, 03:51 PM   #52
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,123

Rep: Reputation: 407Reputation: 407Reputation: 407Reputation: 407Reputation: 407
Quote:
Originally Posted by johnsfine View Post
Fixing bad code written by others is practically my profession. It certainly is a large fraction of my job.

I don't recall bad indenting ever getting near membership in the top twenty flaws I must battle in code written by others.

For contrast, consider this flaw common to all the large Python projects I've had the misfortune to try to correct:

1) Certain member names are duplicated across almost every object type in the project, so text based searching for those names finds everything, which is the equivalent of finding nothing.

2) Every important object type has member contributions scattered all over a giant project. No object type has any place where its purpose or contents are documented or encapsulated.

Clearly (2) is more the fault of the few specific programmers responsible, rather than entirely the fault of the language. (1) isn't even necessarily bad. In many C++ projects with decent support tools, it isn't a problem at all. But the combination of (1) and (2) ends up being deadly in Python, while in C++, (2) is impossible and (1) isn't very harmful.

Before I ever saw a Python program, one of the things I thought was a flaw in most object oriented languages, including C++, is the excess emphasis on encapsulation:

C++ makes you entirely define an object when you define it. That object definition must declare everything that goes into that object (either directly or by pulling in previously defined sub objects). Member functions etc., might be defined later, but they all must be declared in the object definition.

On occasion, that is a very painful restriction and leads to much uglier code than would be required if the encapsulation rules were a bit less severe.

Back then, I foolishly thought that professional programmers tend to be professional, so they would encapsulate when they should even if the language makes it easy to not encapsulate.

Now I understand they won't. Python makes it too easy to not encapsulate. C++ makes it too hard, which isn't great either. But looking at the results from ordinary professional programmers in both languages, I'm convinced that most programmers most of the time will mess up big project structure more in a language that makes not encapsulating too easy.
Oh, I too had to understand/fix/discard code written by others.

And in a sense bad formatting in such code may be a blessing. This is because I intentionally reformat files in such cases manually, at the same time doing in my head initial code analysis and understanding basic things about the code. And after that the code is formatted the "perfect" way - because it is my way.

...

C++ <-> Python - of course, Perl is in the middle . And there is more than one OO model which can be used with Perl. And with functional approach/anonymity encapsulation is the way of living in Perl, i.e. by default things belong to scope.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Perl vs. Ruby vs. Python vargadanis Programming 53 12-31-2010 12:37 PM
Perl or Ruby or Python? Or something else? MasterOfTheWind Programming 18 05-07-2009 12:43 PM
Lisp, Ruby, or python nesrail Programming 20 01-27-2009 02:49 AM
Python, Java, or Ruby? Doctorzongo Programming 9 03-31-2008 11:14 PM


All times are GMT -5. The time now is 02:55 PM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration