« first day (3798 days earlier)      last day (435 days later) » 

00:13
REFRESH! There are 7054 unanswered questions (90.8743 answered)
 
2 hours later…
02:34
Are inline assignments always bad? I am often told to not have assignments in function calls etc. I can understand a monster line like the one pointed out here being undesirable, but if I have a line with 2 assignments, would that be always bad?
@pacmaninbw I think it's a stretch to say I haven't been using any of the advise. Sure, my code could be made more readable, but at least I'm not using massive single lines with 4 assignments (not counting variable declarations at the beginning of the function) or 1 letter variable names anymore like I used to. I also think the 3rd sentence in the answer is not necessary.
 
2 hours later…
04:51
possible answer invalidation by user16217248 on question by user16217248: codereview.stackexchange.com/posts/287229/revisions
possible answer invalidation by user16217248 on question by user16217248: codereview.stackexchange.com/posts/287229/revisions
possible answer invalidation by user16217248 on question by user16217248: codereview.stackexchange.com/posts/287229/revisions
@Duga chux - Reinstate Monica asked for the definitions of Ptr, Node8 and OP hath provideth them
possible answer invalidation by user16217248 on question by user16217248: codereview.stackexchange.com/posts/287229/revisions
05:06
seems okay but correct me if I'm incorrect - @pacmaninbw
05:48
0
Q: Is there a more efficient way to specify a policy for allowing access to a table through a foreign key?

Nathan OsmanConsider the following two tables in a PostgreSQL database: create table if not exists public.users ( id text primary key, is_staff boolean ); create table if not exists public.issues ( id int primary key, issue_owner text not null references public.users on delete restrict ); alter tab...

 
4 hours later…
09:33
0
Q: A web component for rendering radial pie charts in an HTML canvas

coderoddeIntro In the previous iteration, I was advised to produce a web component. See what I have: Code main.js: 'use strict'; (function() { class TestCanvas extends HTMLElement { #maximumRadius; #startAngle; #emptyRadialPieChartColor; #radialPieChartBackgro...

10:30
Monking
@pacmaninbw Hard, but not too hard IMO.
But the comments they left could be addressed if you want to increase the odds of the advice being picked up.
I'm not fond of your Title Casing, but that has nothing to do with your tone :-)
@user16217248 You can go two paths; "inline assignments are always bad" and never have to think about inline assignments again. Or ramp up the abuse of inline assignments to 11 and over the next 6-8 weeks come to an understanding of what good and bad inline assignments are. The former requires no thinking, the latter requires constant introspection.
 
3 hours later…
13:26
@Phroggie Good advice.
13:45
@SᴀᴍOnᴇᴌᴀ :64486476 I'm not going to roll back or comment on your post edit comment because it didn't cause any answer invalidation and I am glad you added that code. Just keep in mind it breaking Code Review Guidelines.
@user16217248 ^^^^
Readability is one of the most important parts of code. Good code that is in use must be maintained, there will be feature requests and there will probably be bug reports. Would you be able to easily modify this code in 6 months or a year?
I agree with @Phroggie about the inline assignments.
goto all over again.
Ignoring it exists makes your life a lot easier.
Does it have valid use-cases? Sure. Ignoring it exists is the easier approach and the best one in 99,5% of cases.
@Mast I don't even think about it except in assembly. Using goto can only lead to spaghetti code.
@Mast Have you ever used setjmp and longjmp?
@pacmaninbw Assembly doesn't count.
@Mast Interestingly CPython has some really nice goto statements. After seeing CPython's I kinda with Python had goto statements...
kinda wish*
@pacmaninbw Reworked someone's code once that was using it. Essentially I made a flowchart of what happens when and rewrote the flow so the effect was what was intended...
13:57
I first encountered spaghetti code in Fortran and Basic 40 years ago when I was a student at the university.
@Phroggie I had a colleague once that was very good with C but had to learn Python. I helped him along a bit. The code worked, but it was atrocious to modify. So I had to do the same deal as with the jmps :(
Learned a lot from that though.
Actually setjmp and longjmp are so that when the program fails you can still exit the program after cleaning up. Only good use for them. C doesn't have exceptions.
I inherited his code after he left the company and needed to add a couple of functionalities, that's why.
@pacmaninbw Back then I didn't know anything about exceptions either.
And we didn't clean up code in a failed state. We'd raise an error bit and pull the power.
In a lot of embedded shops the mantra "when in doubt, reboot" is heavily practiced.
We were using a 2 computer system, one was the user interface and one was the hardware controller. Had to get error messages to the UI. Power shutdown could destroy user product in silicon probers or device handlers.
Automatic test equipment for VLSI and large memory chips.
If we did any logging, we'd store the messages in EEPROM for debugging back at the factory. Customer would never see them.
14:04
Fabs really don't like losing product in test.
Customer programmed our hardware, they needed to know.
Ah, yea, all embedded hardware I've worked on was programmed by us.
Customers were Intel, Motorola, AMD, Apple, IBM etc.
Some of the industrial hardware wasn't, but that was all PLCs. That's different.
And not the same company.
@Mast Have you ever seen a Teradyne Automatic Test Machine? I worked for them for 16 years.
Never seen one, never used one.
14:12
Teradyne, Inc. is an American automatic test equipment (ATE) designer and manufacturer based in North Reading, Massachusetts. Teradyne's high-profile customers include Samsung, Qualcomm, Intel, Analog Devices, Texas Instruments and IBM. == History == Teradyne was founded by Alex d'Arbeloff and Nick DeWolf, who were classmates at the Massachusetts Institute of Technology (MIT) in the late 1940s. The men founded Teradyne in 1960, and set up shop in rented space above Joe and Nemo's hotdog stand in downtown Boston. The name, Teradyne, was intended to represent a very forceful presence. 1,000,000...
I started there in 1984 in the Semiconductor Test Division.
First tester I worked on was the J941. I worked in the compiler group at that point. 5 years later we stopped writing compilers and I was transferred to the system software group.
I had to slow down the the test speeds for 2 systems we sold to China.
14:55
Please take the tour. In particular note that you should "Avoid questions that are primarily opinion-based" — Whether or not code is "bad" is very much a matter of opinion. Your question might be on-topic over on code review, but it isn't suitable for this site. — Quentin 48 secs ago
15:15
This seems better suited for the Code Review site. — Scott Hunter 41 secs ago
The solution copilot gave you is typical bot garbage – it might "work", but that's not what Eugene was suggesting and wouldn't pass code review — ildjarn 49 secs ago
16:15
0
Q: Pairing with itertools combinations - long code execution on large volume of data

Vasya_ChI am working on the task to get all possible combinations (pairs) of ID's (companies) which participated in one bid and create a new data frame with ID_1, ID_2, matching parameter (tender ID). I have prepared the following two functions which provide me with the required result however the execut...

Monking
@SᴀᴍOnᴇᴌᴀ Personally no great loss. It was interesting the first time.
I agree
we can still bash it...
Dec 13, 2017 at 0:49, by Donald.McLean
@rolfl Winter is stupid. And it smells.
17:57
@SᴀᴍOnᴇᴌᴀ RIP
18:49
19:28
I was told to declare one variable per line and use:
int x = 1;
int y = 2;
Instead of:
int x = 1, y = 2;
But I don't like repeating the int. Would it be acceptable to write int once, but then make each declaration its own line? As in:
int
x = 1,
y = 2;
19:55
@user16217248 "Would it be acceptable to write int once" to who?
To reviewers who find that using multiple declarations per statement/line harms code readibility
Do such people have power over the code?
0
Q: Error Reporting in WPF app

Henners2002I want to add an error reporting feature to my WPF app. I have the view for it created I just need to know when to call it. I am used to web development and this is my first WPF app. ''' public static void Get<T>(Func<T> func, Action<BaseResult<T>> callback, bool report = false){ BaseResult<T> r...

@user16217248 The problem with multiple declarations per line is that it is difficult to modify. If each declaration is on it's own line, then deletion or addition of a variable is much easier.
@Phroggie Not in the instance of an answer on code review, however, in a professional environment where reviews are required and there is a coding standard in place yes such people have power over the code.
@pacmaninbw Do you think I'm incapable to think so far ahead?
20:07
@SᴀᴍOnᴇᴌᴀ 2 users that I miss in this room.
20:25
@Phroggie No, I don't think you are incapable of thinking ahead.
20:53
0
Q: Thread-safe coordinate holder

BulaI have been given a task to create a thread-safe RobotCluster class. The idea is that there's a set of robots operating on multiple threads and they each submit the coordinates of a player each time they see the player in the game. I need to implement the following methods void enterCoordinate(S...

 
2 hours later…
23:00
Note that if you wrote working code (that you came up with, not just copy-pasted), and you want help improving performance, this is not the right place to ask. That's what the Code Review site is for. — Mike 'Pomax' Kamermans 17 secs ago
Note that if you wrote working code (that you came up with, not just copy-pasted), and you want help improving performance, this is not the right place to ask. Instead, that's what the Code Review site is for (but remember to, of course, read their rules on what's on topic and how to ask for help before posting too) — Mike 'Pomax' Kamermans 19 secs ago
@Mike'Pomax'Kamermans Code review and 'find me an algorithm that has better algorithmic performance' are a guns and grandmas situation. Not the same thing. At all. However, I'm not quite sure 'hey, uh, I have this algorithm, which is clearly homework, can someone give me an algorithm that has fastest performance in O(x) terms?' is a good fit for SO. As far as those questions go, this one at least ships with an actual attempt, so, you know. Better than your average 'do my homework for me' style question in this vein. — rzwitserloot 59 secs ago
23:28
As long as they follow the code review rules, and explain what they already tried to improve performance, it's a perfectly fine code review question. Naturally, if it's phrased as "do my work for me" then that's off topic on any stackexchange site. — Mike 'Pomax' Kamermans 10 secs ago

« first day (3798 days earlier)      last day (435 days later) »