• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 21:49
CEST 03:49
KST 10:49
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
[ASL19] Finals Recap: Standing Tall5HomeStory Cup 27 - Info & Preview18Classic wins Code S Season 2 (2025)16Code S RO4 & Finals Preview: herO, Rogue, Classic, GuMiho0TL Team Map Contest #5: Presented by Monster Energy6
Community News
Flash Announces Hiatus From ASL38Weekly Cups (June 23-29): Reynor in world title form?12FEL Cracov 2025 (July 27) - $8000 live event16Esports World Cup 2025 - Final Player Roster14Weekly Cups (June 16-22): Clem strikes back1
StarCraft 2
General
The SCII GOAT: A statistical Evaluation Weekly Cups (June 23-29): Reynor in world title form? StarCraft Mass Recall: SC1 campaigns on SC2 thread How does the number of casters affect your enjoyment of esports? Esports World Cup 2025 - Final Player Roster
Tourneys
$5,100+ SEL Season 2 Championship (SC: Evo) FEL Cracov 2025 (July 27) - $8000 live event HomeStory Cup 27 (June 27-29) WardiTV Mondays SOOPer7s Showmatches 2025
Strategy
How did i lose this ZvP, whats the proper response Simple Questions Simple Answers
Custom Maps
[UMS] Zillion Zerglings
External Content
Mutation # 480 Moths to the Flame Mutation # 479 Worn Out Welcome Mutation # 478 Instant Karma Mutation # 477 Slow and Steady
Brood War
General
Help: rep cant save Flash Announces Hiatus From ASL BGH Auto Balance -> http://bghmmr.eu/ [ASL19] Finals Recap: Standing Tall Where did Hovz go?
Tourneys
[Megathread] Daily Proleagues [BSL20] GosuLeague RO16 - Tue & Wed 20:00+CET The Casual Games of the Week Thread [BSL20] ProLeague LB Final - Saturday 20:00 CET
Strategy
Simple Questions, Simple Answers I am doing this better than progamers do.
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread Path of Exile What do you want from future RTS games? Beyond All Reason
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread Vanilla Mini Mafia
Community
General
Things Aren’t Peaceful in Palestine Trading/Investing Thread US Politics Mega-thread The Games Industry And ATVI Stop Killing Games - European Citizens Initiative
Fan Clubs
SKT1 Classic Fan Club! Maru Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece [\m/] Heavy Metal Thread Korean Music Discussion
Sports
2024 - 2025 Football Thread NBA General Discussion Formula 1 Discussion TeamLiquid Health and Fitness Initiative For 2023 NHL Playoffs 2024
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List
Blogs
from making sc maps to makin…
Husyelt
Blog #2
tankgirl
Game Sound vs. Music: The Im…
TrAiDoS
StarCraft improvement
iopq
Heero Yuy & the Tax…
KrillinFromwales
Trip to the Zoo
micronesia
Customize Sidebar...

Website Feedback

Closed Threads



Active: 552 users

The Big Programming Thread - Page 898

Forum Index > General Forum
Post a Reply
Prev 1 896 897 898 899 900 1031 Next
Thread Rules
1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution.
2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20)
3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible.
4. Use [code] tags to format code blocks.
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
Last Edited: 2017-07-08 23:42:06
July 08 2017 23:40 GMT
#17941
On July 07 2017 09:08 berated- wrote:
Show nested quote +
On July 07 2017 08:30 Blisse wrote:
Thoughts? A coworker merges a PR where you completely disagreed with their implementation. One senior/not-really person OK'd the PR but he never leaves comments. How would you handle this?


Can you verbalize all the reasons you disagree with their implementation? How much code are we talking about? If it's under a couple hours work, I generally try to rework it in the way that I think that it should be done differently without pushing any code off hours. This has a couple benefits, if you figure out along the way that you've missed some assumptions that are actual trade offs that they already considered, you did so without putting your foot in your mouth first. It also provides the benefit that if it works out as you expected then you would now have a talking point that you can approach, I saw your code but was curious did you consider x or y?

Either way, hopefully you work in an environment where you can freely and openly question why things are done. Seek to understand why they did it their way instead of imposing your own way. If you really think you know better then you should be able to ask them questions that lead them to your own conclusion without making any statements making them defensive. I personally also like to have these meetings 1 on 1 to make people feel less vulnerable and less likely to get defensive.


Sorry my response took so long. The change was very straightforward.


void function() {

string a;
if (condition) {

// BEGIN NEW CODE
if (condition) {
doSomething
doSomethingElse
return
}
// END NEW CODE

a = some a
} else {
a = other a
}

string b;
if (condition) {
b = some b
}

call(a, b, c, ...)
}


Simplified code of course, but basically the exact control flow. I agree with and attempt to try all of your suggestions (minus coding it myself to test, as I think asking them why they couldn't do it my other way works similarly) if this was an architectural or over-reaching change, but this was a straightforward change in one function that affected control flow that I feel could've been integrated much better. Now there's just an arbitrary short circuit.

I think I'm more annoyed with upstream things being: the one coworker doesn't seem to give much feedback in PRs when he approves them, and that the PR was merged early by my coworker when there was still ongoing questions about the PR.

Plus I was kind of annoyed the coworker's reasoning for putting the code there was that "it would be faster". I think I understand why he thinks so, as he's coming from embedded.
There is no one like you in the universe.
phar
Profile Joined August 2011
United States1080 Posts
July 11 2017 01:50 GMT
#17942
I mean if you have no real code review policy at your company, there's not much you can do, save for go back and change it yourself later. Not really worth the bad blood and stress over such a small thing. There's nothing horribly wrong with that code. If you sent in a comment on their change and they didn't take your advice, you kinda just have to move on.
Who after all is today speaking about the destruction of the Armenians?
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
July 11 2017 06:34 GMT
#17943
We do have a code review policy. It's one approval. 2 people who left feedback (me + coworker) didn't approve it. A third reviewer approved it but didn't leave feedback. I believe the root problem is the one coworker who approves things but never leaves any feedback and I asked my manager about it.

Also, the code adds unnecessary nesting and an abrupt change in control flow. Just generally lowers the quality of the codebase. I happily push back against that. I disagree with the idea of moving on instead of fixing the root problems, though I can understand if it sounds like I'm nitpicking on small details.
There is no one like you in the universe.
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
July 11 2017 16:00 GMT
#17944
So if someone accepts it that overrides the explicit disapproval of 2 other people? Or did you just not approve it as in not say whether it was ok or not?
If you have a good reason to disagree with the above, please tell me. Thank you.
Blitzkrieg0
Profile Blog Joined August 2010
United States13132 Posts
July 11 2017 16:16 GMT
#17945
On July 12 2017 01:00 spinesheath wrote:
So if someone accepts it that overrides the explicit disapproval of 2 other people? Or did you just not approve it as in not say whether it was ok or not?


The approver who doesn't leave feedback is the real problem. Seems like someone is just pushing buttons instead of actually reviewing the pull request.
I'll always be your shadow and veil your eyes from states of ain soph aur.
berated-
Profile Blog Joined February 2007
United States1134 Posts
July 11 2017 21:45 GMT
#17946
On July 11 2017 15:34 Blisse wrote:
We do have a code review policy. It's one approval. 2 people who left feedback (me + coworker) didn't approve it. A third reviewer approved it but didn't leave feedback. I believe the root problem is the one coworker who approves things but never leaves any feedback and I asked my manager about it.

Also, the code adds unnecessary nesting and an abrupt change in control flow. Just generally lowers the quality of the codebase. I happily push back against that. I disagree with the idea of moving on instead of fixing the root problems, though I can understand if it sounds like I'm nitpicking on small details.


Do you guys use tools that measure cyclomatic complexity? If not, then, it feels like "unnecessary nesting" is a matter of opinion vs fact. If you do, and it didn't trigger violations, then I would start to lean towards being overly nitpicky.

Sucks that someone can approve when other people bring up concerns without any sort of explanation at all.
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
Last Edited: 2017-07-11 23:12:50
July 11 2017 22:55 GMT
#17947
Good point about cyclomatic complexity. If it were measured, it'd be easy to point out in a numbers game, though I wouldn't want to work at a place that had strict policies like that.

Regarding the code, I just haven't heard a satisfactory argument re: how it's not objectively worse. If there was worry about speed (which there is not) we could just early return at the top. The existing function has a flat, logical structure to each block of code. The new code adds nesting complexity and breaks the intended logic in each code block.

I can live with the code -- given next time (unlikely) I work in the area I'll opportunistically refactor it, but there were larger factors in play, and complaining about it here is useful for narrowing down exactly what I was annoyed with :p




I think the Approval/Decline system (we use Bitbucket) is relaxed because being too strict is bad for developer morale. But not being strict can lead to moments of disagreement like this. I've worked at places where you'd tag the PR as "Needs Improvement" and wouldn't be okay to merge until that tag was removed. Good for enforcing your disagreement is heard, bad for contributing to the PR if you don't feel like stamping the PR with a giant red flag.
There is no one like you in the universe.
netherh
Profile Blog Joined November 2011
United Kingdom333 Posts
July 14 2017 12:06 GMT
#17948
On July 12 2017 07:55 Blisse wrote:
Regarding the code, I just haven't heard a satisfactory argument re: how it's not objectively worse. If there was worry about speed (which there is not) we could just early return at the top. The existing function has a flat, logical structure to each block of code. The new code adds nesting complexity and breaks the intended logic in each code block.


I think part of the problem is that the existing code is substandard too (or at least not defensively written). It's declaring a variable outside a scope, then doing a bunch of logic to populate the string (or not?), and then repeat. This "pattern" should actually be enforced in code by splitting it into separate functions. That way it's easier to understand, and a lot harder to change it "incorrectly". e.g.


void function()
{
string a = calculateA();
string b = calculateB();
call(a, b, ...);
}


Now you can't mess with the control flow of "function()" while calculating "a", unless you do something drastic.
sabas123
Profile Blog Joined December 2010
Netherlands3122 Posts
July 14 2017 14:14 GMT
#17949
On July 12 2017 06:45 berated- wrote:
Show nested quote +
On July 11 2017 15:34 Blisse wrote:
We do have a code review policy. It's one approval. 2 people who left feedback (me + coworker) didn't approve it. A third reviewer approved it but didn't leave feedback. I believe the root problem is the one coworker who approves things but never leaves any feedback and I asked my manager about it.

Also, the code adds unnecessary nesting and an abrupt change in control flow. Just generally lowers the quality of the codebase. I happily push back against that. I disagree with the idea of moving on instead of fixing the root problems, though I can understand if it sounds like I'm nitpicking on small details.


Do you guys use tools that measure cyclomatic complexity? If not, then, it feels like "unnecessary nesting" is a matter of opinion vs fact. If you do, and it didn't trigger violations, then I would start to lean towards being overly nitpicky.

Sucks that someone can approve when other people bring up concerns without any sort of explanation at all.

Even if you use tools for computing cyclomatic complexity, you still run into a lot of murky areas for instance I don't think its possible convincing someone that a cyclomatic complexity of 10 is a generally a bad thing without resorting to opinions.

The harder it becomes, the more you should focus on the basics.
aRyuujin
Profile Blog Joined January 2011
United States5049 Posts
July 14 2017 15:46 GMT
#17950
Anyone have insight on using Gower distance + a hierarchical clustering method vs using k-prototypes for clustering mixed categorical + continuous data?
can i get my estro logo back pls
berated-
Profile Blog Joined February 2007
United States1134 Posts
Last Edited: 2017-07-14 21:07:29
July 14 2017 21:06 GMT
#17951
On July 14 2017 23:14 sabas123 wrote:
Show nested quote +
On July 12 2017 06:45 berated- wrote:
On July 11 2017 15:34 Blisse wrote:
We do have a code review policy. It's one approval. 2 people who left feedback (me + coworker) didn't approve it. A third reviewer approved it but didn't leave feedback. I believe the root problem is the one coworker who approves things but never leaves any feedback and I asked my manager about it.

Also, the code adds unnecessary nesting and an abrupt change in control flow. Just generally lowers the quality of the codebase. I happily push back against that. I disagree with the idea of moving on instead of fixing the root problems, though I can understand if it sounds like I'm nitpicking on small details.


Do you guys use tools that measure cyclomatic complexity? If not, then, it feels like "unnecessary nesting" is a matter of opinion vs fact. If you do, and it didn't trigger violations, then I would start to lean towards being overly nitpicky.

Sucks that someone can approve when other people bring up concerns without any sort of explanation at all.

Even if you use tools for computing cyclomatic complexity, you still run into a lot of murky areas for instance I don't think its possible convincing someone that a cyclomatic complexity of 10 is a generally a bad thing without resorting to opinions.



Sure but at least there are guidelines around when you should maybe start to have conversations and bring in more view points -- and when someone might be just being picky for not a lot of gain. Programming is so much about trade offs that there is rarely a one size fits all. I definitely agree with you though.
BluzMan
Profile Blog Joined April 2006
Russian Federation4235 Posts
July 14 2017 23:29 GMT
#17952
On July 14 2017 21:06 netherh wrote:
Show nested quote +
On July 12 2017 07:55 Blisse wrote:
Regarding the code, I just haven't heard a satisfactory argument re: how it's not objectively worse. If there was worry about speed (which there is not) we could just early return at the top. The existing function has a flat, logical structure to each block of code. The new code adds nesting complexity and breaks the intended logic in each code block.


I think part of the problem is that the existing code is substandard too (or at least not defensively written). It's declaring a variable outside a scope, then doing a bunch of logic to populate the string (or not?), and then repeat. This "pattern" should actually be enforced in code by splitting it into separate functions. That way it's easier to understand, and a lot harder to change it "incorrectly". e.g.


void function()
{
string a = calculateA();
string b = calculateB();
call(a, b, ...);
}


Now you can't mess with the control flow of "function()" while calculating "a", unless you do something drastic.


Funnily enough, I find this code pretty bad because it makes me think:
- Is a used anywhere else? Is b? Why are they variables? Am I missing something?
Almost unavoidable in a messy language like Java, but there's no excuse for that in C or C++.
You want 20 good men, but you need a bad pussy.
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
Last Edited: 2017-07-14 23:54:54
July 14 2017 23:44 GMT
#17953
On July 15 2017 08:29 BluzMan wrote:
Show nested quote +
On July 14 2017 21:06 netherh wrote:
On July 12 2017 07:55 Blisse wrote:
Regarding the code, I just haven't heard a satisfactory argument re: how it's not objectively worse. If there was worry about speed (which there is not) we could just early return at the top. The existing function has a flat, logical structure to each block of code. The new code adds nesting complexity and breaks the intended logic in each code block.


I think part of the problem is that the existing code is substandard too (or at least not defensively written). It's declaring a variable outside a scope, then doing a bunch of logic to populate the string (or not?), and then repeat. This "pattern" should actually be enforced in code by splitting it into separate functions. That way it's easier to understand, and a lot harder to change it "incorrectly". e.g.


void function()
{
string a = calculateA();
string b = calculateB();
call(a, b, ...);
}


Now you can't mess with the control flow of "function()" while calculating "a", unless you do something drastic.


Funnily enough, I find this code pretty bad because it makes me think:
- Is a used anywhere else? Is b? Why are they variables? Am I missing something?
Almost unavoidable in a messy language like Java, but there's no excuse for that in C or C++.



And what is your solution for that abstraction in C/C++ that isn't possible in Java... ? Other than exposing methods unnecessarily it looks.. fine?
There is no one like you in the universe.
Manit0u
Profile Blog Joined August 2004
Poland17242 Posts
Last Edited: 2017-07-17 01:05:14
July 17 2017 01:00 GMT
#17954
On July 15 2017 08:44 Blisse wrote:
Show nested quote +
On July 15 2017 08:29 BluzMan wrote:
On July 14 2017 21:06 netherh wrote:
On July 12 2017 07:55 Blisse wrote:
Regarding the code, I just haven't heard a satisfactory argument re: how it's not objectively worse. If there was worry about speed (which there is not) we could just early return at the top. The existing function has a flat, logical structure to each block of code. The new code adds nesting complexity and breaks the intended logic in each code block.


I think part of the problem is that the existing code is substandard too (or at least not defensively written). It's declaring a variable outside a scope, then doing a bunch of logic to populate the string (or not?), and then repeat. This "pattern" should actually be enforced in code by splitting it into separate functions. That way it's easier to understand, and a lot harder to change it "incorrectly". e.g.


void function()
{
string a = calculateA();
string b = calculateB();
call(a, b, ...);
}


Now you can't mess with the control flow of "function()" while calculating "a", unless you do something drastic.


Funnily enough, I find this code pretty bad because it makes me think:
- Is a used anywhere else? Is b? Why are they variables? Am I missing something?
Almost unavoidable in a messy language like Java, but there's no excuse for that in C or C++.



And what is your solution for that abstraction in C/C++ that isn't possible in Java... ? Other than exposing methods unnecessarily it looks.. fine?


I believe that he'd like it to look like that:


void callSomeMethods()
{
call(calculateA(), calculateB(), ...);
}


Also, Java since version 8 became much less of a mess (it just needs more type inference and getting rid of primitives like they did in Scala).
Time is precious. Waste it wisely.
MrBrokenPenis
Profile Joined July 2017
3 Posts
July 17 2017 15:18 GMT
#17955
I hope this is the right place to post this.
Is there any library or API to get your opponents name at the start of a SCII match?
Would prefer python, if possible
IyMoon
Profile Joined April 2016
United States1249 Posts
July 17 2017 15:24 GMT
#17956
On July 18 2017 00:18 MrBrokenPenis wrote:
I hope this is the right place to post this.
Is there any library or API to get your opponents name at the start of a SCII match?
Would prefer python, if possible


Doesn't the name just show up? It has been awhile since I played SC2 but doesn't your handle just come up on load screen?

Or are you talking about your real name that you register Bnet with?
Something witty
MrBrokenPenis
Profile Joined July 2017
3 Posts
July 17 2017 15:47 GMT
#17957
No, I would like to have script running, that grabs the name of my opponent
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
Last Edited: 2017-07-17 21:10:19
July 17 2017 21:10 GMT
#17958
You'll probably get banned by Blizzard for using third-party things to read their game data. Against ToS most likely. If you want opponent data just use the SC2 api https://dev.battle.net/io-docs
There is no one like you in the universe.
Nesserev
Profile Blog Joined January 2011
Belgium2760 Posts
Last Edited: 2017-07-18 06:05:50
July 18 2017 06:03 GMT
#17959
--- Nuked ---
dsyxelic
Profile Joined May 2010
United States1417 Posts
July 19 2017 01:02 GMT
#17960
can anyone help a c noob?
--
say there is a text file with a string, say "abcdefghijk"

read in that file and delete a substring from it (have file update the new string)
--
is there a very simple way to do this?

so far all I got is fopen with the r+ mode and fgetc which doesn't seem to be what i'm looking for..

any easy to read resource or pointers(heh) for the best approach would be greatly appreciated. I've only gotten around to parsing individual strings from file or going by each character, but not substrings :/
TL/SKT
Prev 1 896 897 898 899 900 1031 Next
Please log in or register to reply.
Live Events Refresh
Replay Cast
00:00
HSC 27: Groups A & B
CranKy Ducklings112
Liquipedia
OSC
20:00
Mid Season Playoffs
Gerald vs MojaLIVE!
ArT vs Jumy
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
NeuroSwarm 133
Nina 130
RuFF_SC2 119
Vindicta 57
CosmosSc2 55
PiGStarcraft13
StarCraft: Brood War
Artosis 788
Aegong 107
NaDa 61
Icarus 11
Dota 2
monkeys_forever129
capcasts124
League of Legends
JimRising 662
Super Smash Bros
hungrybox820
Heroes of the Storm
Khaldor117
Other Games
summit1g10174
tarik_tv2122
Day[9].tv929
shahzam557
Maynarde139
Mew2King52
Organizations
Other Games
gamesdonequick1564
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 16 non-featured ]
StarCraft 2
• Berry_CruncH286
• Hupsaiya 55
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Doublelift5142
• Jankos1384
• masondota2788
Other Games
• Day9tv929
Upcoming Events
The PondCast
8h 11m
RSL Revival
8h 11m
ByuN vs Classic
Clem vs Cham
WardiTV European League
14h 11m
Replay Cast
22h 11m
RSL Revival
1d 8h
herO vs SHIN
Reynor vs Cure
WardiTV European League
1d 14h
FEL
1d 14h
Korean StarCraft League
2 days
CranKy Ducklings
2 days
RSL Revival
2 days
[ Show More ]
FEL
2 days
Sparkling Tuna Cup
3 days
RSL Revival
3 days
FEL
3 days
BSL: ProLeague
3 days
Dewalt vs Bonyth
Replay Cast
4 days
Replay Cast
5 days
The PondCast
6 days
Replay Cast
6 days
Liquipedia Results

Completed

Proleague 2025-06-28
HSC XXVII
Heroes 10 EU

Ongoing

JPL Season 2
BSL 2v2 Season 3
BSL Season 20
Acropolis #3
KCM Race Survival 2025 Season 2
CSL 17: 2025 SUMMER
Copa Latinoamericana 4
Championship of Russia 2025
RSL Revival: Season 1
Murky Cup #2
BLAST.tv Austin Major 2025
ESL Impact League Season 7
IEM Dallas 2025
PGL Astana 2025
Asian Champions League '25
BLAST Rivals Spring 2025
MESA Nomadic Masters
CCT Season 2 Global Finals
IEM Melbourne 2025
YaLLa Compass Qatar 2025

Upcoming

CSLPRO Last Chance 2025
CSLPRO Chat StarLAN 3
K-Championship
uThermal 2v2 Main Event
SEL Season 2 Championship
FEL Cracov 2025
Esports World Cup 2025
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025
FISSURE Playground #1
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2025 TLnet. All Rights Reserved.