Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Understanding Terminology 3

Status
Not open for further replies.

1DMF

Programmer
Jan 18, 2005
8,795
GB
I'm trying to grasp some key terminology I keep coming across, I may use PERL and have become proficient in what I need to get out of it, but some terminology I have trouble understanding as I'm self taught (along with your help of course) and have not needed to know what it meant to write a PERL script or use JavaScript / CSS / HTML / VBA etc....

PERL -> is this purely the interpreter / compiler and you have a set amount of commands / keywords you can use withing its command set. so is the LANGUAGE!

Framework -> All the modules provided with PERL to enable you to acheive tasks without having to write all the code yourself. Including (STRICT, CGI, WIN32::ODBC) etc...

if so what are the modules I write? I have written a SQL module to enable easy access to my DB, does that module now form part of my PERL framework, or is it purley part of my 'application' ?

Class -> what makes a class a class and not an object, I come across things called classes , yet I see them as objects. i.e. (XMLHttpRequest) don't you use this 'method' to initiate an AJAX request and then to get your result you have to access the data 'object'.

Method -> are these functions which are part of the 'object' which I can call upon to perform processes upon the 'object'

ie. $cgi = new CGI; creates a new CGI object.

my %vars = $cgi->Vars; ['Vars' is a method]

my $var = $cgi->param('varname'); ['param' is a method]

-----------------------------------------------------
All help understanding these concepts really is appreciated, I've googled, I've wikipedia, but I end up being blinded with science and so hoped the PERL community could explain these concepts using a language I now have a grasp of so might make more sense.

Many thanks 1DMF.



"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
Firstly, the most important terminology of being a Perl hacker: Perl is not, strictly speaking, an acronym, so it's not typed as PERL. The language is "Perl" and the intepreter is "perl" (though that can of course be capitalised at the start of sentences).

I can't really come up with a decent explanation of a framework, to be honest, so I'll leave that up to someone else.

Your last couple of questions are to do with Object-Oriented Programming. An object is an instance of a class. Put simply, a class tells you the type of object you're dealing with. In the code you've posted, your $cgi variable is an object of the class CGI. To use a typical example from OOP teaching material, you might write a Person class, which reflects the fact that a Person has a name, height, weight, etc. You might then create a number of Person objects: $ishnid, $1DMF, $KevinADC, $PaulTEG, $Kirsle. Each of those variables relates to a different object, but they're all of the class Person.

You're exactly right about methods: they're functions that operate on objects to either do something to the object or to get information about the object.

I hope I haven't just confused you even more with that.
 
You can think of a framework as a set of scaffolding on which you build your application. Spring is big in the java world, and Ruby on Rails is a classic example of a framework.

In perl, calling a module a framework might be overstating it a bit. It's more like a useful bit of code or functionality prepackaged (sometimes as objects) for easy use. Although some of the modules, notably CGI, are big enough to qualify.

Steve

[small]"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object::perlDesignPatterns)[/small]
 
so a class is an object definition, is that like saying a Schema in XML ?

So the actual module is a class, but instigating the class creates you and object of that class!

man am I stupid or is this complicated?

Ishnid: I thought PERL stood for Practical Exctraction Reporting Language, is that not the same as perl ?



"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 

The whole OOP terminology thing is difficult to get initially. Don't worry: it's not just you.

Not all Perl modules are related to object oriented programming. For example, it would be incorrect to describe File::Basename as a "class", since it's just a collection of functions.

"Practical Extraction and Reporting Language" is a backronym (i.e. it was invented to turn Perl into an acronym after it was named Perl). There's also "Pathologically Eclectic Rubbish Lister", which is also a backronym.
 
so a "require" to another perl file containing a bunch of functions is not a class, it is only a class if it relates to an object. ok.

but i'm still lost as to what makes something a framework rather thasn just a bunch of functions and code libraries used within an application.

Where does the threshold of library/bunch of code turn into a framework?



"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
I'm not sure there is a definite line. I'd call a framework something that has all the basic functionality written, and has a specific structure of an application to utilize it. Sorry, that's a terrible definition. I consider it a question of how many independent, unrelated tools are packaged together for a larger purpose.

I wouldn't consider CGI by itself to be a framework, but I'd certainly call CGI::Application one (if used properly). From there, it calls CGI, DBI, HTML::Template, and CGI::Session all as parts of the CGI::Application object. And the structure of a CGI::Application, breaking up into runmodes, keeps different CGI::Applications behaving similarly. The code for widely different apps can look very much the same, which helps unify the framework.

But, that's just my opinion. Microsoft calls their pile of .NET classes a framework, but that's a little broader than my CGI::Application example.

- Andrew
Text::Highlight - A language-neutral syntax highlighting module in Perl
also on SourceForge including demo
 
thanks andrew - everyones input has really helped, I've even cracked OO design in the JavaScript forum.

thanks to everyones input

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top