Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

Soricidus posted:

The brace goes on the next line for declarations, and on the same line for control constructs. This isn't hard folks and I don't know why so many people get it wrong.

I feel like I'm falling into a trap here, but go on, do please tell us why these things should be treated differently.

Adbot
ADBOT LOVES YOU

Jewel
May 2, 2009

stop talking about braces for the billionth time, nobody is ever going to agree, code how you wanna as long as it's in a fairly accepted style and/or matches your team vOv

ErIog
Jul 11, 2001

:nsacloud:

Hammerite posted:

I feel like I'm falling into a trap here, but go on, do please tell us why these things should be treated differently.

I don't do it, but declarations can often be copied to headers or copied when you need to use them but can't remember all the arguments and don't have intellisense.

So not having a brace allows you to cut/paste with a little less fuss.

I'm a dirty VIM user who mostly codes Ruby and C++ though. So please discount my opinion.

ErIog fucked around with this message at 10:33 on Jun 3, 2016

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

ErIog posted:

I don't do it, but declarations can often be copied to headers or copied when you need to use them but can't remember all the arguments and don't have intellisense.

So not having a brace allows you to cut/paste with a little less fuss.

I'm a dirty VIM user who mostly codes Ruby and C++ though. So please discount my opinion.

That is a reason of sorts to use the newline for function signatures, but in order to justify the inconsistency, it would need to be accompanied by a reason not to use the newline for control flow statements.

ErIog
Jul 11, 2001

:nsacloud:

Hammerite posted:

That is a reason of sorts to use the newline for function signatures, but in order to justify the inconsistency, it would need to be accompanied by a reason not to use the newline for control flow statements.

It takes up valuable vertical screen space. I have 80 chars left to right, I have a lot fewer rows than that by a lot. Using an entire row for a bracket doesn't just eat a char, it eats 79 chars worth of space on the screen.

I do bracket on the same line for everything, but I can understand treating them differently.

I think people get bogged down in formatting too much. Consistency is okay, but it shouldn't be prioritized over understandability.

ErIog fucked around with this message at 11:18 on Jun 3, 2016

feedmegin
Jul 30, 2008

ErIog posted:

It takes up valuable vertical screen space. I have 80 chars left to right, I have a lot fewer rows than that by a lot.

I am sorry that you have to do your coding on a VT220.

ErIog
Jul 11, 2001

:nsacloud:

feedmegin posted:

I am sorry that you have to do your coding on a VT220.

80 chars is pretty good for having two windows up side by side with code that's readable. I wouldn't hold everybody to that convention, but I find it useful.

So coming from my perspective, having declarations with a bracket on a separate line with other flow control brackets on the same line doesn't seem that crazy to me. If you're coding in Visual Studio in 2016 then you probably don't see much benefit.

Jewel
May 2, 2009

https://twitter.com/arlogilbert/status/738475551619325952

:allears: PHP

dougdrums
Feb 25, 2005
CLIENT REQUESTED ELECTRONIC FUNDING RECEIPT (FUNDS NOW)
Can I count on your support for T. Paamayim Nekudotayim for president this November?

karms
Jan 22, 2006

by Nyc_Tattoo
Yam Slacker

If it wasn't for php it might have not even called, fouling call statistics!

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

dougdrums posted:

Can I count on your support for T. Paamayim Nekudotayim for president this November?

"-0.0"

Spatial
Nov 15, 2007

I want to nominate the idea of the overloaded right shift operator for horror status. I don't mean <iostream> but the C concept where signedness of the left operand decides between arithmetic and logical shift. I've been developing embedded software for years now and it's never helped me once. It just makes poo poo ugly. Every time I do a right shift I already know the behaviour I want, just let me specify it directly with separate operators. It's not even a good shortcut for division because signed shifts round the wrong way.

TheresaJayne
Jul 1, 2011

Dirty Frank posted:

VB is horrid and you should move to c# with all possible and prudent haste. And we should never talk about VB again.

I dont have the choice, C# is better but a 13 year old codebase says it cant happen

feedmegin
Jul 30, 2008

ErIog posted:

80 chars is pretty good for having two windows up side by side with code that's readable. I wouldn't hold everybody to that convention, but I find it useful.

