New answers tagged

2

You need to talk with your company's IT department. If your business uses commercially-licensed software for your products, they should have a process for getting a license for developers. Never use software that could get your company into legal trouble without obtaining permission. If you aren't sure, ask. As far as the technical compatibility goes, see ...


2

I would say the closest "Paradigm equivalent" is Functional Programming, perhaps even lazy functional programming (or FP that is lazily evaluated). It's obviously not an exact mapping, but it's close. A great example of this is Haskell. Learning Haskell was one of the best things I could have done for myself because when RxJava and the likes came around, it ...


1

Don't mess with time. They're fickle to work with and error prone in a distributed system, especially because you'll need to synchronise clocks and deal with latency. Instead use a version number. For every write request, increment the version number on the data; with every read request, send a version number to conditionally perform the request, if the read ...


1

First, I'm hoping that the 3-5 seconds or so is a big enough head start for a write to get through before the read It's really a bad idea to assume something like this. You should just write your code to deal with the fact that a read may show up first. So if data is stale, you want the read operation to wait until it's updated, is that correct? You might ...


2

I do not fully understand what your application does but your concerns and approaches seem off. Do not mess with thread priorities, these will give you nothing. If you do not want reads and writes to get in each others way, just lock on the queue object. a read thread looking in a queue to find nothing is there (yet) is not a bad thing. Trying to control ...


2

The values of annotation parameters must be compile-time constants, so you cannot "pass a variable" this way. But how should this even work? Where would methodContext be defined and who would be responsible for setting the value? You are, however, free to pass compile-time constants, so for example: @Logged(loggerName = "MY_LOGGER") public void ... is ...


2

So, I would want to have clarity on what are the EXACT scalar and composite fields in JAVA? And why? It's strictly to do with the types defined in a .proto file. Java the language doesn't define the meaning here. Anything you have defined an enum or message for is composite. The built-in types are scalar. Elements that are defined required or optional ...


1

The terms 'scalar type' or 'scalar field' are usually used to contrast them with compound types/fields. A compound type is easiest to define and it is a type that contains multiple distinct elements. These elements can have the same type, in which case the compound is an array or a list, or different types, in which case the compound is typically a struct or ...


-1

With the first example you're expressing precise relationship as in "one being the type of the other" and with that comes the benefits of inheritance and polymorphism, whereas in the second example you're providing accessibility to the methods and data of some class within the context of the other. If both the Fruits and Bananas class are not within the ...


1

I'll propose an answer since it's been nearly a year. As @Walfrat has pointed out: Note that if you're echanging too much data, it might also be a design problem that would lead to poor performance in production environment (where the badwith and stability of the connection is not always here). With that in mind, it might be better to push a more "...


1

What I got from talking with Robert : Why no row self-referencing ? in the real life we are modelising in the DB, there is no parent to the header : by lemma "we want DB to match closely real life", we want null for parent_id. There is no parent => no parent_id. That's the main argument. Issue with nullable parent_id : the parent_id == id case must ...


0

is it the same row id (the header is self-referencing while it should not) note that self referencing row is only a specific case of more generic corruption: referencing circle. You should rather verify that you dont't have that generic case, and you would have to do it regardless of the option you'd pick. So this argument goes


1

The very definition of the terms "front end" and "back end" comes from the separation of business logic (back end) from the user interface (front end). So yes, business logic should be in the back-end, whether that is a remote service or simply a different layer in the same application. Given that you already have a separate back-end system, you should ...


0

Im a DBA not a developer, so i will offer you a pro db perspective. Implementing logic using a combination of Stored procs and table driven values in the db that can be shared by both the web app and mobile app means you get security, performance and consistency. It has the added advantage that when you want to make a change that change is rolled out ...


2

It should be on a case-by-case basis but I would expect most of the logic to go in the backend. Your interactor might still contain several methods ("Check ticket availability", "Add ticket to basket", "Checkout") but yes the implementation could be expected to be very simple in some cases. You might want to consider: Security. Any code that you need to ...


0

Circular dependencies can be an indicator that the which-class-is-responsible-for of your architecture is not correct. Usually you have technical components (like csv-parser or html-table-display) and business-domain-components (i.e. product-data) constisting of data-items (the product values like name, description, price), data-repositories (to save ...


3

Re-Think You did not specify how hard the "not guessable" requirement is. Of course you would not use simple serial numbers, but I would not rule out a mechanism that can create unique strings using simple cryptographic techniques and does not need a database at all. Risk evaluation What are the IDs used for? Just identification of an item? Or are they ...


1

Your approach is fine. Only using a new table for each year is debatable, this will trade insertion speed for query speed (you will have to query then multiple tables to make sure your uniqueness requirement is fulfilled), so it is not inherently clear if this will really bring the benefit you expect from it. I would actually keep away from this premature ...


1

I think you should be careful about masking the cycle with interfaces. I would recommend to let the storage know about the parser, but not the other way around. The parser seems to be your domain / business logic. Everything else revolves around it. Also see The Onion Architecture. You can create a new package that orchestrates everything (e.g. app). But ...


0

I need to validate and parse a file in a CSV-like format and then use this data to generate a Tree data structure Your process is inherently two-stage. Trying to merge these two separate things into one will certainly result in less legible and harder-to-maintain code. It is almost certainly not necessary to write everything as one giant package/class/...


5

I was thinking to expose some Interfaces in a contracts/interfaces package in such a way that specific classes such as Record and DataStorage would implement them and there wouldn't be a circular dependency anymore. This is fine. Each package defines (in the more abstract way possible1) the inputs and outputs so the dependency upon these packages is ...


0

A List of List will be dynamic(in terms of number of Vertices) in nature and hence can be costly in terms of reallocation(as the default size of ArrayList in JAVA is 10). Since we already know the size of a graph while constructing it. So it is better to use an array of List rather than using a List of List or a Map of List. You can read more about the List ...


0

The displayed code is correct if you need to keep the state of the interrupt status of the thread. As Thread.sleep() clears the status, you need the additional wasInterrupted flag. In most code you don't see the "full version" like this, because it's often not useful information. I don't really see a reason for it here either. Is there other code that ...


1

I really don't see how simpler can it get than this: class StudentDAO { public Student createStudent(Student studentToCreate) { jdbcTemplate.update(INSERT_SQL, .....); auditService.Created(studenToCreate.AuditInfo()): } public Student deleteStudent(Student studentToDelete) { jdbcTemplate.update(DELETE_SQL, .....); ...


2

REST doesn't constrain your resource identifiers, beyond the expectation that they will satisfy the production rules described in RFC 3986. The machines just don't care. So any spelling that will satisfy your local code review is fine. Some spellings are more convenient than others, because they encode information that can easily be described by a URI ...


4

How could this problem be solved without breaking the concept of clean OOP? This is not an OOP problem. This is a data structure problem. I know this because there is no behavior associated with this data. If there was we could design objects that would locate that behavior, as methods, with the data. Instead what I see is a desire to have a data structure ...


Top 50 recent answers are included