The Artima Developer Community
Sponsored Link

Weblogs Forum
Programming with "Duh" Typing

370 replies on 25 pages. Most recent reply: Aug 8, 2007 9:54 AM by James Watson

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 370 replies on 25 pages [ « | 1 ... 18 19 20 21 22 23 24 25 | » ]
Achilleas Margaritis

Posts: 674
Nickname: achilleas
Registered: Feb, 2005

Re: Programming with "Duh" Typing Posted: Jul 31, 2007 6:23 AM
Reply to this message Reply
Advertisement
> I have no doubt that with your level of expertise, you are
> only very rarely a victim of bugs caused by the dynamicity
> of the language you are using. You are most likely very
> thorough in the way you write your tests and you run them
> very diligently at each change.
>
> I maintain that the safety net offered by statically typed
> languages in invaluable for teams of 10, 50, 200
> programmers in projects where literally, tens of thousands
> of lines of code are checked in every day and where
> functional tests take entire days to run.

Even in this case, the usefulness of static type checking is limited. The functional tests have to cover 100% of the requirements as well, just like in smaller projects.

In fact, the bigger the project, the bigger the need for testing.

Achilleas Margaritis

Posts: 674
Nickname: achilleas
Registered: Feb, 2005

Re: Programming with "Duh" Typing Posted: Jul 31, 2007 6:24 AM
Reply to this message Reply
> > > Is that a practical approach across all of software
> > > development or only in particular situations?
> > >
> > > Wouldn't it depend on the risks / losses (including
> > user
> > > opportunity cost) of something going wrong?
> > >
> > > When might it be practical, when might it not?
> > >
> > > Would your opinion be different if you the programmer
> > were
> > > liable for user losses?
>
> Achilleas Margaritis wrote
>
> > Is there such a case out there? most programs contain
> an
> > EULA which relieves the developer from any
> responsibility.
>
> When you answer 4 questions with a question, it seems to
> me that you are far more interested in stating that your
> view is correct than thinking about when it might not be
> correct.

I am asking only because I haven't seen a software license that admits liability. Has anyone seen such a license?

Achilleas Margaritis

Posts: 674
Nickname: achilleas
Registered: Feb, 2005

Re: Programming with "Duh" Typing Posted: Jul 31, 2007 6:30 AM
Reply to this message Reply
> If you've paid attention, the primary arguments, at least
> as posed by myself and James Watson, have been centered
> around how static typing saves time by:
> (1) Catching typos
> (2) Automating Refactoring
> (3) Increasing code clarity

And my replies to those arguments are:

(1) it's irrelevant because type errors in a dynamic system will be caught by the tests

(2) nothing that a good search & replace function can not do

(3) not really, especially in languages where lots of interfaces are involved (so you always see the interface, but not the implementation).

>
> If I mispell a function name in a dynamic language, I have
> to wait until something causes that codepath to be
> executed before I find that error. Yes, eventually it
> will be found. But it can take a long time to do it.

It seems to me that not all people run their code 100% all the time. If that is the case, then certainly, you are correct.

>
> Also, you have to remember that a lot of programming may
> go into a piece of software during system concept
> development before it becomes millions of lines of Ada.
>
> So let's say a systems engineer thinks he has a brilliant
> new nueral network architecture to use to distinguish
> troop transports from school buses. Long term the NN may
> be in software, an FPGA, an ASIC, or even some hybrid
> approach. But for now the engineer wants to figure out if
> it will actually work, so he codes it up in his favorite
> language and sets it to work on training data.
>
> A day and a half later the thing bombs out because in a
> rarely executed branch he typed inptu_vector instead of
> input_vector.
>
> That's not exactly fun...

So you mean the code that bombs out was not tested?

oh, the horror! :-)

Achilleas Margaritis

Posts: 674
Nickname: achilleas
Registered: Feb, 2005

Re: Programming with "Duh" Typing Posted: Jul 31, 2007 6:34 AM
Reply to this message Reply
> You being pretty forgiving by addressing only the point
> that Achilleas wants to argue.
>
> What he keeps avoiding is addressing the other parts of
> our argument. Most of the life of an application will be
> spent in maintenance and I believe that most of the cost
> of an application is in maintenance and enhancements.

Dynamic typing can make maintenance faster: you run the program, you pause it, you modify it, and when the results are satisfactory, you run the tests and if the tests are successful you release the code.

James Watson

