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.
 
  • Locked thread
Jonny 290
May 5, 2005



[ASK] me about OS/2 Warp
motorola was actually a relatively agile shop but the paperwork was 110% waterfall so what we would do is sneak out deploys every other week and then every quarter we had to collude with walmart and lie on our reports to make it look like big waterfall projects

Adbot
ADBOT LOVES YOU

Necc0
Jun 30, 2005

by exmarx
Broken Cake

Jonny 290 posted:

motorola was actually a relatively agile shop but the paperwork was 110% waterfall so what we would do is sneak out deploys every other week and then every quarter we had to collude with walmart and lie on our reports to make it look like big waterfall projects

also known as the 'college' methodology

Bloody
Mar 3, 2013

tef posted:

comments are the things you would say in a code review, they are there as apologies to your future self.

this is good, this is how i use them.

// lmao i determined this constant experimentally, hopefully it doesnt vary from board to board


// i have no fuckin idea what this does, sorry if it ever matters

// there was a bunch of poo poo here but it was commented out and looked old so i deleted it???

Bloody
Mar 3, 2013

fart simpson posted:

i dont actually like it, we're just institutionally incapable of doing anything else so it's easier to go with the flow

it's easier to leave the institution.

bucketmouse
Aug 16, 2004

we con-trol the ho-ri-zon-tal
we con-trol the verrr-ti-cal

fritz posted:

seriously? I'm using it in a project I'm working on now, that'll be something to keep in mind

from looking through it while trying to figure out how to port over random functionality the slowdown seems to be because a big chunk of the template functions do something like this for every single variable:

code:
template <typename TT>
TT double_number(const TT &number)
{
TT Number = TT(number);
return Number * 2;
}
e: ^ gangtag owns
e2 : i wonder if the slowdown is a vc compiler thing and other better compilers would optimize Number out due to it being a init-from-const whose value never changes

bucketmouse fucked around with this message at 04:21 on Feb 28, 2015

Luigi Thirty
Apr 30, 2006

Emergency confection port.

protip entering MY poo poo IS hosed FIX MY poo poo tickets every 20 minutes and sending me MY poo poo IS hosed FIX MY poo poo emails every 20 minutes and posting MY poo poo IS hosed IS ANYONE ELSE'S poo poo hosed? on our forums every 20 minutes doesn't help me unfuck your poo poo any faster

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord
I have to force myself to comment more because I never got me into the habit (heh self-documenting code amirite? :smug:)

but recently I noticed that I really got into sprinkling TODO comments everywhere. I'm not sure if this is good or irritating for someone else reading the code

MeruFM
Jul 27, 2010
do you ever get to the DO part?

I see it in some code and I just wonder why the person didn't just do them.

HappyHippo
Nov 19, 2003
Do you have an Air Miles Card?

Symbolic Butt posted:

I have to force myself to comment more because I never got me into the habit (heh self-documenting code amirite? :smug:)

but recently I noticed that I really got into sprinkling TODO comments everywhere. I'm not sure if this is good or irritating for someone else reading the code

i love going through old company code and seeing TODO comments that are five years old. guess they never got around to it!

another good one is seeing //BUG BUG BUG!!! sprinkled throughout

HappyHippo
Nov 19, 2003
Do you have an Air Miles Card?

MeruFM posted:

do you ever get to the DO part?

I see it in some code and I just wonder why the person didn't just do them.

usually its because they wanted to do the essential part while it was clear in their head and then cover the corner cases later.

then you go home for the weekend, and you come in monday and theres some crisis that requires your immediate attention, and ...

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord

MeruFM posted:

do you ever get to the DO part?

I see it in some code and I just wonder why the person didn't just do them.

I'd say that I never do 30% of them. at the time it seemed like an important thing but then later it's like "eeeh this is not really important, but I'll leave it here anyway because I like to hoard poo poo"

Stringent
Dec 22, 2004


image text goes here

Bloody posted:

// there was a bunch of poo poo here but it was commented out and looked old so i deleted it???

why do people still leave that kind of poo poo lying around even though the project is in version control?

we've got one at work, I call him the code hoarder.

Valeyard
Mar 30, 2012


Grimey Drawer

Stringent posted:

why do people still leave that kind of poo poo lying around even though the project is in version control?

we've got one at work, I call him the code hoarder.

i do it all the time because I think if i go searching through my copies in version control that I wont find it/remember where it is

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



Stringent posted:

why do people still leave that kind of poo poo lying around even though the project is in version control?

we've got one at work, I call him the code hoarder.

i leave in log statements commented out cause im lazy as poo poo and its easy to uncomment them when something is being weird

actual code though, never checked in commented logic

or i hope i havent anyway

Bloody
Mar 3, 2013

sometimes my version control is copyin and pastin poo poo around.

Luigi Thirty
Apr 30, 2006

Emergency confection port.

Bloody posted:

sometimes my version control is copyin and pastin poo poo around.

src
src_new
src_newer
src_useme

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



Luigi Thirty posted:

src
src_new
src_newer
src_nodont-20141130_THIS
src_nodont-20150104
src_nodont-20150226

bucketmouse
Aug 16, 2004

we con-trol the ho-ri-zon-tal
we con-trol the verrr-ti-cal

Luigi Thirty posted:

src
src_new
src_newer
src_useme

old/old/oldold/src

version control circa 1997

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



bucketmouse posted:

old/old/oldold/src

version control circa 1997

quote:

36. According to Mr. Spearritt, on two occasions (one in late 1996 or early 1997 and the other in August 1997) he requested Mr. Hinkley to backup all source code on Redrock's A2BNT1 UAM server. This occurred after Mr. Hinkley was unable to make a change to SPFS because he was unable to locate all the source code. In his witness statement dated 16 July 2000 (Exhibit H 16) Mr. Spearritt said:

"When a program is released to market, it is important to maintain a copy of all source code utilised in developing that program. That way, if a problem does develop in the running of the program, or if the client wants to alter the program's functionality at some future point in time, the programmer has a complete copy of source code and utilities used to create the version of the program. After the occurrence of this second incident, I told Adam that it was imperative that he kept a backed up version of each piece of production software on the A2BNT1 UAM."

37. Mr. Spearritt confirmed verbally with Mr. Hinkley about once a month that a complete copy of all source code was available on the server. Mr. Spearritt's own checks appear to have confirmed that source code was being saved on Redrock's server in a compressed file. This evidence demonstrates the confusion caused by Mr. Hinkley's failure properly to clarify his understanding of the status of the library notwithstanding that he was specifically directed to back up all source code in circumstances where the inability to access it had meant that changes could not be made to SPFS. Here was the perfect opportunity for Mr. Hinkley to explain to Redrock, if his position was then as he now contends, that in requiring him to back up the library or (which, as Mr. Hinkley must have realised, Redrock necessarily assumed was the same thing) to back up "each piece of production software", Redrock was requiring him to back up something copyright in which resided with Mr. Hinkley.

Dessert Rose
May 17, 2004

awoken in control of a lucid deep dream...

that language is impenetrable, what the hell actually happened, i'm not going to spend precious minutes deciphering it without context

Dessert Rose
May 17, 2004

awoken in control of a lucid deep dream...
like what the gently caress, at least link to it, now i'm curious and i can't find what you're quoting from

Stringent
Dec 22, 2004


image text goes here

Snapchat A Titty posted:

i leave in log statements commented out cause im lazy as poo poo and its easy to uncomment them when something is being weird

that's different I'm talking like dozen line blocks just sitting there commented out

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Snapchat A Titty posted:

This evidence demonstrates the confusion caused by Mr. Hinkley's failure properly to clarify his understanding of the status of the library notwithstanding that he was specifically directed to back up all source code in circumstances where the inability to access it had meant that changes could not be made to SPFS. Here was the perfect opportunity for Mr. Hinkley to explain to Redrock, if his position was then as he now contends, that in requiring him to back up the library or (which, as Mr. Hinkley must have realised, Redrock necessarily assumed was the same thing) to back up "each piece of production software", Redrock was requiring him to back up something copyright in which resided with Mr. Hinkley.

is that english?

brap
Aug 23, 2004

Grimey Drawer
if you have some poo poo you worked on in more than one sitting and it's not source controlled then welp

tef
May 30, 2004

-> some l-system crap ->

Jonny 290 posted:

motorola was actually a relatively agile shop but the paperwork was 110% waterfall so what we would do is sneak out deploys every other week and then every quarter we had to collude with walmart and lie on our reports to make it look like big waterfall projects

i love it when a plan comes together

tef
May 30, 2004

-> some l-system crap ->
lots of poo poo in so many broken places gets done through a conspiracy, and it is fun to do

nice one jonny

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

prefect posted:

is spring mvc something that could be considered "ruby on rails", but for java? :downs:

it's just as much a wannabe WebObjects as Ruby on Rails or ASP.NET MVC is

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

jony ive aces posted:

but i like how

:agreed: though; i was always taught write "self-commenting" code. it's different i guess for people who are just learning and can't read code well but if someone competent can't read through it it's really badly written

it helps if you use a language like Smalltalk, Objective-C, or Swift, or even Common Lisp or Python, where the language actually supports keyword arguments at some level so you can have "syntactically significant" comments.

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



Dessert Rose posted:

that language is impenetrable, what the hell actually happened, i'm not going to spend precious minutes deciphering it without context

its from the hotline (the 90s mac bbs/piracy app) case

i bolded relevant lines but yoscss makes that virtually impossible to see

quote:

Mr. Hinkley was unable to make a change to SPFS because he was unable to locate all the source code

Mr. Spearritt confirmed verbally with Mr. Hinkley about once a month that a complete copy of all source code was available on the server. Mr. Spearritt's own checks appear to have confirmed that source code was being saved on Redrock's server in a compressed file.

so pretty much literally source19950204new.zip

Soricidus
Oct 21, 2010
freedom-hating statist shill

Snapchat A Titty posted:

i leave in log statements commented out cause im lazy as poo poo and its easy to uncomment them when something is being weird

your log statements are supposed to stay in period, not commented out at all. then you just configure the logger according to how much detail you need at the time and it enables/disables them for you without you having to touch the source code.

Shaggar
Apr 26, 2006
the only thing wrt logging is that you have to be careful about avoiding things that cost resources even when a logging statement is for a lower level than configured.

ex:
C# code:
var boner=...
var butt=...
logger.debug("The boner value is "+boner+" the butt value is "+butt);
incurs a cost of concatenating the 4 strings even when logging level is above debug because the level filtering doesn't happen until inside the debug method. The strings are concatenated, passed to the debug method, and then filtering throws it away.

C# code:
var boner=...
var butt=...
logger.debug("The boner value is {0} the butt value is {1}",boner, butt);
This is how to do it correctly in NLog in c# (and SLF4J has a similar thing in java). The 2 strings are passed to the debug method and then they are only combined if the logging level filter includes debug, thus avoiding the additional cost when the level is above debug.

Even if your project is small getting into the habit of using string format style logging (or just string formatting in general) is a good idea cause it becomes second nature and you just avoid the problem entirely.


