File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

which one is recommended ?

 
ankur rathi
Ranch Hand
Posts: 3830
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
which one is good practice & recommended for projects :


Thanks .
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This has got nothing to do with the performance. I would prefer the 2nd option to avoid simple mistakes. Both are okay to use.
[ April 08, 2005: Message edited by: Pradeep Bhat ]
 
David Harkness
Ranch Hand
Posts: 1646
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is more a matter of style, and errors usually occur when mixing styles. Therefore, no matter what you choose, whether
  • A(int a) { this.a = a; }
  • A(int arg) { this.a = arg; }
  • A(int arg) { a = arg; }
  • A(int _a) { this.a = _a; }
  • A(int _a) { a = _a; }

  • or something else, be consistent, and if you're editing someone else's code, follow their style or change all constructors to match the project's style if that's appropriate.
     
    Ilja Preuss
    author
    Sheriff
    Posts: 14112
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Moving to Java in General (beginners)...
     
    Ilja Preuss
    author
    Sheriff
    Posts: 14112
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Originally posted by Pradeep Bhat:
    I would prefer the 2nd option to avoid simple mistakes.[/QB]


    I prefer the 1st, partly because I use an IDE with color highlights fields differently from local variables and warns me about the most common mistake (assigning the field to itself).

    I agree with David, though: Most important is that you do it consistently (throughout the whole team, if you are not working alone).
     
    Richard Munde
    Greenhorn
    Posts: 6
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Which IDE do you use?
     
    magic zha
    Greenhorn
    Posts: 24
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    I preffer the first one ,because I don't need to think the new parameter's name!
     
    ankur rathi
    Ranch Hand
    Posts: 3830
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Thanks for inputs ,
    Can any body tell me , which is the forum , where I can post best practice ( what is recommended & what is not ) type of questions ...

    Thanks .
     
    Pradeep bhatt
    Ranch Hand
    Posts: 8927
    Firefox Browser Java Spring
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Originally posted by magic zha:
    I preffer the first one ,because I don't need to think the new parameter's name!


     
    Pradeep bhatt
    Ranch Hand
    Posts: 8927
    Firefox Browser Java Spring
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Originally posted by Ilja Preuss:


    I prefer the 1st, partly because I use an IDE with color highlights fields differently from local variables and warns me about the most common mistake (assigning the field to itself).

    I agree with David, though: Most important is that you do it consistently (throughout the whole team, if you are not working alone).


    I agree but I rarely use an IDE I prefer Textpad.
     
    Ilja Preuss
    author
    Sheriff
    Posts: 14112
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Originally posted by Richard Munde:
    Which IDE do you use?


    Eclipse.
     
    Ilja Preuss
    author
    Sheriff
    Posts: 14112
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Originally posted by Pradeep Bhat:


    I agree but I rarely use an IDE I prefer Textpad.


    When I started, I used Textpad, too. But once I got the hang of how the basics work, switching to an IDE made me way more productive.
     
    I agree. Here's the link: http://aspose.com/file-tools
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic