× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



> From: Steve Richter
> 
> 
> now that is proof that beauty IS in the eye of the beholder!
> 
> in C++ I added an operator[ ] function to the CsvString class.
> 
> std::string sName ;
> CsvString line ;
> sName = line[3] ;  // extract the 4th value in the string.
> 
> I never tried it but you can probably overload operator[ ] in a
> database file class to perform a chain to a file:
>   PayrollMasterByNumber  master ;
>   PayrollRecord record ;
> 
>   master << record ; // add a record to the master file
>   record = master[ EmployeeNumber ] ;  // chain to master file by key

I'm not going to get into a big discussion of the pros and cons of
various languages.  A lot of this discussion wanders away from the
language and into add-on libraries, and that's a completely different
discussion.  If you want to talk about add-on libraries, Python may have
some of the best, and certainly Java beats any of the other languages in
the sheer bulk of free libraries available.

For readability, it is ENTIRELY in the eye of the beholder.  Back in the
day, I know many C++ shops which prohibited overloading operators simply
because it was too easy to cause confusion.  It's bad enough when you're
not sure what the method getCompany() does; it's ten times worse when
you're not sure what + does.  And while overloading the [] operator is
cute, line[3] is intrinsically no more readable than line.getElement(3).

IMHO.


> you can get real wild with all of this and have a const and non const
> version of the operator[ ] member function of the
> PayrollMasterByNumber class. When used on the left side of the
> expression, your code calls the non const version of the function and
> updates the record.  When used on the right side, you call the const
> version and read the record.

Assigning a value to an array element updates the database.  That's
beyond frightening.

IMHO.


In any case, even if you do add those methods, regardless of how you
invoke them (by a method call or an operator) you still have to write
them.  At the end of the day, there are still X lines of code that need
to be written to perform a given programming task.  It is my contention
that for database-driven business logic, there are generally fewer lines
of RPG required than lines in any other language.

Reuse is not an issue.  With procedure calls RPG can be written just as
modularly as any other language.  If you've got the time, you can even
manage some primitive forms of inheritance and overloading.  But for my
problem space (business applications) RPG will require fewer lines of
code to write those modules.

Much farther down this road and it gets religious in nature, and I have
no desire to go there.  Suffice it to say that I like Java for web UI,
and RPG for business logic.  I think C++ is a bastard language, but if
it's all you've got, it makes a decent enough hammer.  (The pointers in
C++ are the problem.  A pointer to a subclass can be converted to a
pointer to the superclass, but a pointer to a pointer of a subclass
cannot be converted to a pointer of a pointer of the superclass.  Please
don't ask why in this list.  You can shoot me a private email if you
want.

Joe


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.