Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
Invariants What does it mean? and how to use em to better your class Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
Class , 26-Apr-04
Category
Algorithm
Language
CBuilder All Versions
Views
458
User Rating
1
# Votes
1
Replies
0
Publisher:
Stubbs, David W
Reference URL:
			
Invariant :  Invariance : Invariant factors : Invariant factoring
Use Application in terms of : Invariant factoring
macro application development The overall construction of an application. 
micro application development the internals of functions. - loops, do whiles 
and case etc.


I learned of a new word the other day. Invariant !  It is a  neat word
if you think about it?  It's just mysterious enough to be complicated
and strong enough to be dangerous if used but sounds good enough
that if used correctly will help make better programs. Since, it was
applied in the sense of  better C++ programming the word and its 
possible  uses should be learned, right ?  

More than right !  Knowing what it means and what it does can be the 
difference between understanding and not understanding the code you
use in an application.   Knowing either and morso both certainly helps
with clearly defined construction of an application.   

What I figured initially of the word is that an Invariant is intended for the 
use of validating the development of a function in relation to its data members 
and vise versa. Well, that's good and after all that is what a class is,  a group 
of data members and functions which serve the data members. So, why not
understand why they are in the class ! Invariant consideration does that.  

The word invariant in terms of the above reference makes it a method also.
It helps to  qualify a class in terms of internal construction. So, Why not 
consider the word to mean a "method of factoring " ? Afterall functions and
data members are factored to a class !  With this said, can the method be
further understood  as  "Invariant factoring".  If so, then why keep its use 
to just functions and data members ? Why not apply the it in terms of the 
overall code writing for the whole application ?  Why not apply it also to the 
internal mechanisms which make up a functions format. It could justify why
one loop may be better than two. 

My conclusion with this paper is that a method can be applied to validate
any aspect of code within an application if the terms of use are useful in 
terms of  the definition.  Instantiation does this and so does polymorphism, 
so can an invariant. 

With this, the developer also has a technical reference for how and why
to do code . A technical reference and a term which is borne out of
functional purpose and can be applied towards the sense of doing code 
correctly. 

Importantly in response to a question from the boss, as to what a 
programmer is doing. A response can be valid with "I am Invariant factoring 
my code" , sir. Rings a bell and keeps a fellow out of hell, code hell too. Ha. 

Conclusion:
The result and purpose then, of code can be better found and established with 
Invariant factoring.


Reference:
Bjarne Stroustrup used and explained this word in terms of good form for 
application development.   The article / Interview found at Artima.Com and is titled
"The C++ Sweet Spot style" Part 1 of a 4 part series on C++ programming.
Bjarne Stroustrup is the Inventor of C++ .  Good reading.


Authors take:
This is my take on the word Invariant and its use with C++ programming. I found
it makes sense and find it works to better code construction beyond the scope of
functions and data members.  

Happy coding

David W. Stubbs





  









			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC