Brilliant? or not?

View: New views
20 Messages — Rating Filter:   Alert me  
< Prev | 1 - 2 | Next >

Brilliant? or not?

by WJhonson :: Rate this Message:

| View Threaded | Show Only this Message


SMAX = (S1 > S2) * S1 + (S2 >= S1) * S2

?


_______________________________________________
U2-Users mailing list
U2-Users@...
http://listserver.u2ug.org/mailman/listinfo/u2-users

Re: Brilliant? or not?

by Rex Gozar-2 :: Rate this Message:

| View Threaded | Show Only this Message

SMAX = MAXIMUM(S1:@FM:S2)

seems clearer...
_______________________________________________
U2-Users mailing list
U2-Users@...
http://listserver.u2ug.org/mailman/listinfo/u2-users

Re: Brilliant? or not?

by WJhonson :: Rate this Message:

| View Threaded | Show Only this Message


Ah one of those new fangled functions that have been around for 12 years.....




-----Original Message-----
From: Rex Gozar <rgozar@...>
To: U2 Users List <u2-users@...>
Sent: Fri, Jan 13, 2012 9:44 am
Subject: Re: [U2] Brilliant? or not?


SMAX = MAXIMUM(S1:@FM:S2)
seems clearer...
______________________________________________
2-Users mailing list
2-Users@...
ttp://listserver.u2ug.org/mailman/listinfo/u2-users

_______________________________________________
U2-Users mailing list
U2-Users@...
http://listserver.u2ug.org/mailman/listinfo/u2-users

Re: Brilliant? or not?

by Mecki Foerthmann :: Rate this Message:

| View Threaded | Show Only this Message

What's wrong with IF S1 > S2 THEN SMAX = S1 ELSE SMAX = S2?
Definitely more readable!

If it was hard to write then it should be hard to read, I guess.

On 13/01/2012 17:41, Wjhonson wrote:
> SMAX = (S1>  S2) * S1 + (S2>= S1) * S2
>
> ?
>
>
> _______________________________________________
> U2-Users mailing list
> U2-Users@...
> http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
U2-Users@...
http://listserver.u2ug.org/mailman/listinfo/u2-users

Re: Brilliant? or not?

by Bill Haskett :: Rate this Message:

| View Threaded | Show Only this Message

Darn...that's too simple!   In addition, for a geek, there are too many
characters.  :-)

Bill

------------------------------------------------------------------------
----- Original Message -----
*From:* meckif@...
*To:* u2-users@...
*Date:* 1/13/2012 9:52 AM
*Subject:* Re: [U2] Brilliant? or not?
> What's wrong with IF S1 > S2 THEN SMAX = S1 ELSE SMAX = S2?
> Definitely more readable!
>
> If it was hard to write then it should be hard to read, I guess.
>
> On 13/01/2012 17:41, Wjhonson wrote:
>> SMAX = (S1>  S2) * S1 + (S2>= S1) * S2
>>
>> ?
_______________________________________________
U2-Users mailing list
U2-Users@...
http://listserver.u2ug.org/mailman/listinfo/u2-users

Re: Brilliant? or not?

by John Solie :: Rate this Message:

| View Threaded | Show Only this Message

Clever, but if it isn't commented, very difficult to maintain.  Either way it might cause me to go hunting for Mr. Clever with my Nerf Bat.


John Solie * Systems Analyst, Information Systems * www.phsyes.com
Professional Hospital Supply * 42500 Winchester Road, Temecula, CA 92590
Tel. 951-296-2600 ext. 1226      Fax 951-296-2625   jsolie@...

Leading the Market through Innovative Solutions

IMPORTANT: The sender intends that this electronic message is for exclusive use by the person to whom it is addressed.  This message may contain information that is confidential or privileged and exempt from disclosure under applicable law.  If the reader of this message is not an intended recipient, be aware that any disclosure, dissemination, distribution or copying of this communication, or the use of its contents, is prohibited without prior written consent from PHS.

Please consider the environment before printing this email.

-----Original Message-----
From: u2-users-bounces@... [mailto:u2-users-bounces@...] On Behalf Of Wjhonson
Sent: Friday, January 13, 2012 9:42 AM
To: u2-users@...
Subject: [U2] Brilliant? or not?


