New answers tagged

0

Bloch's rules on optimization are just a variation on "premature optimization is the root of all evil" which, correctly interpreted, means "Measure first, before you optimize. Make sure that your optimization is actually going to give you the performance benefit you are seeking, before you spend the time and money optimizing." I don't necessarily agree with ...


1

Can I suggest you not look at performance this way? You're thinking about it before writing the code. Instead, write the code, get it running, and then find out what the real performance issues are. The chance that you've guessed correctly ahead of time what they are is very small. Here's an example of how to do it. Now, after you've done this, and not ...


4

Do they load all the program code into the memory on application startup? NO You can have as many Assemblies in your project as you need. Assemblies are referenced via the using keyword. Unused assemblies are filtered out at the build time itself. For example, you can have two referenced asssemblies as: using System.Windows.Forms; using ...


5

I think you have complexity because you are starting with over-complication: Paths would be something as: companies/1/departments/1/employees/1/courses/1 companies/1/offices/1/employees/1/courses/1 Instead I would introduce simpler URL scheme like this: GET companies/ Returns a list of companies, for each company return short ...


2

In general, you don't want any implementation details exposed in the API. msw and VoiceofUnreason's answers are both communicating that, so it's important to pick up on. Keep in mind the principle of least astonishment, especially since you're worried about idempotence. Take a look at some of the comments in the article you posted ...


4

IMHO, I think you're missing the point. First, the REST API and DB performance are unrelated. The REST API is just an interface, it does not define at all how you do stuff under the hood. You can map it to any DB structure you like behind it. Therefore: design you API so that it's easy for the user design your database so that's it can scale reasonably: ...


2

Question 1: Is my thinking correct, is "where to cut the hierarchy" a typical engineering decission I need to make? Maybe - I'd be worried that you are going about it backwards, though. So ok, when returning a company, I obviously don't return the whole hierarchy I don't think that's obvious at all. You should be returning representation(s) of ...


0

For your Q1 on where to cut the engineering decisions, how about picking up the unique Id of an entity that would other way give you the required details on the backend? For example, "companies/1/department/1" will have an unique Identifier on its own (or we can have one to represent the same) to give you the hierarchy, you can use that. For your Q3 on PUT ...


6

First, reduce the problem to a test of availabilities "per day". All your examples are using ranges for only one day, but if you also want to support a range like "Monday 10:00 to Wednesday 14:00", break this down into three tests for "Monday 10:00 to 23:59", "Thursday 00:00 to 23:59" and "Wednesday 00:00 to 10:00". For each day, store an interval ...


0

If your idea is that by storing data in a database in case an error occurs you don't need to parse it again: Errors should be rare, they are a big hit anyway, so a little bit of time for parsing wouldn't matter. On the other hand, you must now make sure that the database file is still there, that it hasn't been modified or overwritten, you must delete it ...


0

There is a very old joke circa 1916. A harassed young lieutenant sent the message "Send reinforcements we are going to advance" via a runner who passed on the message by telephone and eventually a telegram was received at HQ. A confused general received the message "Send three and fourpence we are going to a dance" and duly sent the correct change. EXCEL is ...


1

(since you code in PHP, I am guessing that the Excel file is uploaded in some browser, so is coming from the Internet; if it is not the case, ignore my answer) Is it better practice to store the parsed data in a database first and then use the data however I wish? I believe that yes. The data is coming from an untrusted source, the "bad Internet", so ...


5

For me it makes more sense as then I don't need to re-parse if errors occur when sending the email for example. In such a case, the main decision criteria are simplicity and performance (which depend not only on the process you are implementing, but also how you do it). For example, when the running time for re-parsing the input file is negligible, ...


2

I think parsing the file and storing the data to a database would be a good idea. It provides a transactional history so you can retry failed messages, audit records sent, and provide reporting. That said, if you have no requirements to support any of those functions and no possibility of having them in the future, writing to a database would just be ...


0

Depends on the business model. Let us say it like this. If the processed excel file should generate a different result to the previous one, I would say store and according the request the model process the output different previous according the uri. But if the data is running on the same data the same routine (request), with the service resultset, ...


2

The variables wordCount and charCount are created and initialized only when the TextWatcher object is created and added as a listener. No new instance is created every time the text changes.



Top 50 recent answers are included