Tag Info

Hot answers tagged

73

When building real-world programs, there is often a trade-off between staying pragmatic on one hand, and staying 100% clean on the other. If staying clean prohibits you to ship your product in time, then you are better off with a little bit of duct-tape to get the d***d thing out of the door. Said that, your description sounds different - it sounds you are ...


25

Interesting question. I am a bit biased though due to my previous experiences, which prompts me to answer with No. Short answer: We never stop learning. When you hit a wall like that, it is a chance to improve your architectural/design skills, not an excuse to add code smells. The longer version is that I have been asked similar questions a lot of times in ...


13

It seems to be due to a fundamental disagreement between Alan Kay versus the people (primarily Tim Berners-Lee) who designed the web, about how such a system should work. The ideal browser, according to Kay, should really be a mini operating system with only one task: To safely execute code downloaded from the internet. In Kays design, the web does not ...


12

Your concerns are extremely valid. Especially the first two points about Team A not having the time to add features or fix bugs that impact Team B. I've seen this happen at my own job quite a few times. This might be a good idea if: It is known that Team A will be working on the projects that require new features in the database, while Team B's goal is ...


9

Having a god class like this is never desirable, as it does not only mean that your bullets are now monolithic objects, but the same goes for your procedural generation algorithm as well. The first step would have been to analyze, why exactly your AI did have so much trouble with dealing with the complexity of your pattern? Did you, by chance, tried to ...


8

All bad code since the dawn of time has a story behind its evolution that makes it look reasonable step by step. Yours is no exception. Coders learn by coding. There are aspects of your problem you could not have foreseen that seem obvious now. There are decisions you made that were entirely reasonable incrementally, but led your architecture in the ...


6

Usually, services call other services when they need to access their data. Each piece of data should belong to a particular service which will be the only entry point to accessing this data and modifying it. Some services will be simple and usually correspond closely to your domain model (e.g. a service for handling users) while others will be high-level and ...


5

The successful creation of the task to do whatever was successful. This means that one should be looking in the 2xx block of the response codes. In this block one jumps out as the correct answer quite quickly: 202 Accepted The request has been accepted for processing, but the processing has not been completed. The request might or might not ...


5

Immutable objects in general have several benefits. The most important one is how easy is to use immutable objects in code executed in parallel. This also explains why "immutability has never really caught on in the land of PHP". State consistency is easier to obtain. Objects are easy, more natural to work with. The essential thing is how much the object ...


4

Requiring a reboot of the application when the database goes down is definitely a bad design, because it increases maintainance effort which will negatively affect your uptime. A good design would try to reconnect to the database every few seconds so business can continue as soon as the database is available again. In the meantime, returning a "500 ...


3

I would avoid bidirectional relationships as much as possible, as they can lead to synchronization problems (Child can end up having an obsolete ParentId). That being said, a unidirectional reference to another object by its ID only can be very useful. It's a very natural way of cutting an object graph in slices that can be loaded in memory from the ...


3

The main problem that I see is that with the top approach, your website needs to be able to accept requests from mobile, as opposed to the services. That seems like something the website should not have to worry about. In particular, it implies either your website has a bunch of "pass-through" logic to duplicate the API of the services, or the website is ...


3

What advantages do people see in using immutable request/response objects? I agree with @MainMa's statement "I'm not sure if the slight benefit of readability compensates the possible lack of flexibility" and personally I don't see any practical and useful aspects of forcing PHP HTTP Request temporary objects or PHP HTTP Response temporary objects to be ...


3

It's hard to say how to structure your application without knowing the differences between each 'branch'. What I would do is compare the functionality of each branch and distill the common denominators. Put these into classes that you use for each client. The parts that differ from client to client I would then put into adapters or strategies that ...


2

Although I have not worked in this area, it seems like this is the type of problem one would use something like Apache Giraph to handle. You essentially want a huge population of "things" which you suspect are "related" to each other possibly across a large number of dimensions, and you want to pair them up optimally based on the strongest matches. You ...


