ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Screenshot Captor

Scripting to be added to Screenshot Captor

<< < (3/6) > >>

mouser:
I'm not quite sure what you mean by "big oop programs" versus scripts. Do you mean "big C++ programs", where the meaning of the code is more explicit, at the expense of being larger (not to mention about a squillion times faster)?
--- End quote ---

yes i meant oop as in object oriented programming.

my philsophy of programming is that verbosity is good.  i find that some people are really drawn to languages like perl where you can write one line that does a lot.  i prefer having a longer function and bigger infrastructure that feels to me more organized.

>Are you likely to add scripting to any of your other apps?

yep, that's part of the calculus involved; even thought sc will have only minimal scripting, ill be using it more in other more substantial roles in other projects, so i have to take that into consideration yet.

NeilS:
yes i meant oop as in object oriented programming.

my philsophy of programming is that verbosity is good.  i find that some people are really drawn to languages like perl where you can write one line that does a lot.  i prefer having a longer function and bigger infrastructure that feels to me more organized.
-mouser (August 10, 2006, 09:17 PM)
--- End quote ---

I think what confused me was that it seemed as if you were implying that scripts weren't OOP programs, but you were actually talking about the verbosity of the code you would normally write in a language like C++ versus the average scripting language.

The idea that verbose code is more organised is an interesting notion. Say you have a sequence of code that you tend to write a lot in C++, but the same thing can be expressed in one line or one operator in, say, Ruby. Do you think that having to repeat those code sequences in C++ in lots of places is more organised than having a construct which does the same thing without the repetition? (I'm not saying that's wrong, btw, although I suspect it means that we have different definitions of "more organised").

>Are you likely to add scripting to any of your other apps?

yep, that's part of the calculus involved; even thought sc will have only minimal scripting, ill be using it more in other more substantial roles in other projects, so i have to take that into consideration yet.

--- End quote ---

Hehe, you read my mind. :)

f0dder:
Say you have a sequence of code that you tend to write a lot in C++, but the same thing can be expressed in one line or one operator in, say, Ruby. Do you think that having to repeat those code sequences in C++ in lots of places is more organised than having a construct which does the same thing without the repetition?
-NeilS
--- End quote ---

You wouldn't repeat those code sequences, though, you would factor them out to a function or similar. You might then argue that nothing has been won, but au contraire; it's easy to follow into a function call (visual studio or similar IDEs, or CTAGS based stuff), where you can then read the proper and verbose code.

Compare that to some of the atrocious one-liners you can do in perl ;)

NeilS:
You wouldn't repeat those code sequences, though, you would factor them out to a function or similar. You might then argue that nothing has been won, but au contraire; it's easy to follow into a function call (visual studio or similar IDEs, or CTAGS based stuff), where you can then read the proper and verbose code.
-f0dder (August 11, 2006, 06:53 AM)
--- End quote ---

Not all code sequences can be converted into functions easily though, certainly not in a language like C++. The classic example is using a for loop with iterators into a container, e.g:


--- ---for(AList::iterator it = list.begin(); it != list.end(); ++it)
{
  // Do something with 'it'
}

That's a pretty common code sequence in a lot of C++ programs. There are various ways to implement it so that the for loop is more concise (e.g. functors). But functors just add more code somewhere else and you still have the problem of not having access to any of the local variables in the function where the for loop resides.

Contrast that with the Ruby equivalent:


--- ---list.each do |it|
  // Do something with 'it'
end

There's no reasonable way to achieve something this concise and readable in C++ by factoring out into functions.

In case you're wondering, I'm not trying to make some sort of language advocacy point here. I'm just trying to understand Mouser's philosophy about preferring verbosity, and what he actually means by that.

Compare that to some of the atrocious one-liners you can do in perl ;)

--- End quote ---

Don't get me wrong, I'm in complete agreement that atrocious one-liners are, well... atrocious. But just because you can write such lines in languages like Perl and Ruby, that doesn't mean you have to. In fact, the Ruby community is trying to encourage people to stop using the various "Perlisms" available in Ruby because Ruby is plenty concise and very readable without them.

Besides, you can write pretty atrocious one-liners in C++ using macros or templates.

Eóin:

--- ---for(AList::iterator it = list.begin(); it != list.end(); ++it)
{
  // Do something with 'it'
}

That's a pretty common code sequence in a lot of C++ programs. There are various ways to implement it so that the for loop is more concise (e.g. functors).
-NeilS (August 11, 2006, 08:22 AM)
--- End quote ---

Sorry mouser for dragging this so far of topic, but NeilS another option for C++ code is Boost.FOR_EACH :) .

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version