Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > programming styles

Reply
Thread Tools

programming styles

 
 
Chris Uppal
Guest
Posts: n/a
 
      02-06-2007
Alex Hunsley wrote:

> 2) bytecode obfuscation - compacts the bytecode (also in the process
> making it probably harder to pick meaning out of any decompilation of
> said bytecode) - often used in J2ME projects to reduce download size


Technically, compaction and obfuscation are separate operations. Although it's
true that some compaction techniques (such as shrinking and overloading
identifiers) do have a definite obfuscating effect. And although more
obfuscators can do some compaction too, there are other obfuscation techniques
(such as control flow rearrangement) which don't necessarily shrink the
bytecode. Indeed I can't see any reason why an obfuscator might not
deliberately bloat the bytecode (for instance introducing artificial code
blocks which jump to some instruction, thus making it harder to analyse the
purpose of the target code).

-- chris


 
Reply With Quote
 
 
 
 
Chris Uppal
Guest
Posts: n/a
 
      02-06-2007
Lew wrote:

> Style is [...]


Nah, true style is setting your editor to use green against a black
background...

-- chris


 
Reply With Quote
 
 
 
 
Daniel Pitts
Guest
Posts: n/a
 
      02-06-2007
On Feb 5, 10:25 pm, Lew <con...@nospam.lewscanon.com> wrote:
> "Amali" wrote:
> >> What is meant by programming "style" and why it is important

> Hak...@gmail.com wrote:
> > It's important because it makes your code more readable.
> > Some conventions like where to put the brackets might seem odd to you,
> > but if everyone puts them in similar places, it's easier to read
> > everyones code.

>
> > Many people have died over long winded discussions of format, spacing
> > and such.

>
> There is far more to style than mere indentation. Where you place your braces
> isn't style, it's formatting. Style is whether you use compact algorithms with
> solid invariants and good error checking, or if you just slap together some
> crude loops and hope it works. Style is anally javadocing everything in sight,
> vs. letting the next schnook forensically discern your intentions. Style is
> choosing whether to make a method public final or protected inheritable. Style
> is making nicely encapsulated, beautifully cooperating modules that emergently
> produce magic and cannot break or fail in the face of the most outrageous user
> input. Style is coding an application at sixty-four times the industry average
> and having a fraction of the bugs, and leaving easy room for every future
> enhancement the customer wishes.
>
> As long as you remain focused on the braces and indents, you will never see
> the grasshopper.
>
> - Lew



Or, using javadoc to bury the smell of bad naming conventions.

Which would you rather see, the javadoc version?
// Ask the scenes forensic-material-team to scout the scene.
fmt().go(s)
--- or the self-documenting version?
getForensicMeterialTeam().scout(scene);

 
Reply With Quote
 
Daniel Pitts
Guest
Posts: n/a
 
      02-06-2007
On Feb 6, 9:27 am, "Chris Uppal" <chris.up...@metagnostic.REMOVE-
THIS.org> wrote:
> Lew wrote:
> > Style is [...]

>
> Nah, true style is setting your editor to use green against a black
> background...
>
> -- chris


I always prefered Amber on black

 
Reply With Quote
 
Lew
Guest
Posts: n/a
 
      02-07-2007
Daniel Pitts wrote:
> Or, using javadoc to bury the smell of bad naming conventions.
>
> Which would you rather see, the javadoc version?
> // Ask the scenes forensic-material-team to scout the scene.
> fmt().go(s)
> --- or the self-documenting version?
> getForensicMeterialTeam().scout(scene);


Both.

Javadocs are for more than just source-code reading; they provide an API
reference. They should at least describe the guzintas and comzouttas and
checked exceptions, and often include special information, such as the
algorithmic complexity of a particular implementation (cf. the Javadocs for
different Collection classes).

For source readability, names should be chosen to be clear without excessive
redundancy. The example "getForensicMeterialTeam().scout(scene)" shows good
nomenclature policy. Such "self-documenting" names should work synergistically
with the Javadocs to aid maintainability and utility of the code.

A "bad" name is something like your example of "fmt().go(s)" (too terse), and
names like "userNameString" (the "String" portion is at least redundant and
potentially misleading) or "aNameThatIsReallyFarTooLongToBeUseful".

- Lew
 
Reply With Quote
 
Ed Kirwan
Guest
Posts: n/a
 
      02-07-2007
Daniel Pitts wrote:

>
> Or, using javadoc to bury the smell of bad naming conventions.
>
> Which would you rather see, the javadoc version?
> // Ask the scenes forensic-material-team to scout the scene.
> fmt().go(s)
> --- or the self-documenting version?
> getForensicMeterialTeam().scout(scene);
>


What will your javadoc for the getForensicMeterialTeam() method look like?

Perhaps,

/**
* Returns the forensic materials team relevant to the current
* investigation.
*
* @return team responsible for investigating materials at the
* behest of a judiciary
*/

The point being, it's lovely to have getForensicMeterialTeam() in your
code, instead of the alternative above, but you won't get rid of the
comment: you'll just move it (to a more appropriate place).

And the code will no-doubt continue:
CSITeam csiTeam = getCSITeam();
csiTeam.everyoneLookSeriousAndProfessionalAndUtter lyDedicatedToThePointOfBeingPaperThinCharacterisat ionsOfOneDimensionalCartoonCharacters();

..ed

--
www.EdmundKirwan.com - Home of The Fractal Class Composition.

Download Fractality, free Java code analyzer:
http://www.EdmundKirwan.com/servlet/...c-page130.html
 
Reply With Quote
 
MikeNereson
Guest
Posts: n/a
 
      02-07-2007
> On Feb 5, 1:12 pm, "Amali" <amalikarunanay...@gmail.com> wrote:
> What is meant by programming "style" and why it is important


Sun, at http://java.sun.com/docs/codeconv/ states

>> Why have code conventions? Code conventions are important to
>> programmers for a number of reasons:
>>
>> * 80% of the lifetime cost of a piece of software goes to maintenance.
>> * Hardly any software is maintained for its whole life by the original author.
>> * Code conventions improve the readability of the software, allowing
>> engineers to understand new code more quickly and thoroughly.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
questions about programming styles fdu.xiaojf@gmail.com Python 3 05-20-2007 10:46 AM
Styles of programming Thomas Korsgaard Java 5 12-11-2005 11:56 PM
Ruby programming styles and new program? Bill Ruby 16 10-17-2004 12:35 AM
(Programming) Various Syntax styles Chris Mantoulidis C++ 18 12-15-2003 09:09 AM
Column Styles Rich MCSD 0 10-02-2003 11:29 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57