2

Generally speaking, the way this works is to have "components" that themselves have HTML structure, but allow their positioning within "cells" within the template. You might choose a layout that has a large cell and then three smaller cells beneath it, for example; you could then put a big image slider component in the big cell, and images with captions in ...


2

It sounds like essentially the problem is that you have 30 processes which are similar but vary in inconsistent ways and you want to avoid duplicating code as much as possible while still being able to change any aspect if required. In that case then the template method pattern can be very useful. The basic idea is that you'd implement a base/abstract ...


2

V8 and other language implementations using similar techniques are just-in-time compilers. They generate code, and that generated code is speculatively optimized (with checks to fall back to slower, more general code if the specialization turns out to be invalid). So when generating code, the JIT compiler often has a good guess at what the hidden class of an ...


2

You're almost there... Putting the REST between the view and the controller would be the right choice. That means that your view, i.e. a javascript code, will send REST calls to your server, which process those calls in the appropriate controller (then the models and etc.). In addition this controller would be responsible for the response back to the ...


2

What you are looking for is the concept of a ViewModel. This is an object that contains only data that the view is interested in, and is very often not a 1 to 1 mapping with a business or domain model. It may be a cut down version of a business model, it may be an amalgamation of multiple different business models. If your view needs a count, this can ...


2

In some cases this is definitely acceptable. However, I find it hard to believe there is no good solution using both procedural generation and your nice attached/component based behavior architecture. If all behaviors where just pulled into the bullet class there is no functional difference between the god object, and neat architectured version. What made it ...


1

I couldn't convince my boss yet that this is a bad idea, am i wrong here? I feel like a web app is not the right tool for this job. And if this is indeed a bad idea, what would the best way be for me to clearly explain him that? I am really not sure this is a bad idea. To me it sounds like a good idea because your customers will get what they want ...


1

Keys are used to inform relationships and enforce referential integrity. Whether you need the ParentId key to live in the Child object depends on whether you will find yourself in a situation where you are working with a Child object and you need to know its parent. In general, I would suggest that it is good practice to include the key in the Child object ...


1

I do not think making decisions about if trial time was exhausted on client is a good idea. This can be easily fooled and can't be calculated with some precision. Since you have a web application, I guess, it would be much better to limit a number of API calls a trial user can make without payment. You can make some tests and map an average number of API ...


1

I keep view models in the web project, for reason you stated, it's usually only useful to the relevant view. I'm not sure why your data access layer would reference the web project though?


1

When it comes to design, it is usually a good idea to have an idea of design patterns. This will help you better visualize the best way to structure your application. It is worth noting though, that you should choose the design patterns depending on what you need to do, and not try to force your design to conform to a specific design pattern. At the very ...


1

However, does it make sense to have one 'database' service responsible for handling a monolithic database (i.e. holding users, orders, inventory, etc in one db)? Is this something that's considered reasonable? I think this is a mistake to make a service (or whatever) in SOA or any other architecture responsible for a database or a part of database ...


1

It depends on the contents of the Context structure. If it contains less data than is the size of a pointer on your architecture, then the memory is wasted, because the size of the pointer + payload is more than twice as large as the payload itself. Another problem might be memory access. When you access the data through a pointer, memory has to be read ...


1

Scheduled Technically a scheduled job implies a job scheduler. You talk about writing your own scheduler but normally this would be handled at quite a low level and takes into account things like available resources and job priority, not just when the job wants to be run. In English, I would say that scheduled implies a timetable. Deferred Technically ...


1

The key is that this is being used in a JIT which produces specialized code. Let's say that have a function something like this: function add_points(a, b) { return new Point(a.x + b.x, a.y + b.y); } V8 will actually generate different versions of this function, for different possible arguments that you pass in. For example, it would generate a version ...



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