SMAX = (S1 > S2) * S1 + (S2 >= S1) * S2

?


_______________________________________________
U2-Users mailing list
U2-Users@...
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
U2-Users@...
http://listserver.u2ug.org/mailman/listinfo/u2-users

Re: Brilliant? or not?

by George Gallen-2 :: Rate this Message:

| View Threaded | Show Only this Message

Along the same lines.....

MSG = "SUCCESS"[1,9999*(X = 4)]

Instead of:

IF X=4 THEN MSG="SUCCESS" ELSE MSG=""

George

-----Original Message-----
From: u2-users-bounces@... [mailto:u2-users-bounces@...] On Behalf Of Wjhonson
Sent: Friday, January 13, 2012 12:42 PM
To: u2-users@...
Subject: [U2] Brilliant? or not?


SMAX = (S1 > S2) * S1 + (S2 >= S1) * S2

?


_______________________________________________
U2-Users mailing list
U2-Users@...
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
U2-Users@...
http://listserver.u2ug.org/mailman/listinfo/u2-users

Re: Brilliant? or not?

by Bill Brutzman-2 :: Rate this Message:

| View Threaded | Show Only this Message

>From the perspective of writing scenario-proof code...I live in a world of case statements...

        Begin case
                              Case s1 > s2  ;  sMax = s1  
               Case 1              ;  sMax = s2
        End    case

--Bill

-----Original Message-----
From: u2-users-bounces@... [mailto:u2-users-bounces@...] On Behalf Of Mecki Foerthmann
Sent: Friday, January 13, 2012 12:52 PM
To: u2-users@...
Subject: Re: [U2] Brilliant? or not?

What's wrong with IF S1 > S2 THEN SMAX = S1 ELSE SMAX = S2?
Definitely more readable!

If it was hard to write then it should be hard to read, I guess.

On 13/01/2012 17:41, Wjhonson wrote:
> SMAX = (S1>  S2) * S1 + (S2>= S1) * S2
>
> ?
>
>
> _______________________________________________
> U2-Users mailing list
> U2-Users@...
> http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
U2-Users@...
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
U2-Users@...
http://listserver.u2ug.org/mailman/listinfo/u2-users

Re: Brilliant? or not?

by David A. Green :: Rate this Message:

| View Threaded | Show Only this Message

Are you trying to emulate C?

SMAX = (S1 > S2) ? S1 : S2;

David A. Green
(480) 813-1725
DAG Consulting

-----Original Message-----
From: u2-users-bounces@...
[mailto:u2-users-bounces@...] On Behalf Of Wjhonson
Sent: Friday, January 13, 2012 10:42 AM
To: u2-users@...
Subject: [U2] Brilliant? or not?


SMAX = (S1 > S2) * S1 + (S2 >= S1) * S2

?


_______________________________________________
U2-Users mailing list
U2-Users@...
http://listserver.u2ug.org/mailman/listinfo/u2-users

_______________________________________________
U2-Users mailing list
U2-Users@...
http://listserver.u2ug.org/mailman/listinfo/u2-users

Parent Message unknown Re: Brilliant? or not?

by u2ug-3 :: Rate this Message:

| View Threaded | Show Only this Message

You can get pretty close :  SMAX = IF S1 > S2  THEN S1 ELSE S2

-----Original Message-----
From: u2-users-bounces@...
[mailto:u2-users-bounces@...] On Behalf Of David A.
Green
Sent: Friday, January 13, 2012 3:32 PM
To: 'U2 Users List'
Subject: Re: [U2] Brilliant? or not?

Are you trying to emulate C?

SMAX = (S1 > S2) ? S1 : S2;

David A. Green
(480) 813-1725
DAG Consulting

-----Original Message-----
From: u2-users-bounces@...
[mailto:u2-users-bounces@...] On Behalf Of Wjhonson
Sent: Friday, January 13, 2012 10:42 AM
To: u2-users@...
Subject: [U2] Brilliant? or not?


SMAX = (S1 > S2) * S1 + (S2 >= S1) * S2

?


_______________________________________________
U2-Users mailing list
U2-Users@...
http://listserver.u2ug.org/mailman/listinfo/u2-users

