The Official Status Thread
-
@Tsaukpaetra said in The Official Status Thread:
@Gribnit said in The Official Status Thread:
@Tsaukpaetra said in The Official Status Thread:
@Gribnit said in The Official Status Thread:
@Tsaukpaetra said in The Official Status Thread:
@Gribnit said in The Official Status Thread:
@Tsaukpaetra said in The Official Status Thread:
do I?
Do you?
I don't know enough to respond confidently...
that's not actually possible. stop holding yourself back.
I was told Edging was a Good Thing.
yeah, well, someone would tell you that, wouldn't they.
Wasn't them, I can assure.
Well, it certainly wasn't me, and if it was, you should have known better.
-
@Gribnit said in The Official Status Thread:
@Tsaukpaetra said in The Official Status Thread:
@Gribnit said in The Official Status Thread:
@Tsaukpaetra said in The Official Status Thread:
@Gribnit said in The Official Status Thread:
@Tsaukpaetra said in The Official Status Thread:
@Gribnit said in The Official Status Thread:
@Tsaukpaetra said in The Official Status Thread:
do I?
Do you?
I don't know enough to respond confidently...
that's not actually possible. stop holding yourself back.
I was told Edging was a Good Thing.
yeah, well, someone would tell you that, wouldn't they.
Wasn't them, I can assure.
Well, it certainly wasn't me, and if it was, you should have known better.
Quality control indicates it was not you. Rest easy.
-
@Tsaukpaetra said in The Official Status Thread:
@Gribnit said in The Official Status Thread:
@Tsaukpaetra said in The Official Status Thread:
@Gribnit said in The Official Status Thread:
@Tsaukpaetra said in The Official Status Thread:
@Gribnit said in The Official Status Thread:
@Tsaukpaetra said in The Official Status Thread:
@Gribnit said in The Official Status Thread:
@Tsaukpaetra said in The Official Status Thread:
do I?
Do you?
I don't know enough to respond confidently...
that's not actually possible. stop holding yourself back.
I was told Edging was a Good Thing.
yeah, well, someone would tell you that, wouldn't they.
Wasn't them, I can assure.
Well, it certainly wasn't me, and if it was, you should have known better.
Quality control indicates it was not you. Rest easy.
I wasn't worried...
-
@Gribnit said in The Official Status Thread:
@Tsaukpaetra said in The Official Status Thread:
@Gribnit said in The Official Status Thread:
@Tsaukpaetra said in The Official Status Thread:
@Gribnit said in The Official Status Thread:
@Tsaukpaetra said in The Official Status Thread:
@Gribnit said in The Official Status Thread:
@Tsaukpaetra said in The Official Status Thread:
@Gribnit said in The Official Status Thread:
@Tsaukpaetra said in The Official Status Thread:
do I?
Do you?
I don't know enough to respond confidently...
that's not actually possible. stop holding yourself back.
I was told Edging was a Good Thing.
yeah, well, someone would tell you that, wouldn't they.
Wasn't them, I can assure.
Well, it certainly wasn't me, and if it was, you should have known better.
Quality control indicates it was not you. Rest easy.
I wasn't worried...
Resting isn't only for those who are worried.
-
@Tsaukpaetra Get a room, you two!
-
@Tsaukpaetra said in The Official Status Thread:
@Gribnit said in The Official Status Thread:
@Tsaukpaetra said in The Official Status Thread:
@Gribnit said in The Official Status Thread:
@Tsaukpaetra said in The Official Status Thread:
@Gribnit said in The Official Status Thread:
@Tsaukpaetra said in The Official Status Thread:
@Gribnit said in The Official Status Thread:
@Tsaukpaetra said in The Official Status Thread:
@Gribnit said in The Official Status Thread:
@Tsaukpaetra said in The Official Status Thread:
do I?
Do you?
I don't know enough to respond confidently...
that's not actually possible. stop holding yourself back.
I was told Edging was a Good Thing.
yeah, well, someone would tell you that, wouldn't they.
Wasn't them, I can assure.
Well, it certainly wasn't me, and if it was, you should have known better.
Quality control indicates it was not you. Rest easy.
I wasn't worried...
Resting isn't only for those who are worried.
True. Let's just say it's not for me.
-
@HardwareGeek said in The Official Status Thread:
@Tsaukpaetra Get a room, you two!
@Gribnit is an exhibitionist, that would be counterproductive.
-
@Tsaukpaetra said in The Official Status Thread:
@Gribnit is an exhibitionist
Getting off on exposing your stupidity to the public is a slightly different definition of that word than I am accustomed to, but ok. Unless he engages in the more traditional sort of exhibitionism, too, but if so, I don't want to know, or even think, about it.
-
@HardwareGeek said in The Official Status Thread:
think
-
-
@dcon nothing more than feelings?
-
Status: Encountering a naming conundrum involving a column that's effectively the table ID but actually isn't the primary key, and having to refer to both...
Basically:
DeviceTable:
id: int
DeviceId: charWhat should I name the function to find entries by the DeviceId column?
getDeviceByDeviceId
?
-
@Tsaukpaetra said in The Official Status Thread:
Status: Encountering a naming conundrum involving a column that's effectively the table ID but actually isn't the primary key, and having to refer to both...
Basically:
DeviceTable:
id: int
DeviceId: charWhat should I name the function to find entries by the DeviceId column?
getDeviceByDeviceId
?Or you could go for the more Modern approach and just pick a name out of a hat. Maybe
getFriendshipWithRainbows
?
-
@Tsaukpaetra you'll want to make sure the name describes the query, if you're using some sort of query-generating abomination. I would go ahead and use
getDeviceByNaturalId
andgetDeviceBySyntheticId
if I wanted to be reasonable.
-
@Gribnit said in The Official Status Thread:
if I wanted to be reasonable.
I'm just going to use
getDevice
andgetSpecificDevice
. To be maximally confusing.
-
@Tsaukpaetra said in The Official Status Thread:
@Gribnit said in The Official Status Thread:
if I wanted to be reasonable.
I'm just going to use
getDevice
andgetSpecificDevice
. To be maximally confusing.Consider also the fun in requiring both. Really fast lookups that way.
However, requiring both is a slippery slope towards using whichever is provided like a helpful sort of entity of some kind.
What about overloading by type? Haven't you got overloading by type? Then they can both be
getDeviceById(1)
.Then you can provide both orderings of
getDeviceById(2)
too, if you want.
-
@Gribnit said in The Official Status Thread:
both.
Well, really, the only time you want to get by the primary key is if you want a specific device. There is the possibility that multiple of the same device may be present in the table but never more than one active with said device Id (and the other entries marked as 'inactive' by way of soft-deletion). So, in theory, under normal usages, the SpecificDevice call will not likely be called.
Will find out when I get to the reporting portion, which is what's driving this entire exercise (in that, there is currently no tracking or metrics of any kind for devices and what they're doing).
-
@Tsaukpaetra said in The Official Status Thread:
@Gribnit said in The Official Status Thread:
both.
Well, really, the only time you want to get by the primary key is if you want a specific device. There is the possibility that multiple of the same device may be present in the table but never more than one active with said device Id (and the other entries marked as 'inactive' by way of soft-deletion). So, in theory, under normal usages, the SpecificDevice call will not likely be called.
Will find out when I get to the reporting portion, which is what's driving this entire exercise (in that, there is currently no tracking or metrics of any kind for devices and what they're doing).
As long as your indexing is equivalent it's the same. Both is not any kind of sane idea until the indexes are both very large and there's benefit in (freaking) joining them. It'd just be a dickbag way to build the API. But, if you have overloading, it'd be reasonable to use it here for a single unary method, since they do the same thing only differing by type like... an... overload...
Does this ecosystem have a Prometheus implementation?
-
@Gribnit said in The Official Status Thread:
As long as your indexing is equivalent it's the same.
This is apparently the indexes it created automagically.
Not sure why it created two indexes for the key, but whatever...
-
@Tsaukpaetra said in The Official Status Thread:
@Gribnit said in The Official Status Thread:
As long as your indexing is equivalent it's the same.
This is apparently the indexes it created automagically.
Not sure why it created two indexes for the key, but whatever...
Cool. Now you'll want to relate data to the synthetic key in cases described starting with even numbered letters, and the natural in the remaining cases. This guarantees even index access utilization bitwise sharding parity.
Is this is a real database of some kind, or SQL Server?
ed. you think it's MySql / MariaDb / w/e? I do.
-
status: Taco bell no longer offers quesarrito. Unless it's ordered via the mobile app.
-
@Tsaukpaetra said in The Official Status Thread:
Status: I get feelings when people disable linter options without any apparent reason...
I was curious so I went to look for examples of incorrect code according to those rules.
function doStuff() { if (x) { return y; } else if (z) { return w; } else { return t; } }
no-else-return: If an if block contains a return statement, the else block becomes unnecessary. Its contents can be placed outside of the block.
if (condition) { // code which should only ever run under condition } else { // code which should only ever run when not under condition if (anotherCondition) { // ... } else { // ... } } // code which completely disregards condition
no-lonely-if: If an if statement is the only statement in the else block, it is often clearer to use an else if form.
// Any line longer than 80 characters (default), also considering your tab width
max-len:
: The word "width" is too much to the right.
I for one dislike
else
s in the same line as}
, fwiw.
-
@Gribnit said in The Official Status Thread:
@error in Java, you can usefully distinguish types of
null
, which helps somewhat.In Java, as it is a mostly sensible, you can indeed distinguish the types of
null
. It is, however, a pointless task as there is only onenull
.Javascript, with both
null
andundefined
, is the insane one.
-
@Zecc I like this because it visually represents a container. You have to get through the opening (condition) to get into the jar (contents). The
else
is just following the same logic as theif
. It also makes sense in Pascal and VB and SQL where they usebegin
andend
instead of{}
. I try to avoidelseif
unless the language is too stupid to havecase
orswitch
statements (looking at you SQL).if (condition) { return something; } else { return somethingelse; }
You'll also have to take my "return inside else" from my cold head hands.
-
@Tsaukpaetra said in The Official Status Thread:
Status: I get feelings when people disable linter options without any apparent reason...
That's what my cow-orkers used to do with ReSharper warning.
Now, they just ignore it at all... (currently, there are some 4000 warnings in the solution).
-
@Zenith said in The Official Status Thread:
I try to avoid
elseif
unless the language is too stupid to havecase
orswitch
statements (looking at you SQL).CASE x WHEN w1 THEN r1 WHEN w2 THEN r2 ELSE r3 END
-
@dkf
but it doesn't operate like a C-style switch (which I call case statements because I started with Pascal).
-
@Tsaukpaetra said in The Official Status Thread:
What should I name the function to find entries by the DeviceId column? getDeviceByDeviceId?
getDevice**s**ByDeviceId
because that may exist several times in the table...
-
@Zenith said in The Official Status Thread:
but it doesn't operate like a C-style switch
It's good enough.
CASE thing WHEN 1 THEN computeStuff WHEN 2 THEN computeOtherStuff WHEN 3 THEN computeMore ELSE computeDefault END
is conceptually similar to:
switch (thing) { case 1: computeStuff(); break; case 2: computeOtherStuff(); break; case 3: computeMore(); break; default: computeDefault(); break; }
with the main difference being that it is an expression in SQL and not a statement, but stuff in SQL is very much about being expressions so that's not too weird.
-
@dkf said in The Official Status Thread:
@Gribnit said in The Official Status Thread:
@error in Java, you can usefully distinguish types of
null
, which helps somewhat.In Java, as it is a mostly sensible, you can indeed distinguish the types of
null
. It is, however, a pointless task as there is only onenull
.Javascript, with both
null
andundefined
, is the insane one.Not to mention, in JS you can be passed a null array when you were expecting a null string and you'll be none the wiser...
-
@Zecc said in The Official Status Thread:
if (condition) { // code which should only ever run under condition } else { // code which should only ever run when not under condition if (anotherCondition) { // ... } else { // ... } } // code which completely disregards condition
no-lonely-if: If an if statement is the only statement in the else block, it is often clearer to use an else if form.
There's a clear difference IMO. When using a separate if, it is far more clear that
! condition
applies. Using an else if, that is less clear. If all of the code in the firstif
is removed in a future refactor, and the rest is anelse if
, the person refactoring is much more likely to remove the first if completely and not insert the opposite test.I know our corporate style guidelines (which nobody reads, let alone follows) states that else if may only be used if the order of the cases may be freely swapped. That is, the following two blocks should be equivalent:
if( foo ) { // fooCode } else if( bar ) { // barCode } else { // elseCode }
if( bar ) { // barCode } else if( foo ) { // fooCode } else { // elseCode }
-
@BernieTheBernie said in The Official Status Thread:
@Tsaukpaetra said in The Official Status Thread:
What should I name the function to find entries by the DeviceId column? getDeviceByDeviceId?
getDevice**s**ByDeviceId
because that may exist several times in the table...It is expected that only one device of its ID should ever be active, and this method is supposed to return only the advice device (if any).
-
@dkf said in The Official Status Thread:
CASE
Doesn't work for controlling flow. Yes, programming in SQL is
-
@PleegWat said in The Official Status Thread:
There's a clear difference IMO. When using a separate if, it is far more clear that ! condition applies.
True.
I thought I had an argument against it based on the syntax hierarchy tooltip Visual Studio shows when you hover over an indentation. But it stupidly doesn't show the corresponding
if
when you're inside anelse
block, soBut let's imagine a better implementation of this concept which would have worked in my favour.
...
A better implementation could also show all preceding if blocks. Damn it.
Edit: it's worse than I thought. The number of
else
s varies depending on which level of indentation you hover over, for the same line.Edit 2: added artificial cursor to the screenshots for clarity.
-
Also, code folding is a thing that exists in editors.
-
Status: arguing with myself.
It hurt itself in its confusion.
-
-
@Luhmann said in The Official Status Thread:
@Zecc said in The Official Status Thread:
Status: arguing with myself.
Who's winning?
Not even us, since @Zecc wasn’t kind enough to provide a kibitzing feed.
-
-
@loopback0 said in The Official Status Thread:
@izzion said in The Official Status Thread:
kibitzing feed
One of us whooshed, but...
-
@Luhmann said in The Official Status Thread:
@Zecc said in The Official Status Thread:
Status: arguing with myself.
Who's winning?
I'm winning.
-
@Gribnit
We should re-evaluate these KPIs ...
-
@Luhmann said in The Official Status Thread:
@Gribnit
We should re-evaluate these KPIs ...Never re-evaluate the KPIs.
-
@Gribnit
Always re-evaluate the KPIs until they fit your narrative ...
You're new to this management game, aren't you?
-
@Luhmann said in The Official Status Thread:
until they fit your narrative
until they fit your narrative
until they fit your narrative
until they fit your narrative
until they fit your narrative
-
Status: speedpainting.
Done in about one and a half hours. Whew!
Filed under: Eighty points to whomever recognises the content
-
@Tsaukpaetra said in The Official Status Thread:
@Gribnit said in The Official Status Thread:
if I wanted to be reasonable.
I'm just going to use
getDevice
andgetSpecificDevice
. To be maximally confusing.Have one
getDeviceByDeviceId
which is the PK of the table, and anothergetDeviceIdByDeviceId
which takes theDeviceId
and returns the correspondingId
for use ingetDeviceByDeviceId
-
@PleegWat said in The Official Status Thread:
I know our corporate style guidelines (which nobody reads, let alone follows) states that else if may only be used if the order of the cases may be freely swapped.
I wonder what your corporate guidelines would be for match statements in functional languages, as their main use case is to check the patterns sequentially - it's very rare when you can swap pieces around and get the same behavior. E.g.
list match { case [0] => doSomethingWithZero() case [x] => doSomethingWithNonZero() case x :: xs if condition => doSomethingWithAtLeastTwoElements() case other => doSomethingWithEitherAnEmptyListOrConditionFalse() }
The second case must be after the first case or else it matches [0] as well. The third case must be after the second case or else it matches one-element lists as well. The fourth case must be the last because it matches literally anything so anything after that would be dead code.
According to your rules, the equivalent conditional would be:
if (...) { ... } else { if (...) { ... } else { if (...) { ... } else { } } }
At least I don't find it particularly readable.
-
@Gąska ew,
Unit
-
@Gribnit said in The Official Status Thread:
Well, it certainly wasn't me, and if it was, you should have known better.
I'm saving this line for later.