What's new

Java What do people generally think of the Syntax Java?

  • Thread starter WUB WUB M8
  • Start date
  • Views 925
Status
Not open for further replies.
P

pwfdc

Member
Bright Idea Programmer Experienced Veteran
Messages
1,540
Reaction score
677
Points
465
Sin$
0
Oh wow. I just looked at the Java standards too.
It's not that big of a deal really. Something like that can be broken easy or fixed. It's not like a "bad habit" like always setting static global variables. HA!
 
ObscureCoder

ObscureCoder

Enthusiast
Messages
684
Reaction score
308
Points
125
Sin$
0
Oh wow. I just looked at the Java standards too.
It's not that big of a deal really. Something like that can be broken easy or fixed. It's not like a "bad habit" like always setting static global variables. HA!
In all seriousness. Keep code up to conventions.
 
Liquid44

Liquid44

Banned
Programmer
Messages
1,158
Reaction score
691
Points
245
Sin$
0
In all seriousness. Keep code up to conventions.

Umm it's all down to personal preference and not really specific to a single language. Besides it's not really a good idea to stick to only one as every company would have slightly different standards anyway which you gotta adapt to.
 
P

pwfdc

Member
Bright Idea Programmer Experienced Veteran
Messages
1,540
Reaction score
677
Points
465
Sin$
0
Umm it's all down to personal preference and not really specific to a single language. Besides it's not really a good idea to stick to only one as every company would have slightly different standards anyway which you gotta adapt to.
Exactly, these are "standards" yes; but things like where you put brackets aren't going to get your project ripped off of GitHub or get you fired from a company.
I guess it's okay, but all those standards seem to be is exact documentation of everything.

How you comment things and where you put functions shouldn't be based off of a "global standard" that's set upon one person's opinion.

Also, things as minute as that is not really bad to bring over to Java. I also add more line breaks than other people.
Example...
Code:
public void function()
{
    if (var == true)
    {
        function2();
    }
    else if (var2 == true && var3 == false)
    {
        function3(453);
    }
    else
    {
        displayFunction("Error");
    }
}

public void function()
{
    if (var)
    {
        function2();
    }
    else if (var2 && !var3)
    {
        function3(453);
    }
    else
    {
        displayFunction("Error");
    }
}

However...here's some other ways I've seen code done...
Code:
public void function() {
if (var == true) {
function2();
}
else if (var2 == true && var3 == false) {
function3(453);
}
else {
displayFunction("Error");
}
}

public void function() {
    if (var == true) {
        function2();
    }
    else if (var2 == true && var3 == false) {
        function3(453);
    }
    else {
        displayFunction("Error");
    }
}

public void function(){
if (var == true){function2();}
else if (var2 == true && var3 == false){function3(453);}
else{displayFunction("Error");}
}

Now let's be honest...all can be easily read, and they all still work. Standards are crap. I've never seen someone wait to release a project for "standards". The way you code is a signature. You can usually tell my code because I have more line break and my "long" comments look like...
Code:
/* <about>
    Title
        > Info Header
            * Bullet
    ## Links
    ## Links
</about>*/
Why? Because I just do it like that. It's also like markdown more or less. I use -, :, _, and | to help separate things in my comments also. I'm also known to comment even the simplest of commands that is obvious what it does. Why? Because it's my thing.
I just like line breaks and tabbing too. It's my habit and visually easier for me to tell which if/else statement I'm working in. It's just how I work. Oh, and I don't use cases. I don't. I hate them. I would rather write else if statements.

I'm not worried about "standards". I'm not using constants, I have no "bad habits". So why should I care? :tongue: :tongue:
I guess some just worry though.
 
ObscureCoder

ObscureCoder

Enthusiast
Messages
684
Reaction score
308
Points
125
Sin$
0
Umm it's all down to personal preference and not really specific to a single language. Besides it's not really a good idea to stick to only one as every company would have slightly different standards anyway which you gotta adapt to.
You're wrong. Each language has conventions you must abide to when working on open source, team projects.
Please don't try and tell me I'm wrong, you'll sound like a right ****ing idiot. 
Exactly, these are "standards" yes; but things like where you put brackets aren't going to get your project ripped off of GitHub or get you fired from a company.
I guess it's okay, but all those standards seem to be is exact documentation of everything.