_______________________________________________
U2-Users mailing list
U2-Users@...
http://listserver.u2ug.org/mailman/listinfo/u2-users


_______________________________________________
U2-Users mailing list
U2-Users@...
http://listserver.u2ug.org/mailman/listinfo/u2-users

Re: Brilliant? or not?

by Allen E. Elwood :: Rate this Message:

| View Threaded | Show Only this Message

violates the kiss principle....

certainly a candidate for the rube goldberg programmer of the year, or as
they say in france "usine à gaz"

http://en.wikipedia.org/wiki/Rube_Goldberg_machine 

-----Original Message-----
From: u2-users-bounces@...
[mailto:u2-users-bounces@...] On Behalf Of Wjhonson
Sent: Friday, January 13, 2012 9:42 AM
To: u2-users@...
Subject: [U2] Brilliant? or not?


SMAX = (S1 > S2) * S1 + (S2 >= S1) * S2

?


_______________________________________________
U2-Users mailing list
U2-Users@...
http://listserver.u2ug.org/mailman/listinfo/u2-users

_______________________________________________
U2-Users mailing list
U2-Users@...
http://listserver.u2ug.org/mailman/listinfo/u2-users

Re: Brilliant? or not?

by Ross Ferris :: Rate this Message:

| View Threaded | Show Only this Message

NOT!

Ross Ferris
Stamina Software
Visage > Better by Design!

-----Original Message-----
From: u2-users-bounces@... [mailto:u2-users-bounces@...] On Behalf Of Wjhonson
Sent: Saturday, 14 January 2012 4:42 AM
To: u2-users@...
Subject: [U2] Brilliant? or not?


SMAX = (S1 > S2) * S1 + (S2 >= S1) * S2

?


_______________________________________________
U2-Users mailing list
U2-Users@...
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
U2-Users@...
http://listserver.u2ug.org/mailman/listinfo/u2-users

Re: Brilliant? or not?

by Doug Farmer-2 :: Rate this Message:

| View Threaded | Show Only this Message

I used to have a "C" programmer working for me that reveled in
condensing multiple lines of "C" code to a single statement, much more
obtuse than that.

He is no longer employed here.

Nuff said

Doug

-----Original Message-----
From: u2-users-bounces@...
[mailto:u2-users-bounces@...] On Behalf Of Wjhonson
Sent: Friday, January 13, 2012 10:42 AM
To: u2-users@...
Subject: [U2] Brilliant? or not?


SMAX = (S1 > S2) * S1 + (S2 >= S1) * S2

?
--------------------------------------------------------

This e-mail is for the use of the intended recipient(s) only. If you have received this e-mail in error, please notify the sender immediately and then delete it. If you are not the intended recipient, you must not use, disclose or distribute this e-mail without the author's prior permission. We have taken precautions to minimize the risk of transmitting software viruses, but we advise you to carry out your own virus checks on any attachment to this message. We cannot accept liability for any loss or damage caused by software viruses. Any views and/or opinions expressed in this e-mail are of the author only and do not represent the views of Epicor Software Corporation or any other company within its group.


This message has been scanned for malware by Websense. www.websense.com
_______________________________________________
U2-Users mailing list
U2-Users@...
http://listserver.u2ug.org/mailman/listinfo/u2-users

Re: Brilliant? or not?

by Charles_Shaffer :: Rate this Message:

| View Threaded | Show Only this Message

>>> I used to have a "C" programmer working for me that reveled in
>>> condensing multiple lines of "C" code to a single statement, much more
>>> obtuse than that.

>>> He is no longer employed here.

>>> Nuff said

>>> Doug
*************
Aside from it not being readable, compacting C code like that can reduce
portability.  Different compilers may evaluate complex, compacted code
differently.  Don't ask me how I know that.
 
Charles Shaffer
Senior Analyst
NTN-Bower Corporation
_______________________________________________
U2-Users mailing list
U2-Users@...
http://listserver.u2ug.org/mailman/listinfo/u2-users

Re: Brilliant? or not?

by Tony Gravagno-3 :: Rate this Message:

| View Threaded | Show Only this Message

