Skip to content
DevMeme
4083 of 7590
DesignPatterns Architecture Post #4453 · source on Telegram

The Labyrinth Architect Solves Everything

Description

A multi-panel medieval comic shows a king, a servant, a messenger, and a newly revealed monster, with the servant repeatedly proposing labyrinths for wildly inappropriate things. The visible dialogue reads: "Allow me to present you this enormous cheese", "Sire, I will build a labyrinth to house the cheese!", "No! The kitchen will do fine", "My master also sends his regards", "Sire! I will build a labyrinth to house the regards!", "What is it with you and this labyrinth?", "Labyrinths are awesome!", and finally "Sire! The queen has given birth to a monster!" The final silent reaction implies that the servant has finally found the one situation where a labyrinth might be useful. For software engineers, the comic maps cleanly to overzealous architecture: applying the same favorite pattern everywhere until reality accidentally supplies a valid use case.

Comments

68
Anonymous ★ Top Pick Every platform team has met the engineer who sees a cheese and immediately opens an RFC for service discovery.
  1. Anonymous ★ Top Pick

    Every platform team has met the engineer who sees a cheese and immediately opens an RFC for service discovery.

  2. @karim_mahyari 4y

    What is (or was) special with C# that got it so popular? How is it different from Java?

    1. @RiedleroD 4y

      mostly just lots of smaller improvements in language design ig. well and because Microsoft pushed it for quite some time

    2. @ZgGPuo8dZef58K6hxxGVj3Z2 4y

      Its a mix of 3 languages if I remember correctly

    3. @SamsonovAnton 4y

      Java had one dramatic disadvantage: it was not invented by Microsoft. C# got this deficiency fixed.

      1. @ZgGPuo8dZef58K6hxxGVj3Z2 4y

        Lol

      2. @feedable 4y

        ah, yes, nih

      3. @ZgGPuo8dZef58K6hxxGVj3Z2 4y

        I stopped using Java as soon as I realized you don’t have decimal and that you have to import BigDecimal and it has no operators because operator overloading isnt suppirted

        1. @SamsonovAnton 4y

          Well, I don't remember about Decimal, but .Net did not have BigInteger until version 4.0, and still does not have BigUInteger.

          1. @ZgGPuo8dZef58K6hxxGVj3Z2 4y

            What is biguinteger

            1. @SamsonovAnton 4y

              Like BigInteger, but without that ugly sign and signed-only semantics not needed for unsigned applications. BigInteger is more about regular, abstract math. Real-world apps, like cryptography, need BigUInteger instead, with pre-computations and other high performance stuff.

              1. @ZgGPuo8dZef58K6hxxGVj3Z2 4y

                Noice thx

        2. @RiedleroD 4y

          meanwhile python: not even sure which values are Decimals and which are regular bigints/floats

          1. @SamsonovAnton 4y

            Meanwhile JavaScript: not even sure which values are numbers and which are strings.

          2. @ZgGPuo8dZef58K6hxxGVj3Z2 4y

            Lol js be like: 0.1 + 0.2 == 0.3 true Also JS: 0.1 + 0.2 0.3000000…00004

            1. @RiedleroD 4y

              same in python, but it rounds the last few digits to not seem weird

              1. @ZgGPuo8dZef58K6hxxGVj3Z2 4y

                Looool thats even more evil when debugging

                1. @RiedleroD 4y

                  not really… it only does that when printing directly ig and float comparison has some weird rules too (you shouldn't be doing that anyway)

            2. @feedable 4y

              that's not js's fault

              1. @feedable 4y

                it is like that in every language

              2. @RiedleroD 4y

                yes, that's what I said. read a bit upwards

                1. @feedable 4y

                  it's not unique to python too

                  1. @RiedleroD 4y

                    ye, but I said it's due to how float works - in general

                  2. @ZgGPuo8dZef58K6hxxGVj3Z2 4y

                    null == 0 is false null > 0 is false null < 0 is false null >= 0 is true

                    1. @RiedleroD 4y

                      in python, null doesn't even exist. haha! but None does. 💀

                      1. @ZgGPuo8dZef58K6hxxGVj3Z2 4y

                        Looool

          3. @SamsonovAnton 4y

            Meanwhile Bash: not even sure which values are not strings (unless they are indexed arrays or associative arrays).

            1. @ZgGPuo8dZef58K6hxxGVj3Z2 4y

              Meanwhile asm: not even sure of what is value and what is instruction

              1. @SamsonovAnton 4y

                Not on every architecture. Some distinguish program space and data space, some have separate stacks for code and data.

                1. @RiedleroD 4y

                  these architechtures famously suck for emulating because JITs have to work around that (at least on M1 macs afaik)

                  1. @RiedleroD 4y

                    depends if program space is read-only ig

                2. @feedable 4y

                  why should you have a stack for code

                  1. @SamsonovAnton 4y

                    To be resistant to "arbitrary code execution by stack overflow" at least.

                    1. @feedable 4y

                      ooh, you mean shadow stacks

                3. @ZgGPuo8dZef58K6hxxGVj3Z2 4y

                  Well yeah but it isnt that seperated either

                  1. @SamsonovAnton 4y

                    The address space is shared in this case, the stacks are not.

                    1. @feedable 4y

                      not necessarily

                    2. @ZgGPuo8dZef58K6hxxGVj3Z2 4y

                      You still could end up at a spot where an old code was but its not there anymore

                      1. @SamsonovAnton 4y

                        That would trigger an exception even on x86, I think. However, to be sure one cannot call an arbitrary address, or access arbitrary data by manually constructed pointer (byte-grained), or to use uninitialized data (word-grained), there are hardware-enforced protection technologies.

                        1. @ZgGPuo8dZef58K6hxxGVj3Z2 4y

                          Lol no

                        2. @feedable 4y

                          nx-bit is required

                          1. @ZgGPuo8dZef58K6hxxGVj3Z2 4y

                            But you can’t declare that for evey single byte right?

                            1. @feedable 4y

                              you declare it for a page

                              1. @ZgGPuo8dZef58K6hxxGVj3Z2 4y

                                Yeah thats the problem

                                1. @feedable 4y

                                  how is it a problem?

                                  1. @ZgGPuo8dZef58K6hxxGVj3Z2 4y

                                    Read above

                                    1. @feedable 4y

                                      just map your code as executable, and your heap and stack as non-executable

                            2. @SamsonovAnton 4y

                              If you mix code and data within a page, you are screwed anyway.

                              1. @ZgGPuo8dZef58K6hxxGVj3Z2 4y

                                Well instructions are followed by parameters

                                1. @feedable 4y

                                  these are embedded within an instruction, and you really really should not overwrite them. it's not like you can do that, anyway

                                  1. @ZgGPuo8dZef58K6hxxGVj3Z2 4y

                                    Umm what about JIT?

                                    1. @feedable 4y

                                      you map that code as rwx, and then remap it as r-x

                                      1. @feedable 4y

                                        you can actually not remap it, if you trust your jit to produce valid code

                                2. @SamsonovAnton 4y

                                  If you worry about passing control inside a variable-length instruction, then use an architecture with fixed-length instruction or EPIC / VLIW. 😁

                                  1. @feedable 4y

                                    epic does not have a fixed length

                                    1. @SamsonovAnton 4y

                                      But you cannot successfully jump into an instruction word, I suppose.

                                      1. @feedable 4y

                                        you can always do that regardless of the arch, if you have the permission to do so

                                        1. @SamsonovAnton 4y

                                          The instruction decoder will throw "An illegal instruction" exception upon seeing an arbitrary garbage, unless you are [un]lucky enough to hit a purely valid pattern.

                                          1. @feedable 4y

                                            that will occur only after the jump, the only thing that prevents you from doing the jump itself is mmu

                                            1. @feedable 4y

                                              and if you don't have that, nothing will prevent you from doing anything

    4. @saniel42 4y

      - Has less stupid restrictions - Has "structs" and more memory control in general - Looks better - Has operator overloading

      1. Deleted Account 4y

        -Pawn of Microsoft

        1. @saniel42 4y

          I hope this supposed to be a joke

          1. Deleted Account 4y

            Yes, it is

    5. @Turok1234 4y

      It's just satisfying to write tbh, also in small cities and any other country than USA you have two career options: .Net and JS. Choose wisely as they say

  3. @SamsonovAnton 4y

    In fact, BigInteger is internally implemented as BigUInteger + sign logic. (Well, in fact it is more complex than that, but the basic idea is similar.) Unfortunately, with opaque implementation, it is not possible to not use the things you don't need, nor to add advanced functions (operators), nor extract the values that system implementation computes but discards, returning only one of them. So rolling out your own math library (or using third-party one) instead of System.Numerics is the only way to overcome the basic design.

  4. dev_meme 4y

    I will still this and Clear Watermark from it

  5. dev_meme 4y

    Nobody See me

Use J and K for navigation