Tag Info

New answers tagged

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 ...


8

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 ...


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 ...


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 ...


5

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 ...


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 ...


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 ...


1

The application primarily deals with users, profiles owned by users, photos, and tags that represent one to many profiles in a photo. There would conceivably be methods to return photos uploaded by a user, return photos that contain a certain tagged profile, etc. Well, profile service should not work with user object. It may know only the ID of ...


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 ...


6

It's dangerously easy as a programmer to start thinking that every project you encounter could and should be done better (read: rewritten) because it doesn't correspond to your vision. We've ALL been there. You look at code and your mind just goes into "what's wrong with this"-mode, instead of focusing on what's right about it. If you start plucking away ...


2

The obvious answer to this problem is "don't do N^2", at least not for the full value of N - you can very rapidly reject large parts of your data set for all sorts of reasons: Wrong sex. While I'm a liberal kind of guy, I'm still not interested in dating other guys. There may obviously be some exceptions to this - e.g. bisexuals. Wrong country. It doesn't ...


1

Eric Evans Domain Driven Design specifies that you should provide a repository for 'aggregate roots' that need direct access. So this is not one repository per model but one repository per cluster of models, if you like. This assumes you are doing DDD and therefore understand the business context, though.


3

Implementing repositories "by the book" will typically mean to create one per entity or table (see here, for example). However, when your entities are uniform, and all of your repositories look very similar, it can make sense to implement a generic repository class (just as shown in the former link). That will probably be the better alternative for avoiding ...


2

Why are repositories any different from other classes? A class should have a single responsibility - a single reason to change. If you have a bundle of related data sources that are (necessarily) tightly coupled, then it can make sense to have a single repo to deal with all of them. If you have some unrelated tables, then it's probably better to have a ...


2

Before an OS is installed on a bare computer system, does the computer use files? No. At startup some code is copied from an EPROM into memory at a known location and the processor executes those instructions. All it does is load execute instruction at the 'current' memory address increment it and repeat forever. The CPU is unaware that a harddisk ...


4

Files are a low-level abstraction provided by the operating system thru some file system layer. Another important abstraction provided by OSes is processes (running instances of programs). The OSdev site has interesting practical information. The underlying bar metal computer (e.g. your x86 laptop or desktop) does not know about files.... It is reading and ...


11

Since you're not talking about booting, your answer is actually that the concept of "executable," or even "files" is rather irrelevant. The concept of files is an OS concept. Without an OS, all you have is a harddrive, with some bits on it. It is the OS that gives structure to that information that makes it meaningful to think of the data as a file. For ...


4

Back in the stone age of computing, one of the common modes of booting up was to read an executable program into memory completely under hardware control and then start running it. The PDP-10 for example, could command the paper tape reader to read a block of data, take the data presented and stuff it into memory, and then start running it when the block ...


4

