13
How Not To Code A look into AWS Java SDK Code A Study in Java – by Anonymous Face palm

How Not To Code

Embed Size (px)

DESCRIPTION

A look at Amazon AWS SDK's source code - and where the code failsThe aim is to identify bad patterns in the code - and bugs to ensure people learns from the mistakes made.

Citation preview

How Not To Code

How Not To CodeA look into AWS Java SDK Code

A Study in Java by Anonymous Face palmFrom Where?https://github.com/aws/aws-sdk-javaUnderstand Amazon Code QualityExpectationOfficial Mirror for AmazonUse it as a standard mine-field to develop white box testing skills for freshersAfter this you should be able to reduce code and fix most of them Not too Hard to find Issues in Source, and not as easy for freshersequals()?

Simple Task Made to be Too Complex!Why can not I use the field? Why I need to use getXXX() inside my own function?When x is Boolean, if ( x == false ) is same as if (!x) what we are writing here?clone()?

What does java do? Deep/Shallow Copy? Neither!http://stackoverflow.com/questions/6182565/java-deep-copy-shallow-copy-clonehttp://stackoverflow.com/questions/184710/what-is-the-difference-between-a-deep-copy-and-a-shallow-copy

hashCode()?

Copied shamelessly from : http://stackoverflow.com/questions/9648305/creating-a-hashcode-method-java

Or we do not know who is whose copy? hashCode() : II

Do they? Can they?Show me the meaning of.

When already :: Why on Earth?

?????Abstract Class?

Substance Abuse?

No Verification : EVER!!!!What does a documentation : w/o verification means?

How about n > length?

Now we do not understand if /else if return! WOW! WowJavadoc's, Anyone?

What are you using AMZN? Eclipse?Use something that works which increase productivity a bit, JetBrains perhaps? See the RED ? It means error in Java Doc In case you dont know

Yes, we understand some other people would use it later.But please, move to a sane IDE. Not Sure why

Copy the beginMarker BUTClone the bytes? Hmm..

Please for ONCE, use your OWN field Without using a getter inside YOUR OWN BODY!Anyone out there?Anyone?.Questions?