lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

It was thus said that the Great Peter Aronoff once stated:
> Sean Conner <> wrote:
> > I did not feel my question was disingenious or silly, as I *really* did
> > not know why* anyone even bothers with testing frameworks.  While Alexey
> > provided *an* answer (well, four really), they didn't explain to me *why* a
> > framework is needed, as the four items he mentioned could be done without a
> > framework.
> (I don’t know you, so I don’t know if you’re playing with semantics. I’ll
> play along once and assume you’re being serious.)

  I am being serious.  But there may be some subconscience sematics with it

> The word ‘framework’ may be the problem. 

  It is.

  The terms routine, subroutine, procedure, function and method can be used
interchangably, as they all roughly mean the same thing:  a sequence of
computer instructions that can be used one or more times within a program
(or something like that).  But they aren't all the *same*---there are some
subtle distinctions that can be important depending upon the context.  But
since they are very similiar in nature, I let slide loose usage of these.

  The terms framework and library, are, to me, *incredibly different* and
mean totally different things.  A library is a collection of subroutines
(see above) available for use in a program---an individual routine may or
may not be used.  It provides a mechanism to the program.

  A framework, on the other hand, is more akin to a program---that is, it
drives the action and the programmer is expected to *extend* the
functionality of the framework.  It provides a *policy* for code execution,
not *mechanism*.  If your problem fits within the policy the framework
provides, great!  (Ruby on rails is, to me, the modern poster child for
frameworks, but hey, the Windows event loop, web services, etc are also
examples of frameworks)  Your problem is easily solved.  If, however, you
problem exceeds the boundaries of the framework, then there are (or may be)
severe impedience mismatches with what you are trying to do (pounding a
square peg into a round hole).

  Me, I personally like mechanism over policy for the most part.  Yes, I
have created frameworks [1] but there, I *created* the framework to solve
the issues *I* have, not what some other programming *thinks* the issues

  Basically, libraries == mechanisms, frameworks == policies (and usually
rigid ones at that).

> Perhaps you understand it to mean “huge bundle of (potentially buggy)
> code, much of which is useless or mere decoration”. But I suspect many of
> us use ‘framework’ here no differently than ‘module’ or ‘library’. If you
> want to write anything beyond tests with Lua’s built-in assert, you have
> to either use a test module or write your own. This is why I couldn’t
> believe that you really didn’t understand *why* people use test
> frameworks, i.e. test libraries.  They use them for the same reason that
> they use *any* libraries.

  No, I get why people use libraries.  And I get why frameworks can
sometimes be useful.  I just think that most frameworks aren't useful (or
are overkill for certain classes or problems, like testing).

  I have similar feelings towards object oriented programming, but I tend to
be silent on that topic.

> > (like the randomized order case---question: does *any* Lua testing
> > framework provide *that* functionality?) [1].
> I’m not aware of one. I first came across that concept in Ruby’s minitest
> library, though I don’t mean to say that it was invented there. minitest is
> a framework, but relatively minimal. You might even like it despite yourself.

  I'm not a Ruby fan, nor can I follow Ruby code (it's too magical for my
tastes).  Thanks anyway.


[1]	Like the project I wrote at work.  It mainly sits there, convering
	SIP requests to a format an internal component requires to do the
	business logic, and then translates the answer back into a SIP
	message.  But the framework exists for solving other issues like
	that (mainly around handling network traffic using coroutines so the
	other programmers can write straightforward code and avoid having to
	use call backs or promises or other asynchronously executed code).

	Yes, I like imposing policies, but not living under then 8-P