Skip to main content
138 votes
Accepted

Does storing plain text data take up less space than storing the equivalent message in binary?

Plaintext is binary. When you write an H to a hard drive, the write head doesn't carve two vertical lines and a horizontal line into the platter, it magnetically encodes the bits 010010001 into the ...
8bittree's user avatar
  • 5,656
105 votes
Accepted

Would having 4 states per "bit" rather than 2 mean twice the storage space?

The word you are looking for is not "bit" but "symbol." "Symbol" is the word used to describe the process of mapping hardware signals (such as voltages or magnetic patterns) into logical bits. If a ...
Cort Ammon's user avatar
  • 11.6k
58 votes
Accepted

Professional way to produce a large problem without filling up huge arrays: C++, free memory from part of an array

What you describe, "smoothing by fives", is a finite impulse response (FIR) digital filter. Such filters are implemented with circular buffers. You keep only the last N values, you keep an index ...
John R. Strohm's user avatar
55 votes

Modeling first and lastname separately

First name and last name are not useful concepts. Names work differently in different countries. In most Asian countries, the family name is written first, but it is still used for sorting—so you may ...
Jan Hudec's user avatar
  • 18.3k
32 votes

Modeling first and lastname separately

The only argument that matters is what are the requirements of your system? Do you need to deal with just one culture? If so, conform to that culture. Otherwise plan for internationalization (as ...
Becuzz's user avatar
  • 4,835
24 votes

If C++ is generally faster than java, why most data analysis / ETL tools are developed in java?

Assuming for a moment that the general performance difference is true... Java has more mature data manipulation libraries. Java has mildly sane string manipulation. Java has a wider userbase. Java ...
Telastyn's user avatar
  • 109k
21 votes

How should I store readonly data to deploy with my application?

If the data never changes and is read only, then just put it in a code file as a list of constants. public readonly string AppStartUpData = "MyAppNeedsThis"; If this data is different per deployment,...
Jon Raynor's user avatar
  • 11.6k
21 votes
Accepted

How does Microdata rdfa compare to JSON-LD?

Microdata is not dead. While Microdata will not become a W3C standard¹, it’s still part of WHATWG’s HTML Living Standard. Differences between JSON-LD, Microdata, and RDFa (in the context of HTML ...
unor's user avatar
  • 1,112
21 votes

Would having 4 states per "bit" rather than 2 mean twice the storage space?

One quarternary memory cell can store exactly as much information as 2 binary memory cells: Quaternary Binary 0 00 1 01 2 10 3 11 So if you have same number of ...
hyde's user avatar
  • 3,764
20 votes

Does storing plain text data take up less space than storing the equivalent message in binary?

I find this a great fun thing to think about. Binary is not 1s and 0s in the way you talk about it. Imagine there is a quantity, I can tell you what quantity it is in many different ways: Nine in ...
TessellatingHeckler's user avatar
20 votes
Accepted

File storage microservice design

A goal of a service in SOA is to perform some logic which, otherwise, would have to be duplicated among other services. That logic is, in turn, the reason for the service to exist. In your case, you ...
Arseni Mourzenko's user avatar
17 votes
Accepted

Microservices - sharing data through distributed in-memory cache?

Just like using a single database for multiple services, the approach you describe causes a strong coupling between the services. For example, you can not change the data model of one service without ...
Michał Kosmulski's user avatar
15 votes

How should I store readonly data to deploy with my application?

You can always add a file into your project and set its build type to Embedded Resource so that it is embedded directly into the application itself. Alternatively a file that is encrypted and placed ...
TheLethalCoder's user avatar
15 votes

If C++ is generally faster than java, why most data analysis / ETL tools are developed in java?

I think there's more to this than simply that the workflow for ETL is typically I/O bound, not CPU bound; that's just the justification. The real issue here is development cost. C++ applications of ...
Doug's user avatar
  • 314
15 votes
Accepted

Is there any use case for using 'L' letter after a number literal in C?

In the C language expressions are typed inside-out: literals have types. E.g. 123 is an int, and 123U is an unsigned int, 123L is a long int and so on. The type of an expression depends on the types ...
amon's user avatar
  • 135k
14 votes
Accepted

How should I store readonly data to deploy with my application?

A binary file would be the obvious answer, but it depends on how you are loading it - you might as well make life easy for yourself if you can. XML might be a good choice as there are built in ...
Matt Wilko's user avatar
14 votes

Does storing plain text data take up less space than storing the equivalent message in binary?

Does storing plain text data take up less space than storing the equivalent message in binary? No, never. Your computer already stores the plain text data in the equivalent binary representation. ...
Telastyn's user avatar
  • 109k
13 votes

Professional way to produce a large problem without filling up huge arrays: C++, free memory from part of an array

Every problem can be solved by adding an additional level of indirection. So do that. You can't delete part of an array in C++. But you can create a new array holding just the data you want to keep, ...
Nicol Bolas's user avatar
12 votes
Accepted

Binary data formats, how to make ensure you can read different format versions?

It seems to me that the simplest solution is to make your version header unambiguous and make sure that the old format can never look like it has a format header, you simply look for it. If it's not ...
JimmyJames's user avatar
  • 27.8k
12 votes

Which layer should have responsibility for rounding numbers?

Monetary values in general do not use floating point (always approximation errors!), but fixed point, as BigDecimal in java, DECIMAL in SQL. For currencies you then have a defined precision (2 ...
Joop Eggen's user avatar
  • 2,059
12 votes

Is it anti-pattern to have inheritence in a dto?

Update: Rewrote code in Java since this question is tagged java but this applies to any object oriented language. If using inheritance is a means of reducing code duplication, I'm a little reluctant ...
Greg Burghardt's user avatar
12 votes

Why do or should programmers save data in text based formats like JSON or XML instead of binary?

JSON and XML are less efficient than pure binary, but what you aren't considering is that they (JSON/XML, and some other formats like YAML) are standardised, while binary isn't - different systems, ...
AIWalker's user avatar
  • 1,317
11 votes
Accepted

Why is it considered a good practice to isolate data management in a microservice?

A big advantage that a Microservices architecture has is that each service can be safely developed, tested and deployed independently. Having services share a database undermines this as it allows ...
Justin's user avatar
  • 1,738
11 votes

Prevent analytics from crashing the production database

I will start with the simplest solution, per amon's comment - create a read replica - if you are hosting your database in a cloud provider, this is typically just a few clicks or a few changes to your ...
DavidT's user avatar
  • 3,378
10 votes

Which layer should have responsibility for rounding numbers?

There are two levels of rounding you should be doing. The primary one is in the business logic to round to the level of precision required. The UI can round for display purposes independently. Rules ...
Ryathal's user avatar
  • 13.5k
10 votes

Where to put data generating functions for unit tests

Drawbacks of Random Test Data It may not be a good idea to use random data in the unit test, because it is slightly harder to debug, hard to create edge cases, and hard to specify the expected answer. ...
lennon310's user avatar
  • 3,222
9 votes

What is the best way to save data of a C++ Program ? Binary vs JSON serialization

I've had great success using SQLite databases as a file format for graphics applications. Its both very reliable, and being a standard format, its contents are easily viewed/converted by external ...
GrandmasterB's user avatar
  • 39.4k
9 votes
Accepted

Does it make sense to have a custom textual data format?

Does it make sense to have custom data formats like ours, when there are widely-adopted standard formats for data (e.g. relational structure in relational databases, or even NoSQL databases that have ...
Mason Wheeler's user avatar
9 votes

Database design for fields that should be NOT NULL eventually, but may not yet have a value

Two Tables and a View Have two tables with mirrored schemas, differing only in the nullability of the columns. Once all the data is present, you move it from the pending table to the complete table. ...
Caleth's user avatar
  • 11.4k
9 votes

Would having 4 states per "bit" rather than 2 mean twice the storage space?

In basic theory, yes. In reality, no - because we don't actually store data in bits anyway (on HDDs). Cort Ammon covers the issues in data transmission very well. RAM, cache, and SSDs store data as ...
user3685427's user avatar

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