Posts: 2024
Nickname: watson
Registered: Sep, 2005

Re: Programming with "Duh" Typing Posted: Jul 31, 2007 6:48 AM
Reply to this message Reply
> I am asking only because I haven't seen a software license
> that admits liability. Has anyone seen such a license?

Noted, but I think it was a hypothetical question.

James Watson

Posts: 2024
Nickname: watson
Registered: Sep, 2005

Re: Programming with "Duh" Typing Posted: Jul 31, 2007 6:50 AM
Reply to this message Reply
> > You being pretty forgiving by addressing only the point
> > that Achilleas wants to argue.
> >
> > What he keeps avoiding is addressing the other parts of
> > our argument. Most of the life of an application will
> be
> > spent in maintenance and I believe that most of the
> cost
> > of an application is in maintenance and enhancements.
>
> Dynamic typing can make maintenance faster: you run the
> program, you pause it, you modify it, and when the results
> are satisfactory, you run the tests and if the tests are
> successful you release the code.

What makes you think that's faster than automation?

James Watson

Posts: 2024
Nickname: watson
Registered: Sep, 2005

Re: Programming with "Duh" Typing Posted: Jul 31, 2007 6:51 AM
Reply to this message Reply
> > A day and a half later the thing bombs out because in a
> > rarely executed branch he typed inptu_vector instead of
> > input_vector.
> >
> > That's not exactly fun...
>
> So you mean the code that bombs out was not tested?
>
> oh, the horror! :-)

He's talking about testing.

Isaac Gouy

Posts: 527
Nickname: igouy
Registered: Jul, 2003

Re: word games Posted: Jul 31, 2007 10:25 AM
Reply to this message Reply
James Watson wrote

> > Where is it commonly understood that 'correct' means
> > "meets all requirements"?
>
> On earth. You should visit sometime.

Why didn't you provide a Google define url for "correct"?

http://www.google.com/search?hl=en&q=define%3A+correct&btnG=Search

How strange! There's no mention of requirements, let alone "meets all requirements".


> The definition of specification that would apply here
> would be: "precise documentation of requirements." I love
> that you accused me of 'quarreling over definitions'.

The definition of specification that would apply here would be a definition of software specification - not some random jumble of general definitions from other fields.


> Do you mean, a software application with no requirements
> is correct? Or more clearly, a software application with
> no requirements cannot be incorrect. ...

I mean your indulging in absurd word games, without any relevance to what we know or don't know about programming.

Petrik de Heus

Posts: 19
Nickname: p8
Registered: Jul, 2007

Re: Programming with "Duh" Typing Posted: Jul 31, 2007 10:30 AM
Reply to this message Reply
> A day and a half later the thing bombs out because in a
> rarely executed branch he typed inptu_vector instead of
> input_vector.
>
> That's not exactly fun...
>
> In a statically typed language the error would have been
> caught. Any decent Java IDE would have underlined it as
> soon as it was typed.

Right, and you'd have an error in Java as well if you actually had a method called inptu_vector and accidently autocompleted the wrong method name.

Petrik de Heus

Posts: 19
Nickname: p8
Registered: Jul, 2007

Re: word games Posted: Jul 31, 2007 10:38 AM
Reply to this message Reply
http://en.wikipedia.org/wiki/Test-driven_development#Requirements

"Test-driven development requires that an automated unit test, defining requirements of the code, is written before each aspect of the code itself."

http://nspec.tigris.org/

"Test Driven Development isn't brilliantly named, it hides the fact that TDD is a specification process, not a testing process. Unit tests are about testing, automated tests are about testing, TDD is about specifying.
BDD and NSpec have shed the test oriented terminology in favour of a specification friendly nomenclature. As an exercise in Neuro Linguistic Programming, it is hoped that this change in language will help frame more specification oriented thoughts."

James Watson

Posts: 2024
Nickname: watson
Registered: Sep, 2005

Re: word games Posted: Jul 31, 2007 12:10 PM
Reply to this message Reply
> There's no mention of requirements, let alone
> "meets all requirements".

It doesn't say anything about specifications either. You proposed that specification was the criteria to judge whether something is correct. I was merely pointing out that there is a common understanding of the relationship between requirements and specification. I merely did this because of your bizarre argument that requirements are not related to correctness. I generally wouldn't need to point out such trivial facts in a sane and rational discussion.