So coming from my perspective, having declarations with a bracket on a separate line with other flow control brackets on the same line doesn't seem that crazy to me. If you're coding in Visual Studio in 2016 then you probably don't see much benefit.

Sure, I can see that horizontally, and I tend to keep it that way myself. But vertically? I've got a 1920x1200 monitor, I'm sure as hell not going to leave my editor window 24 lines long because that was the state of the art in 1975 and I don't see any good argument for doing so. I normally have more vertical than horizontal space.

Absurd Alhazred
Mar 27, 2010

by Athanatos

dougdrums posted:

Can I count on your support for T. Paamayim Nekudotayim for president this November?

T:: or TT:?

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

TheresaJayne posted:

I dont have the choice, C# is better but a 13 year old codebase says it cant happen

same. we are on vb6, not vb.net. there's no way to directly move. we're slowly just creating new frontend stuff in c#, but that's obviously a slow process when you need to also provide fixes and enhancements on the existing infrastructure to customers.

PT6A
Jan 5, 2006

Public school teachers are callous dictators who won't lift a finger to stop children from peeing in my plane
Visual Basic is to software development what WordPress is to web development. It seems like a good idea if and only if you have a very limited idea what you're doing. Unfortunately, since that's how many people/companies start out, you end up getting trapped in a maze of poo poo code you can't convince people to get rid of.

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

LeftistMuslimObama posted:

same. we are on vb6, not vb.net. there's no way to directly move. we're slowly just creating new frontend stuff in c#, but that's obviously a slow process when you need to also provide fixes and enhancements on the existing infrastructure to customers.

Out of curiosity, if you do a raw cut-and-paste of your VB6 sources folder into a shiny new VB.Net project and toggle off all the safety options, how many errors do you get?

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



ErIog posted:

80 chars is pretty good for having two windows up side by side with code that's readable. I wouldn't hold everybody to that convention, but I find it useful.

So coming from my perspective, having declarations with a bracket on a separate line with other flow control brackets on the same line doesn't seem that crazy to me. If you're coding in Visual Studio in 2016 then you probably don't see much benefit.

Especially not when the powertools plugin will makes those lines shorter for you :smugdog:

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

NihilCredo posted:

Out of curiosity, if you do a raw cut-and-paste of your VB6 sources folder into a shiny new VB.Net project and toggle off all the safety options, how many errors do you get?

All of them. I don't even know if you can build an activex component in .Net. I'm told that we tried that at first before deciding on the c# transition and it was enough manual code editing that it was better to write newer and better stuff from scratch.

rarbatrol
Apr 17, 2011

Hurt//maim//kill.

PT6A posted:

Visual Basic is to software development what WordPress is to web development. It seems like a good idea if and only if you have a very limited idea what you're doing. Unfortunately, since that's how many people/companies start out, you end up getting trapped in a maze of poo poo code you can't convince people to get rid of.

VB is ugly, but I wouldn't say it's a bad idea per se. I feel like most people encounter VB code that has been around for many years, and as such is not "state of the art." That's been true for my entire career to this point. The real hell is being stuck during the migration between the two languages and continuously forgetting the subtle ways that they're different. That's been true for my entire career to this point.

PT6A
Jan 5, 2006

Public school teachers are callous dictators who won't lift a finger to stop children from peeing in my plane

rarbatrol posted:

VB is ugly, but I wouldn't say it's a bad idea per se. I feel like most people encounter VB code that has been around for many years, and as such is not "state of the art." That's been true for my entire career to this point. The real hell is being stuck during the migration between the two languages and continuously forgetting the subtle ways that they're different. That's been true for my entire career to this point.

As a result of its ugliness and relative simplicity, though, it breeds bad and difficult to maintain code in many cases (see also: PHP and Perl). While there's no reason you should or must write bad code in any language, certain languages tend more toward encouraging it than others, and while all of the above are perfectly serviceable and even useful languages in the right circumstances, it can lead to especially unmaintainable, nightmarish codebases if you're working on a large project that's going to be maintained and improved upon for a long period of time.

I will agree comparing it to Wordpress was harsh, because Wordpress itself is a horror, whereas VB is a good tool for certain things that is occasionally used to commit unspeakable sins. Still, I'd say that many of the conditions that lead to them being used in situations where they are far from the best tool for the job are similar.