> From: Charles_Shaffer
> Aside from it not being readable, compacting C code
> like that can reduce portability.  Different compilers
> may evaluate complex, compacted code differently.

Same thing has actually happened with BASIC code that's ported
from one platform to another.

Rule of thumb: Don't get cute. Spell out the code so that any
dumb compiler or programmer can read it.

On-topic: that makes my response to this thread, "not".

One of our colleagues from the mid 80's wrote code that was so
clean I liked to say we could eat off of it.  I think he still
reads this forum: So to Mark Vander Veen, here we are over 20
years later and I Still appreciate your code.  Now THAT is
Brilliant.

T

_______________________________________________
U2-Users mailing list
U2-Users@...
http://listserver.u2ug.org/mailman/listinfo/u2-users

Re: Brilliant? or not?

by George Gallen-2 :: Rate this Message:

| View Threaded | Show Only this Message

This is one of the reasons why I continue to x=x+1 instead of x++

Not all languages support the ++, but they all support x=x+1

George

-----Original Message-----
From: u2-users-bounces@... [mailto:u2-users-bounces@...] On Behalf Of Tony Gravagno
Sent: Monday, January 16, 2012 1:50 PM
To: u2-users@...
Subject: Re: [U2] Brilliant? or not?

> From: Charles_Shaffer
> Aside from it not being readable, compacting C code
> like that can reduce portability.  Different compilers
> may evaluate complex, compacted code differently.

Same thing has actually happened with BASIC code that's ported
from one platform to another.

Rule of thumb: Don't get cute. Spell out the code so that any
dumb compiler or programmer can read it.

On-topic: that makes my response to this thread, "not".

One of our colleagues from the mid 80's wrote code that was so
clean I liked to say we could eat off of it.  I think he still
reads this forum: So to Mark Vander Veen, here we are over 20
years later and I Still appreciate your code.  Now THAT is
Brilliant.

T

_______________________________________________
U2-Users mailing list
U2-Users@...
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
U2-Users@...
http://listserver.u2ug.org/mailman/listinfo/u2-users

Re: Brilliant? or not?

by Robert Houben-2 :: Rate this Message:

| View Threaded | Show Only this Message

And as a side-note most compilers worth using will generate the same machine instructions when you optimize, so there's no benefit in the "cute" versions.  The more long-winded "readable" version is much more valuable in the long run... IMO

-----Original Message-----
From: u2-users-bounces@... [mailto:u2-users-bounces@...] On Behalf Of George Gallen
Sent: January-16-12 10:54 AM
To: U2 Users List
Subject: Re: [U2] Brilliant? or not?

This is one of the reasons why I continue to x=x+1 instead of x++

Not all languages support the ++, but they all support x=x+1

George

-----Original Message-----
From: u2-users-bounces@... [mailto:u2-users-bounces@...] On Behalf Of Tony Gravagno
Sent: Monday, January 16, 2012 1:50 PM
To: u2-users@...
Subject: Re: [U2] Brilliant? or not?

> From: Charles_Shaffer
> Aside from it not being readable, compacting C code like that can
> reduce portability.  Different compilers may evaluate complex,
> compacted code differently.

Same thing has actually happened with BASIC code that's ported from one platform to another.

Rule of thumb: Don't get cute. Spell out the code so that any dumb compiler or programmer can read it.

On-topic: that makes my response to this thread, "not".

One of our colleagues from the mid 80's wrote code that was so clean I liked to say we could eat off of it.  I think he still reads this forum: So to Mark Vander Veen, here we are over 20 years later and I Still appreciate your code.  Now THAT is Brilliant.

T

_______________________________________________
U2-Users mailing list
U2-Users@...
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
U2-Users@...
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
U2-Users@...
http://listserver.u2ug.org/mailman/listinfo/u2-users

Re: Brilliant? or not?

by Symeon Breen :: Rate this Message:

| View Threaded | Show Only this Message

Hmmmm


This has whole topic has been mentioned on here before, and my stance is the
same, if you can not read that code and work it out in 4 seconds, then maybe
you should not be a programmer.  Code is code, read it , understand it, get
over it   ....