Similarly if you have some expensive operation involved in debugging you can surround it with a filter to prevent its use when it should be filtered
ex:
C# code:
var boner = ...
var bonerHash = calculateHash(boner);
logger.debug(The boner hash is {0}",bonerHash);
...do other stuff
should instead be written as
C# code:
var boner = ...
if(logger.IsDebug)
{
	var bonerHash = calculateHash(boner);
	logger.debug(The boner hash is {0}",bonerHash);
}
...do other stuff

triple sulk
Sep 17, 2014



Shaggar posted:

the only thing wrt logging is that you have to be careful about avoiding things that cost resources even when a logging statement is for a lower level than configured.

ex:
C# code:

var boner=...
var butt=...
logger.debug("The boner value is "+boner+" the butt value is "+butt);
incurs a cost of concatenating the 4 strings even when logging level is above debug because the level filtering doesn't happen until inside the debug method. The strings are concatenated, passed to the debug method, and then filtering throws it away.

C# code:

var boner=...
var butt=...
logger.debug("The boner value is {0} the butt value is {1}",boner, butt);
This is how to do it correctly in NLog in c# (and SLF4J has a similar thing in java). The 2 strings are passed to the debug method and then they are only combined if the logging level filter includes debug, thus avoiding the additional cost when the level is above debug.

Even if your project is small getting into the habit of using string format style logging (or just string formatting in general) is a good idea cause it becomes second nature and you just avoid the problem entirely.


Similarly if you have some expensive operation involved in debugging you can surround it with a filter to prevent its use when it should be filtered
ex:
C# code:

var boner = ...
var bonerHash = calculateHash(boner);
logger.debug(The boner hash is {0}",bonerHash);
...do other stuff
should instead be written as
C# code:

var boner = ...
if(logger.IsDebug)
{
	var bonerHash = calculateHash(boner);
	logger.debug(The boner hash is {0}",bonerHash);
}
...do other stuff

thank u Shaggar for this informative post. as a fledgling c# programmer this is v good to know.

Shaggar is also in my autocorrect dictionary now

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS

Shaggar posted:

Similarly if you have some expensive operation involved in debugging you can surround it with a filter to prevent its use when it should be filtered
ex:
C# code:
var boner = ...
var bonerHash = calculateHash(boner);
logger.debug(The boner hash is {0}",bonerHash);
...do other stuff
should instead be written as
C# code:
var boner = ...
if(logger.IsDebug)
{
	var bonerHash = calculateHash(boner);
	logger.debug(The boner hash is {0}",bonerHash);
}
...do other stuff

Why couldn't you do
C# code:
logger.debug("The boner hash is {0}", calculateHash(boner));
assuming that calculateHash returns a type that has a string representation?

Does C# execute calculateHash() and then passes the result to logger.debug or does it pass the unexecuted function?

comedyblissoption
Mar 15, 2006

'agile' means a million different things and is almost a meaningless word now

but developing software iteratively and in a bunch of prioritized small steps of actually working software w/ a feedback loop is generally a better idea than a giant bike-shedding big design up front with little feedback during a long period of development

comedyblissoption
Mar 15, 2006

A better method for debug logs of expensive operations in c#:

code:
logger.Debug("The boner hash is {0}", () => calculateHash(boner));
ILogger.Debug should only log and run the calculateHash function when you have appropriate application configuration settings to enable debug logging. You need the second parameter to be a Func<string> so that it will only run the expensive operation when you have debug logging enabled. Since C# uses strict evaluation, not using a Func here will cause the expensive calculateHash function to be ran even if youre not in debug mode.

tef
May 30, 2004

-> some l-system crap ->
this is great until some gently caress puts a side effect in a log statement

comedyblissoption
Mar 15, 2006

Note that the above would require something like:
code:
interface ILogger {
  Debug(string formatString, params Func<string>[] lazyStrings);
}
A much simpler interface would probably be:
code:
interface ILogger {
  Debug(Func<string> lazyString);
}
And you would invoke it like:
code:
logger.Debug(() => String.Format("The boner hash is {0}", calculateHash(boner)));
But if youre almost always using String.Format it's a bunch of ugly boilerplate much like an if conditional that people can easily forget.

comedyblissoption fucked around with this message at 23:37 on Feb 28, 2015

comedyblissoption
Mar 15, 2006

tef posted:

this is great until some gently caress puts a side effect in a log statement
If you're using a language that allows side effects for a function that returns string (which is basically everything except haskell and other pure-langs), you always have this problem. There's nothing you can do in those languages to prevent some idiot from printing paper in a CalculateTax method.

Note that since C# has overloading, you can always provide an ILogger.Debug that takes actual strings and not lazy strings.

Using a lazy string as an overload of the ILogger.Debug for expensive computations is a better approach than requiring everyone to always remember to wrap their logger.debug in an if conditional.

brap
Aug 23, 2004

Grimey Drawer
bikeshedding megathread

Adbot
ADBOT LOVES YOU

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS

comedyblissoption posted:

Note that the above would require something like:
code:
interface ILogger {
  Debug(string formatString, params Func<string>[] lazyStrings);
}
A much simpler interface would probably be:
code:
interface ILogger {
  Debug(Func<string> lazyString);
}
And you would invoke it like:
code:
logger.Debug(() => String.Format("The boner hash is {0}", bonerHash));
But if youre almost always using String.Format it's a bunch of ugly boilerplate much like an if conditional that people can easily forget.

this is what i was thinking. forgot about the Func type

  • Locked thread