To get an OS up and running, there are various things being executed which are typically called "loaders" and "bootstrappers". Their collective purpose is exactly as their names imply: to get the OS up and running, one step at a time. Some of these executable code are stored in read-only memory (ROM), or some type of reprogrammable memory (such as Flash ...


0

Should my user have an "GetTasks()" function which will access the server and will return the Tasks, which would be an strongly object orientated method. I am not sure it's something strongly object-oriented. Or should I Use an Service, which has a function that takes the user as parameter and returns the task. Of course it would be better ...


1

In addition to Roman Reiner's answer, your checklist doesn't mention the requirements for each application. You will need some combination of documents/diagrams/tests to say what the old applications are supposed to do before you start writing new applications to replace them.


2

Of course cpu cache affects boot time, since CPU cache affects the processor performance. BTW the boot procedure often lasts several seconds, and that is significant enough for the cache (both instructions and data cache) to be important. A cache line is often 64 bytes. A cache size is a few megabytes. It can be mostly filled in some millions cycles (e.g. a ...


3

If you built a house and you want to describe it to someone, would you talk about what kind of flooring material you used? About what kind of hammer and tools you used? About the plumbing? You might, but none of this has to do with architecture. Architecture is about what kind of rooms there are, where they are and how they are connected. So the first ...


2

firmware is software that runs on Read-Only Memory (ROM) or something similar. firmware is firmer than software because software can be changed somewhere along the chain from where it is stored in some Read-Write media and loaded into writable memory and executed from there. firmware cannot work as in-place self-modifying code. software can run as ...


2

Firmware doesn't really fit into that hierarchy. Firmware is really just a place where a library of machine code (in the sense of level 2) is stored. Often the code stored in firmware is for the management of the motherboard and IO channels, but it need not be. I've got an old Tandy laptop that has Multiplan, a text editor, a BASIC interpreter, and a ...


2

I'm not quite sure if the image is accurate enough to expose such details as Firmware. For example the top 2 levels usually happen well before rest, the OS is not interpreting the program in usual sense of the word... unless we mean loader etc. In the end the model does not have straightforward mapping to a 'real life' computer - I would even consider it ...


0

Build a data layer that matches your DB in a shared assembly. You can the have each of the business layers reference it (the data layer could be all interfaces to keep implementation separate). Then build out each of your use cases in the relevant business layers. You'll likely have a fourth business assembly which contains objects which implement shared ...


0

Microservices are the current trend, and they would roughly correspond with your third choice. You can spend a lot of time getting sucked into the literature around microservices, but yes, you will definitely contend with some degree of data duplication and possibly performance issues when compositing multiple microservices into a usable product. Ultimately ...


1

You can use various forms of caching to eliminate some of the bottlenecks of retrieving data. You can also consider using a document based database (NoSQL) which can improve performance. Here is an article which discusses performance in microservices: https://blog.dropletpay.com/lessons-learnt-building-a-microservice-architecture/ Lesson 6: Cache ...


6

Internal networks often use 1 Gbps connections, or faster. Optical fiber connections or bonding allow much higher bandwidths between the servers. Now imagine the average size of a JSON response from an API. How much of such responses can be transmitted over a 1 Gbps connection in one second? Let's actually do the math. 1 Gbps is 131 072 KB ...


1

Your naive imagination is right. And often that doesn't matter. Modern machines are fast. The main advantages of micro service architecture are seen in development and maintenance effort and time. And of course there is no rule saying you can't use shared memory or even physically deploy multiple services in one executable. Just as long as you design it ...


2

I think you are reading too much into the 'micro' part. It doesn't mean replace every class with a network service, but componentize a monolithic application into sensibly sized components, each one dealing with an aspect of your program. The services won't talk to each other, so at worst you've split a large network request into several smaller ones. The ...


1

By structuring your code and resource access such that the resulting system can be flexible enough to run as a monolithic application or a distributed one via configuration. If you abstract away the communication mechanism behind some common interface and you build your system with concurrency in mind, you can easily optimize everything after you have ...


0

tricks, tips or techniques to ensure that we correctly identify the parts of the project that need the most rigidity, Guess and hope you get lucky. Experience will help. prototype and iterate them first, and catch problems there as early as possible? Deliver something as soon as possible. The sooner it fails the less painful it will be to ...


0

I have been working on a project from its early stages and what I have learnt is adopting mindset of agile and 'failing fast' can really help project moves forward. Firstly you have to make sure that you can make things working by having proper POC and from their starting building your software but at same time you shouldn't spend lots of time and ...


5

Based on the picture you provided, this looks like Onion Architecture, but with the dependencies proceeding in reverse. A typical onion architecture looks something like this: Each layer presents interfaces (an API) to the layer above it, and communicates with the layer above it, and the layer below it. The onion model has some similarities to a ...


1

Is there a pattern to achieve what I want without much coupling? Not really, since at its core what you want to do "when X happens, I want to do Y to these other things" is coupling by definition. Which also makes this a rather undesirable design for the problem at hand. If I had to work with this, I'd start by looking to make the classes immutable ...


0

Note: I'm assuming the language is C#. If it's Java, similar mechanisms should exist as well. If you want to track changes to the properties of ClassA, you can use INotifyPropertyChanged. If you want to track changes to the ISomethings2 sequence, instead of IEnumerable<T>, use ObservableCollection<T>. If you just need to keep ISomethings2 ...


1

From Martin Fowler My First Law of Distributed Object Design: Don't distribute your objects Why opt to incur the overhead and instability of a web service if the business logic you want is in a DLL? Reference the DLL and keep all methods calls local, snappy and stable. If you were creating your web site in a non .NET language then you've got a good ...


1

It sounds like there's little difference in terms of coupling. If you're coding against the WebAPI directly, you're dependent on its interfaces. If you code directly against the DLL, you're dependent on its interfaces. Make the distinction irrelevant. Your application ideally shouldn't have to know or care whether it's ultimately leveraging a web service, ...


1

I can see some sensible answers to this question already, but I thought I would expand and offer my opinion. You've described a system that appears to couple logic into large classes, and be tightly coupled across many different functions. The first way to try and refactor this is to first ensure you understand what a 'good' architecture/codebase would ...


0

I think you should validate your models in... model validators ;) In my current architecture each model has an associated validator class, which contains validation logic. (Controllers have validators as well, but that's not the point). This is because validation logic can sometimes be complex enough, especially when models receive states. To validate a ...


1

Using a Web API allows you to program to an interface rather than a concrete implementation. Need to generate an invoice (for example)? Just call the Web API method to generate that invoice. Should the need arise in the future to change the way invoicing works, you can just change the code behind the interface, (or swap it out for a completely different ...


0

The only way I see now is to use REST authentication provided by Amazon It creates expiring URLs that can be given to third-party. So, basically the idea is to login user to your website, check his permissions and then generate URL for him to download file from. AWS IAM also can be used for that, but that limits the number of options, actually.


1

Of course, I never saw your actual code, but from what you've said, I would propose something close to the following architecture. I'm sorry for pseudo-code, I just wanted it to be fast & clear ;) UI layer: dataService = new DataService(); dataService->makeDataRequest(requestName, requestParams[], cachedDataArrivedCallback, ...


0

That design seem to violate SRP since your Config (which is a config, just a configuration holder) will know how to generate configuration for each specific agent). I think an Agent should create Config instance, passing to it it's name (which is used to deduce configuration file path from it) and the callback, which should returns Agent's initial ...


0

I'd go for more logical grouping, Imagine a system where hotel bookings are performed, where there are 2 different hotel reservation API (A and B) and one payment gateway. In this sort of situation few best practices to follow would be, Wrap any third party APIs into one of services (whenever third party API changes only the wrapper service is need to ...


-1

You are asking intelligent questions about refactoring. When single classes mix up different functionality, it gets hard to read and debug. Never mind the lengthy code. Sometimes a class can get large innocently, but mixing metaphors within the same class = bad List the methods in your class and separate out into different classes any utility type classes ...



Top 50 recent answers are included