How you comment things and where you put functions shouldn't be based off of a "global standard" that's set upon one person's opinion.

Also, things as minute as that is not really bad to bring over to Java. I also add more line breaks than other people.
Example...
Code:
public void function()
{
    if (var == true)
    {
        function2();
    }
    else if (var2 == true && var3 == false)
    {
        function3(453);
    }
    else
    {
        displayFunction("Error");
    }
}

public void function()
{
    if (var)
    {
        function2();
    }
    else if (var2 && !var3)
    {
        function3(453);
    }
    else
    {
        displayFunction("Error");
    }
}

However...here's some other ways I've seen code done...
Code:
public void function() {
if (var == true) {
function2();
}
else if (var2 == true && var3 == false) {
function3(453);
}
else {
displayFunction("Error");
}
}

public void function() {
    if (var == true) {
        function2();
    }
    else if (var2 == true && var3 == false) {
        function3(453);
    }
    else {
        displayFunction("Error");
    }
}

public void function(){
if (var == true){function2();}
else if (var2 == true && var3 == false){function3(453);}
else{displayFunction("Error");}
}

Now let's be honest...all can be easily read, and they all still work. Standards are crap. I've never seen someone wait to release a project for "standards". The way you code is a signature. You can usually tell my code because I have more line break and my "long" comments look like...
Code:
/* <about>
    Title
        > Info Header
            * Bullet
    ## Links
    ## Links
</about>*/
Why? Because I just do it like that. It's also like markdown more or less. I use -, :, _, and | to help separate things in my comments also. I'm also known to comment even the simplest of commands that is obvious what it does. Why? Because it's my thing.
I just like line breaks and tabbing too. It's my habit and visually easier for me to tell which if/else statement I'm working in. It's just how I work. Oh, and I don't use cases. I don't. I hate them. I would rather write else if statements.

I'm not worried about "standards". I'm not using constants, I have no "bad habits". So why should I care? :tongue: :tongue:
I guess some just worry though.
Please keep in mind that the if statement is always checking whether something is true so == true is not needed. I'd reply more to the main point of your reply but I can't since I'm at school, on my phone. 
Umm it's all down to personal preference and not really specific to a single language. Besides it's not really a good idea to stick to only one as every company would have slightly different standards anyway which you gotta adapt to.
All companies that write java use java conventions and standards. Hence ctrl shift f to format on eclipse.
 
P

pwfdc

Member
Bright Idea Programmer Experienced Veteran
Messages
1,540
Reaction score
677
Points
465
Sin$
0
Please keep in mind that the if statement is always checking whether something is true so == true is not needed. I'd reply more to the main point of your reply but I can't since I'm at school, on my phone.
Hence the reason I did both var == false and !var. I provided more than one way I do things. :tongue:
 
Liquid44

Liquid44

Banned
Programmer
Messages
1,158
Reaction score
691
Points
245
Sin$
0
You're wrong. Each language has conventions you must abide to when working on open source, team projects.
Please don't try and tell me I'm wrong, you'll sound like a right ****ing idiot.

My my a bit defensive aren't we haha. Can you not read?

I said yes it's good to follow standards but to stick to just to one just because it's "official" is a dumb idea. Those team / open source projects you speak of, the team lead sets the standards and like I said not everyone will have the same rules...

You are still in school and can't face the fact you are wrong lol drop the arrogance because you have yet to work professionally.
 
ObscureCoder

ObscureCoder

Enthusiast
Messages
684
Reaction score
308
Points
125
Sin$
0
My my a bit defensive aren't we haha. Can you not read?

I said yes it's good to follow standards but to stick to just to one just because it's "official" is a dumb idea. Those team / open source projects you speak of, the team lead sets the standards and like I said not everyone will have the same rules...

You are still in school and can't face the fact you are wrong lol drop the arrogance because you have yet to work professionally.

No, no, no. Teams don't ****ing set coding conventions for projects. They follow the ones outlined by the ****ing creators of the language. You don't just make up conventions. In a professional workplace you need to follow these conventions so your code isn't different from everyone else's. This is how the real world works. We don't make up standards. Each programming language has it's own set up very documented conventions. Please look into this as I'm not sure you have any idea what you're talking about.
 
Const

Const

