Re: lies about OOP

2005-01-01 Thread Daniel T.
[EMAIL PROTECTED] wrote:

> A paper finding that OOP can lead to more buggy software is at
> http://www.leshatton.org/IEEE_Soft_98a.html

Sure, OOP *can* lead to more buggy software, that doesn't mean it always 
does.


> Les Hatton "Does OO sync with the way we think?", IEEE Software, 15(3),
> p.46-54
> "This paper argues from real data that OO based systems written in C++
> appear to increase the cost of fixing defects significantly when
> compared with systems written in either C or Pascal. It goes on to
> suggest that at least some aspects of OO, for example inheritance, do
> not fit well with the way we make mistakes."

So, he has data that shows that C++ *appears* to increase the cost of 
fixing defects, then *suggests* that its because C++ is an OO language? 
Sounds like he is ignoring his own data to me...

Mr. Hatton suffers from the same problem that many OO critics suffer. He 
thinks that the language choice decides whether the program written is 
an OO program. I've seen plenty of very non-OO systems written in OO 
languages, I've seen expert OO systems written in non-OO languages. OOP 
isn't a language choice, it is a style of problem solving.

I'm happy to accept that it could take longer to fix bugs in programs 
written in C++ when compared to either C or Pascal, the language itself 
is quite a bit more complicated than either of the latter. 

You know, it tends to take longer to repair a 2004 Mustang than it does 
a 1964 Mustang, does that mean the newer car is not as good?


> If OOP is so beneficial for large projects, why are the Linux kernel,
> the interpreters for Perl and Python, and most compilers I know written
> in C rather than C++?

All three of the systems in question were begun before C++ was 
standardized. Python was also implemented in Java, does that mean OO 
other than C++ is good? Of course not, the fact that the three projects 
in question were implemented in C is not an indictment against OO in any 
way.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: lies about OOP

2005-01-01 Thread Daniel T.
"H. S. Lahman" <[EMAIL PROTECTED]> wrote:

> > Les Hatton "Does OO sync with the way we think?", IEEE Software, 15(3),
> > p.46-54
> > "This paper argues from real data that OO based systems written in C++
> > appear to increase the cost of fixing defects significantly when
> > compared with systems written in either C or Pascal. It goes on to
> > suggest that at least some aspects of OO, for example inheritance, do
> > not fit well with the way we make mistakes."
> 
> Try and find and experienced OO developer who would advocate that large, 
> complex generalizations are a good practice.  You can write lousy 
> programs in any paradigm.  The likelihood increases when you use the 
> most technically deficient of all the OOPLs.  (If those developers had 
> used Smalltalk, I'll bet their defect rates would have been 
> substantially lower even if they weren't very good OO developers.)

Careful, the paper never claims that C++ produced more defects than C or 
Pascal. It only claims that the defects found in the C++ program were 
more costly to fix. That is a very big difference.

However, I agree completely with the rest of your comments.
-- 
http://mail.python.org/mailman/listinfo/python-list


Trouble writing lines into file with line feeds- Python Newb

2013-12-23 Thread daniel . t . healy
Overview: I'm attempting to read strings from a serial port. Each string ends 
with a carriage return and line feed. I want to write those strings to a file, 
like a log file. So, if I send P1 and the P2 on a new line, I would expect to 
open this file and find (line 1) P1 (line 2) P2. 

Problem: The file only contains P2. It always overwrites the first line. I can 
send 20 strings and the file will always contain the last string received.

Code:

#Import the serial module
import serial

#Open the serial port w/ settings
ser=serial.Serial(
port="/dev/ttyUSB0", 
baudrate=9600, 
timeout=None)

#Establish a placeholder for the variable line
line=[]

#Print data received on the serial port after removing the CR and LF characters
while True:
rawcode=ser.readline()
codelog=open('/home/pi/avdms/codes.log','w')
codelog.write(rawcode)
codelog.close()
-- 
https://mail.python.org/mailman/listinfo/python-list