> > The definition of specification that would apply here
> > would be: "precise documentation of requirements." I
> love
> > that you accused me of 'quarreling over definitions'.
>
> The definition of specification that would apply here
> would be a definition of software specification -
> not some random jumble of general definitions from other
> fields.

So do you believe that in software engineering we use normal English words in ways that are incompatible other fields, including engineering?

What definition do you think 'specification' has in our field, exactly? Or alternately what do you think the definition of 'requirements' is in our field? You don't do 'requirements gathering' or have never seen the results of this (generally called 'the requirements')?

It was you that quoted 'specification' as the criteria for correctness.

> > Do you mean, a software application with no
> requirements
> > is correct? Or more clearly, a software application
> with
> > no requirements cannot be incorrect. ...
>
> I mean your indulging in absurd word games, without any
> relevance to what we know or don't know about programming.

You are the one trying to redefine words in order to prove your argument. Trying to make up a new definition for the word 'correct' is an absurd word game.

There is no doubt in my mind that the term requirements is understood to include a formal specification of requirements and a number of assumed requirements such as 'runs without crashing' by anyone who speaks English and has worked for any significant time in the software industry. In any real sense of whether the software is 'correct' would be derived from the required properties and functions of the software (a.k.a 'the requirements') and not based on whether it passes a test.

The concept that passing all tests makes the software correct is patently absurd. If the program crashes are you seriously going to argue that it is 'correct' because it passed all tests? Testing is a way of trying to gauge the correctness. It doesn't define the correctness of software unless you requirements are specified as passing a number of tests which would severely limit the kinds of requirements that could be defined. Testing is equivalent to an experiment, which in scientific terms is a 'test of a hypothesis'. The experiment does not define the hypothesis.

James Watson

Posts: 2024
Nickname: watson
Registered: Sep, 2005

Re: word games Posted: Jul 31, 2007 12:21 PM
Reply to this message Reply
> http://en.wikipedia.org/wiki/Test-driven_development#Requir
> ements
>
> "Test-driven development requires that an automated unit
> test, defining requirements of the code, is written before
> each aspect of the code itself."

It's not feasible to write tests to verify all software application to 100% confidence. In fact for most it's not possible. Turing proved this mathematically a long time ago.

You can pose your requirements as tests, but you are basically limiting what can be included in the requirements.

How would you define the behavior of a web-browser as a series of tests? How about even just a SAX parser? Do you really think it would be easier to understand what is required of a program if all you were given were a set of tests to run?

James Watson

Posts: 2024
Nickname: watson
Registered: Sep, 2005

Re: word games Posted: Jul 31, 2007 12:40 PM
Reply to this message Reply
For reference:

http://en.wikipedia.org/wiki/Requirements_analysis

http://en.wikipedia.org/wiki/Requirement

James Watson

Posts: 2024
Nickname: watson
Registered: Sep, 2005

Re: word games Posted: Jul 31, 2007 12:51 PM
Reply to this message Reply
Plus this, if you have a IEEE membership:

"IEEE recommended practice for software requirements specifications"

http://ieeexplore.ieee.org/Xplore/login.jsp?url=/iel4/5841/15571/00720574.pdf?isnumber=15571&prod=&arnumber=720574&arSt=&ared=&arAuthor=

Petrik de Heus

Posts: 19
Nickname: p8
Registered: Jul, 2007

Re: word games Posted: Jul 31, 2007 1:05 PM
Reply to this message Reply
> How would you define the behavior of a web-browser as a
> series of tests? How about even just a SAX parser? Do
> you really think it would be easier to understand what is
> required of a program if all you were given were a set of
> tests to run?

I'd be a lot more confident to build something close to what is expected if I were given tests instead of a requirements document with the usual ambivalence. There would also be a lot less discussion about correctness and interpretation. Either the tests pass or they fail.

And if it works for jRuby...

"Testing in jruby is based on two seperate unit test suites. The first and foremost is rubicon (http://rubyforge.org/projects/rubytests). This
is the same test suite that ruby uses to verify the interpreter is running correctly. The second is our own unit tests via ant/junit/minirunit. This test suite is mostly for tests that we cannot or do not want to submit to rubicon (a good example is tests involving java integration)"
http://svn.codehaus.org/jruby/tags/jruby-0_9_0/docs/README.test

Flat View: This topic has 370 replies on 25 pages [ « | 18  19  20  21  22  23  24  25 | » ]
Topic: Programming with "Duh" Typing Previous Topic   Next Topic Topic: Python 3000 Plea for Help

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use