Übermensch
Messages
575
Reaction score
758
Points
205
Sin$
0
Exactly, these are "standards" yes; but things like where you put brackets aren't going to get your project ripped off of GitHub or get you fired from a company.
I guess it's okay, but all those standards seem to be is exact documentation of everything.

How you comment things and where you put functions shouldn't be based off of a "global standard" that's set upon one person's opinion.

Also, things as minute as that is not really bad to bring over to Java. I also add more line breaks than other people.
Example...
Code:
public void function()
{
    if (var == true)
    {
        function2();
    }
    else if (var2 == true && var3 == false)
    {
        function3(453);
    }
    else
    {
        displayFunction("Error");
    }
}

public void function()
{
    if (var)
    {
        function2();
    }
    else if (var2 && !var3)
    {
        function3(453);
    }
    else
    {
        displayFunction("Error");
    }
}

However...here's some other ways I've seen code done...
Code:
public void function() {
if (var == true) {
function2();
}
else if (var2 == true && var3 == false) {
function3(453);
}
else {
displayFunction("Error");
}
}

public void function() {
    if (var == true) {
        function2();
    }
    else if (var2 == true && var3 == false) {
        function3(453);
    }
    else {
        displayFunction("Error");
    }
}

public void function(){
if (var == true){function2();}
else if (var2 == true && var3 == false){function3(453);}
else{displayFunction("Error");}
}

Now let's be honest...all can be easily read, and they all still work. Standards are crap. I've never seen someone wait to release a project for "standards". The way you code is a signature. You can usually tell my code because I have more line break and my "long" comments look like...
Code:
/* <about>
    Title
        > Info Header
            * Bullet
    ## Links
    ## Links
</about>*/
Why? Because I just do it like that. It's also like markdown more or less. I use -, :, _, and | to help separate things in my comments also. I'm also known to comment even the simplest of commands that is obvious what it does. Why? Because it's my thing.
I just like line breaks and tabbing too. It's my habit and visually easier for me to tell which if/else statement I'm working in. It's just how I work. Oh, and I don't use cases. I don't. I hate them. I would rather write else if statements.

I'm not worried about "standards". I'm not using constants, I have no "bad habits". So why should I care? :tongue: :tongue:
I guess some just worry though.
Unrelated but why don't you just write your comments in markdown if your taking this much time. I take notes in markdown and after a while you easily recognize all the 'symbols' while reading.
 
ObscureCoder

ObscureCoder

Enthusiast
Messages
684
Reaction score
308
Points
125
Sin$
0
My my a bit defensive aren't we haha. Can you not read?

I said yes it's good to follow standards but to stick to just to one just because it's "official" is a dumb idea. Those team / open source projects you speak of, the team lead sets the standards and like I said not everyone will have the same rules...

You are still in school and can't face the fact you are wrong lol drop the arrogance because you have yet to work professionally.

To further consolidate my point:
Java conventions outlined by Oracle, companies abide by these as a professional standard:
http://web.archive.org/web/20140228...m/technetwork/java/codeconventions-150003.pdf
C++ style conventions (not outline by Bjarne but adopted by the C++ community):
http://geosoft.no/development/cppstyle.html
C#, outlined by microsoft dev community:
http://msdn.microsoft.com/en-us/library/ff926074.aspx
C (not defined by Richie but adopted by community):
http://homepages.inf.ed.ac.uk/dts/pm/Papers/nasa-c-style.pdf

I'm sure you get my point now. Check any professional shared github project with atleast 3 unique commits and you'll notice these conventions and standard in use.
 
P

pwfdc

Member
Bright Idea Programmer Experienced Veteran
Messages
1,540
Reaction score
677
Points
465
Sin$
0
Unrelated but why don't you just write your comments in markdown if your taking this much time. I take notes in markdown and after a while you easily recognize all the 'symbols' while reading.
It's just something I do. It's like an extra few seconds to make the comment more readable to others. On my projects that are open source I like to comment in a consistent way to help clearly define what each script is about, etc.

That's only my "header comment". Unless it's a long comment, I stick to the "normal" way of commenting.
 
Z61

Z61

Some times our saints are sinners
Retired
Programmer Forum Addict Odysseus' Summit
Messages
5,468
Reaction score
3,429
Points
1,042
Sin$
0
Status
Not open for further replies.
Top Bottom
Login
Register