-----Original Message-----
From: u2-users-bounces@...
[mailto:u2-users-bounces@...] On Behalf Of Tony Gravagno
Sent: 16 January 2012 18:50
To: u2-users@...
Subject: Re: [U2] Brilliant? or not?

> From: Charles_Shaffer
> Aside from it not being readable, compacting C code like that can
> reduce portability.  Different compilers may evaluate complex,
> compacted code differently.

Same thing has actually happened with BASIC code that's ported from one
platform to another.

Rule of thumb: Don't get cute. Spell out the code so that any dumb compiler
or programmer can read it.

On-topic: that makes my response to this thread, "not".

One of our colleagues from the mid 80's wrote code that was so clean I liked
to say we could eat off of it.  I think he still reads this forum: So to
Mark Vander Veen, here we are over 20 years later and I Still appreciate
your code.  Now THAT is Brilliant.

T

_______________________________________________
U2-Users mailing list
U2-Users@...
http://listserver.u2ug.org/mailman/listinfo/u2-users
-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1416 / Virus Database: 2109/4146 - Release Date: 01/16/12

_______________________________________________
U2-Users mailing list
U2-Users@...
http://listserver.u2ug.org/mailman/listinfo/u2-users

Re: Brilliant? or not?

by Tom Whitmore :: Rate this Message:

| View Threaded | Show Only this Message

I agree with Tony.  

You can write dense code, but the goal should always be to write clear, documented, code so the next programmer doesn't have to "figure out" what you are trying to do.

The more dense the code, the higher the cost to maintain the code.  

The beauty of PICK code is that you can write "self-documenting" code, or code that is dense and obtuse.

I urge everyone to write clear code, including meaningful variables and comments!

Tom
RATEX Business Solutions

-----Original Message-----
From: u2-users-bounces@... [mailto:u2-users-bounces@...] On Behalf Of Symeon Breen
Sent: Monday, January 16, 2012 3:17 PM
To: 'U2 Users List'
Subject: Re: [U2] Brilliant? or not?

Hmmmm


This has whole topic has been mentioned on here before, and my stance is the same, if you can not read that code and work it out in 4 seconds, then maybe you should not be a programmer.  Code is code, read it , understand it, get
over it   ....

-----Original Message-----
From: u2-users-bounces@...
[mailto:u2-users-bounces@...] On Behalf Of Tony Gravagno
Sent: 16 January 2012 18:50
To: u2-users@...
Subject: Re: [U2] Brilliant? or not?

> From: Charles_Shaffer
> Aside from it not being readable, compacting C code like that can
> reduce portability.  Different compilers may evaluate complex,
> compacted code differently.

Same thing has actually happened with BASIC code that's ported from one platform to another.

Rule of thumb: Don't get cute. Spell out the code so that any dumb compiler or programmer can read it.

On-topic: that makes my response to this thread, "not".

One of our colleagues from the mid 80's wrote code that was so clean I liked to say we could eat off of it.  I think he still reads this forum: So to Mark Vander Veen, here we are over 20 years later and I Still appreciate your code.  Now THAT is Brilliant.

T

_______________________________________________
U2-Users mailing list
U2-Users@...
http://listserver.u2ug.org/mailman/listinfo/u2-users
-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1416 / Virus Database: 2109/4146 - Release Date: 01/16/12

_______________________________________________
U2-Users mailing list
U2-Users@...
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
U2-Users@...
http://listserver.u2ug.org/mailman/listinfo/u2-users

Re: Brilliant? or not?

by Mecki Foerthmann :: Rate this Message:

| View Threaded | Show Only this Message

I agree, if it took you more than 4 seconds to work that piece of code
out you shouldn't be a programmer.
But if it requires working out and thus at least twice as long than
reading a simple if-then-else statement it's definitely not a brilliant
piece of code.

On 16/01/2012 20:16, Symeon Breen wrote:
> Hmmmm
>
>
> This has whole topic has been mentioned on here before, and my stance is the
> same, if you can not read that code and work it out in 4 seconds, then maybe
> you should not be a programmer.  Code is code, read it , understand it, get
> over it   ....
>
>
_______________________________________________
U2-Users mailing list
U2-Users@...
http://listserver.u2ug.org/mailman/listinfo/u2-users
< Prev | 1 - 2 | Next >