New answers tagged

5

Great job. Here are some minor notes though. In newer versions of C# you can leverage async Main in order not to wait for your test method. public static async Task Main(string[] args) { await Test(); } You can speed things up a bit with executing your tests in parallel public static async Task Test() { var successExecute = Execute("https://...


3

I'm just adding some elements to the explanation by RoToRa, use the method toString of the class LocalDate because it outputs the date in ISO-8601 format uuuu-MM-dd, and this is exactly the format you are using. If you are looking for math operations on streams of Double like searching for min, max, average you can use the class DoubleSummaryStatistics like ...


4

Before separating the code into classes try separating it into more methods. At the very least separate business/logic code and input/output code. You should be able to use the same, unchanged business code no matter if it's a command line program, has a GUI or is a web application. For example getJSONAPIdataFromURL shouldn't write to System.out, but return ...


3

Let's go through the code and see what can be improved. #pragma once This shouldn't be in a non-header. #include <list> #include <map> #include <string> #include <variant> #include <vector> #include <fstream> #include <iostream> #include <sstream> Sort the include directives in alphabetical order. ...


1

Good effort to get your code working so far. But your code is highly unusual. You've got the class Question which has an id and question_txt, but each Question also has a reference to a JSONArray of all the questions. Worse than that, for each Question, when you create a new Question and set its reference to all questions, it will come from the API each ...


2

You should look into coroutines. Coroutines are the Promises from JavaScript and the CompleteableFutures of Java. It's basically Kotlin handeling the callbacks for you. suspend fun getString() : String { return "t" } suspend fun main() { val t = getString() println(t) } //is roughly the same as: fun getString(lamb: (String)->Unit){ lamb("...


1

The first thing I noticed is that the format of the data is a collection of columns with rows. The variable maxNumCols seems mis-leading. A more appropriate name for that variable would be maxNumRows because it describes how many rows are needed. In terms of reducing the transformations needed, one option to consider is finding the maximum number of rows in ...


8

I don't think that what you're doing is good style. I think you're adding a lot of extra complexity and places for things to go wrong, or become hard to understand, or whatever. I don't think you lose anything by just making very small methods that call super and your special method. I talk about those options at the bottom of the post. With that out of the ...


Top 50 recent answers are included