Illusive Fuck Man
Jul 5, 2004
RIP John McCain feel better xoxo 💋 🙏
Taco Defender
my dad got me a copy of visual basic 6.0 when I was in 5th grade and I made a frogger clone, except nobody taught me how to write loops so there was a timer for every condition I wanted to check and one for each car/truck to update their positions and poo poo. It did not run fast on some machines.

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

PT6A posted:

As a result of its ugliness and relative simplicity, though, it breeds bad and difficult to maintain code in many cases (see also: PHP and Perl). While there's no reason you should or must write bad code in any language, certain languages tend more toward encouraging it than others, and while all of the above are perfectly serviceable and even useful languages in the right circumstances, it can lead to especially unmaintainable, nightmarish codebases if you're working on a large project that's going to be maintained and improved upon for a long period of time.

I will agree comparing it to Wordpress was harsh, because Wordpress itself is a horror, whereas VB is a good tool for certain things that is occasionally used to commit unspeakable sins. Still, I'd say that many of the conditions that lead to them being used in situations where they are far from the best tool for the job are similar.

yeah. in our case we were one of the first systems in our field to add a gui and at the time the only non-poo poo way to have a gui application on windows was to use vb6, because your alternative was raw win32 apis in c++ and gently caress having anyone work with that when their primary jobs are application developers and database engineers. we're slowly migrating to asp.net, but some teams have more commitments than others so for the time being my team is mostly stuck in vb6 land because we've hit a sales spike and that means lots of change orders and hotfixes for bugs in weird edge cases no one had hit before.

my boss actually told me the other day that he wants to promote me fast because im the only person he's ever seen get handed a bug report for one of our vb6 modules and just find and fix the problem without either leaning heavily on an experienced dev for help or running and screaming. the code is painfully poorly organized and often obtuse, but it's kinda inevitable in an enterprise application written in vb6 that's been growing for 16 years.

TheresaJayne
Jul 1, 2011

LeftistMuslimObama posted:

yeah. in our case we were one of the first systems in our field to add a gui and at the time the only non-poo poo way to have a gui application on windows was to use vb6, because your alternative was raw win32 apis in c++ and gently caress having anyone work with that when their primary jobs are application developers and database engineers. we're slowly migrating to asp.net, but some teams have more commitments than others so for the time being my team is mostly stuck in vb6 land because we've hit a sales spike and that means lots of change orders and hotfixes for bugs in weird edge cases no one had hit before.

my boss actually told me the other day that he wants to promote me fast because im the only person he's ever seen get handed a bug report for one of our vb6 modules and just find and fix the problem without either leaning heavily on an experienced dev for help or running and screaming. the code is painfully poorly organized and often obtuse, but it's kinda inevitable in an enterprise application written in vb6 that's been growing for 16 years.

Sounds like the booking software i used to work for, We ended up having VM to run VB6 whilst the "new team" was converting to C# and Azure.

I was hired by the Lead Dev, who then told the board to literally F$%^ Off, and quit leaving the whole project in the lurch, but they didnt ask me if i could help. Instead they did the following: Shortly after i passed the Trial period and had a letter stating so, Then the Manager changed and the new manager sacked me for not updating him when i went on holiday - He left at 3pm and I left at 7pm and he was expecting an update on where i was (i had put full details of where i was in the Ticket and the TFS ) and so I came back from holiday to a cardboard box and no job.
I think however it was more about getting rid of anyone who was linked to the Dev Lead who has quit just before - meaning the whole C# team and me, (the original manager also quit to become a hypnotherapist)

So the company had then 2 Devs left and shortly after the other new Dev quit and contacted me telling me that they had no idea at all and he left before they crashed.

Just in case they are the same company - They are based near a UK international airport in the old Terminal Building.

Soricidus
Oct 21, 2010
freedom-hating statist shill

Hammerite posted:

I feel like I'm falling into a trap here, but go on, do please tell us why these things should be treated differently.

It looks better.

return0
Apr 11, 2007
code:
~>  irb
2.3.0 :001 > String === ""
 => true
2.3.0 :002 > "" === String
 => false
2.3.0 :003 >

fritz
Jul 26, 2003

return0 posted:

code:
~>  irb
2.3.0 :001 > String === ""
 => true
2.3.0 :002 > "" === String
 => false
2.3.0 :003 >

Where's the Institutional Review Board when you need them.

qntm
Jun 17, 2009

return0 posted:

code:
~>  irb
2.3.0 :001 > String === ""
 => true
2.3.0 :002 > "" === String
 => false
2.3.0 :003 >

How in the world?

return0
Apr 11, 2007
In all fairness, maybe it's not so weird after reading more about it, but definitely caught me out earlier in a ruby web service we've inherited.

nielsm
Jun 1, 2009



return0 posted:

code:
~>  irb
2.3.0 :001 > String === ""
 => true
2.3.0 :002 > "" === String
 => false
2.3.0 :003 >

I'm guessing the first constructs a new String instance and compares it to "", while the second compares "" to the String class itself. (Meta object? Class object?)

Bognar
Aug 4, 2011

I am the queen of France
Hot Rope Guy

nielsm posted:

I'm guessing the first constructs a new String instance and compares it to "", while the second compares "" to the String class itself. (Meta object? Class object?)

I've been burned by enough stupid decisions in dynamic languages that I'm going to assume the first doesn't do an equality check at all, but instead checks if "" is of type String.

necrotic
Aug 2, 2005
I owe my brother big time for this!

Bognar posted:

I've been burned by enough stupid decisions in dynamic languages that I'm going to assume the first doesn't do an equality check at all, but instead checks if "" is of type String.

Bingo. The triple-equal is basically "".is_a?(String)

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

Oh my god, you guys are really grasping at straws. Everybody knows you never use === and always use ====, which is the equality operator that actually works. Don't complain just because you haven't put in the time to learn the basics of the language.

xzzy
Mar 5, 2009

Next up in our lesson is the 8======D operator.

ExcessBLarg!
Sep 1, 2001
"===" in Ruby is the Case Equality operator and is generally asymmetric. This is usually OK becuase "===" is never directly invoked in idiomatic Ruby, but used to define the comparator for case/when expressions.

The way it's defined on Module (and Class) objects is to return true if the right-side is an instance. It lets you do type inspection:
code:
case "some string"
when Integer
  puts "It's an integer."
when String
  puts "It's a string."
end
which is very much not duck typing, but whatever. It's a lot more useful when used on other types, like Regexp and maybe to a lesser extent Ranges.

I don't think "===" as a case equality operator is horrible. The obvious problem is that it has a totally different meaning in JavaScript, and JS programmers are hard-wired to use "===" everywhere. If you actually see 'foo === "some string"' in Ruby, it's guaranteed to be a mistake by a JS programmer.

ExcessBLarg! fucked around with this message at 23:45 on Jun 6, 2016

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
No, I think a programmer who had never seen === before (in any language) but was familiar with == (in Ruby and elsewhere) would probably jump to the assumption that === is some kind of variant equality. They might not know what it is, exactly, but they would probably expect it to be symmetric. Using it for case matching is definitely a weird choice when they could easily have gone with something like ~=.

Space Kablooey
May 6, 2009


NihilCredo posted:

Oh my god, you guys are really grasping at straws. Everybody knows you never use === and always use ====, which is the equality operator that actually works. Don't complain just because you haven't put in the time to learn the basics of the language.

I was almost sure that PHP had an honest-to-god ==== operator, but since I can't find it anymore it must have been a joke.

Absurd Alhazred
Mar 27, 2010

by Athanatos

rjmccall posted:

No, I think a programmer who had never seen === before (in any language) but was familiar with == (in Ruby and elsewhere) would probably jump to the assumption that === is some kind of variant equality. They might not know what it is, exactly, but they would probably expect it to be symmetric. Using it for case matching is definitely a weird choice when they could easily have gone with something like ~=.

Yeah, I think that a non-symmetric operator shouldn't look symmetric. "-" can't be helped, but I do miss Pascal's ":=" for assignment.

Adbot
ADBOT LOVES YOU

john donne
Apr 10, 2016

All suitors of all sorts themselves enthral;

So on his back lies this whale wantoning,

And in his gulf-like throat, sucks everything

That passeth near.
There shouldn't be any operators, only explicit function invocation.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply