Movatterモバイル変換


[0]ホーム

URL:


Sorry, we no longer support your browser
Please upgrade toMicrosoft Edge,Google Chrome, orFirefox. Learn more about ourbrowser support.
Skip to main content

Stack Exchange Network

Stack Exchange network consists of 183 Q&A communities includingStack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Loading…
Code Review

Tag Info

usershotnewsynonyms

Hot answers tagged

24votes
Accepted

FIFO data structure in pure C

None of yourQUEUE_* functions validate their input arguments before using them.NULL pointers will be a problem, particularly ...
bta's user avatar
  • 819
24votes

AsyncDictionary - Can you break thread safety?

The reason why there is no async API for a dictionary is, that all operations on a dictionary are so fast, that there is no need for asynchronicity.For concurrent scenarios there is the thread safe ...
JanDotNet's user avatar
18votes
Accepted

Unit testing Video Service class

Welcome to code review and thanks for sharing your code.When writing UnitTests keep in mind that they are documentation. Test code has less restrictions for identifier names.This means that method ...
Timothy Truckle's user avatar
15votes
Accepted

Triangle area computation and linear transformations

Here are a few of the high- and low-level ideas:too many comments. Remember, comments tend to age and outdate, they need to be maintained as the code changes. And, if they are over-used, they hurt ...
alecxe's user avatar
  • 17.5k
15votes
Accepted

ExactlyOne extension method

Q&A Is the code readable?ExactlyOne states very clearly what the method is supposed to do.source is null seems odd to me ...
dfhwze's user avatar
  • 14.2k
14votes
Accepted

indexOf Boyer-Moore String Search algorithm

1. BugThe code in the post does not work!>>> index_of('abba', 'bba')>>> # expected 1 but got NoneRead on to see how you could have ...
Community wiki
14votes

Secrets management, operational security, keeping API tokens hidden while streaming

Yourmain is a classic arrow anti-pattern. You can use guard clauses to make the code flat and easier to understand.Bare excepts are normally not a good idea. Why ...
Peilonrayz's user avatar
  • 44.6k
14votes

Python strong password validator ( with unit test )

standard libraries are, umm, standard...
J_H's user avatar
  • 43.3k
13votes

FIFO data structure in pure C

This looks really nice! Here we go: Is the API well thought and idiomatic?Mostly. For a library as simplistic as this, you probably want to avoid creating a special enum when returning ...
hsdfhsdal's user avatar
13votes

AsyncDictionary - Can you break thread safety?

Threading DesignYour implementation has a very intrusive lock for all read and write operations, using theSemaphoreSlim with max concurrency 1. ...
dfhwze's user avatar
  • 14.2k
12votes
Accepted

Flatten an array of integers in Python

Python normally promotes duck typing, yours is more statically typed.You may want to useyield, as your current code possibly uses more memory than needed.You can ...
Peilonrayz's user avatar
  • 44.6k
12votes
Accepted

Program to see how many points lie strictly inside a convex polygon

Data typesWhy not use a simplepoint struct instead ofstd::pair<int, int>? It doesn't have to do anything, just a simple ...
hoffmale's user avatar
12votes

ExactlyOne extension method

mhmmm... I'm not so sure about this implementation. @dfhwze's points are valid but still, I find it's overengineered.I prefer chaining these two alraedy available extensions that can do all ...
t3chb0t's user avatar
  • 44.7k
12votes

AsyncDictionary - Can you break thread safety?

It's pretty hard to break something that uses a global lock around everything. So this seems pretty thread-safe. But that doesn't answer the question of why you'd want to use this. Asynchronous ...
Voo's user avatar
  • 525
12votes
Accepted

Binary Search given sorted array Unit test

BinarySearchTheBinarySearch class should bepublic since it contains utility methods that are generally useful. To do this, ...
Roland Illig's user avatar
11votes
Accepted

Controlling the order of unittest.TestCases

A search for "python sort unit test order in method definition order" got me here, and the documentation isn't particularly useful either ("Function" it says, what is it passed, what is it expected to ...
Keiji's user avatar
11votes
Accepted

Stopwatch dependency for unit-testing

I would not return IStopwatch from Start/Stop/etc. This IStopwatch is not an immutable Value Object, like String for example: it would be easier to set expectations by having just this:...
Dmitry Nogin's user avatar
11votes
Accepted

Building Slack message

I've come back to this question about 4 or 5 times since it was originally posted, started writing up an answer, started doubting my alternative implementation, scrapped it, and then come back about a ...
Dan Oberlam's user avatar
11votes
Accepted

Recursive search on Node Tree with Linq and Queue

Reading Material .. any reading material about searching algorithms on treesThese are the most common tree walkers:Breadth-First SearchDepth-First SearchReviewThere is a bug with IsRoot. Also,...
dfhwze's user avatar
  • 14.2k
11votes

ExactlyOne extension method

This is for dfhwze as per comment:...
Jesse C. Slicer's user avatar
11votes
Accepted

Unit test for a maximum-finding function

I'm not a C++ developer, and can't comment on the details of the code. But I can comment on the test cases and the general style of the code.A good test should be enough to recreate the code from ...
Polygorial's user avatar
10votes

FIFO data structure in pure C

When you have queued a pointer you can never get that pointer again. It is also very difficult to know when that pointer has been dequeued. This is a recipe for leaks. Instead returning the pointer ...
ratchet freak's user avatar
9votes
Accepted

Simple Unit Test in C

Statement-like macros should normally be wrapped indo...while(0). They should also avoid multiple expansion of arguments. So ...
Toby Speight's user avatar
9votes
Accepted

AsyncDictionary - Can you break thread safety?

If you modify theAsyncDictionary while enumerating its keys/values it throwsInvalidOperationException (if the backing ...
Johnbot's user avatar
  • 3,084
9votes

Mocking pathlib.Path I/O methods in a maintainable way which tests functionality not implementation

Mocking system calls, especially those with side effects (mkdir()), is difficult and error prone.I would rather use a temporary directory for test purposes. This ...
etene's user avatar
9votes
Accepted

Mocking pathlib.Path I/O methods in a maintainable way which tests functionality not implementation

I'm no professional when it comes to testing. But it looks like your code is a perfect example on non-test friendly code. And is why SRP, single responsibility principle is such a big thing.From my ...
Peilonrayz's user avatar
  • 44.6k

Only top scored, non community-wiki answers of a minimum length are eligible

1,021

questions tagged

Synonyms


Related Tags

 × 1058
 × 255
 × 205
 × 197
 × 88
 × 60
 × 59
 × 57
 × 51
 × 47
 × 43
 × 42
 × 41
 × 40
 × 36
 × 36
 × 36
 × 34
 × 33
 × 27
 × 25
 × 24
 × 21
 × 21
 × 19

[8]ページ先頭

©2009-2025 Movatter.jp