Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Silas Reinagel
    @SilasReinagel
    Can you think of any other ways to get Json with the data traits of an Object?
    This was an Object that I created yesterday:
        public sealed class TransactionRequest
        {
            private string AccountId { get; set; }
            private string Description { get; set; }
            private decimal Amount { get; set; }
    
            public TransactionRequest(string accountId, string description, decimal amount)
            {
                AccountId = accountId;
                Description = description;
                Amount = amount;
            }
    
            public Event ToEvent()
            {
                var timestamp = Clock.UnixUtcNow;
                var json = new JsonObjectString()
                    .With(nameof(Description), Description)
                    .With(nameof(Amount), Amount)
                    .With(nameof(timestamp), timestamp)
                    .ToString();
                return new Event(AccountId, nameof(Transaction), 1, json, timestamp);
            }
        }
    yohanmishkin
    @yohanmishkin

    @SilasReinagel thanks for sharing! You covered all the options I can think of (we need that friend modifier! I wanna say I saw a @yegor256 post suggesting something similar trust).

    I remember a while back reading a pertinent post from Mark Seeman that still seems to hold true here. @yegor256, please weigh in if we're missing something here.

    Victor Noël
    @victornoel
    @SilasReinagel I agree with you, even with the pattern I proposed, I could have used a printer like you do.
    I also think that the fact that we use webframework that potentially provides the serialization via things like Jackson makes it hard to intellectually think of the printer approach: I just want at the same time my object to be properly encapsulated but I want to let jackson do its work: obviously there is something paradoxical in this (as you highlighted in ways 1 and 2)
    yohanmishkin
    @yohanmishkin

    Not sure if this has already been undertaken or at least considered, but I'm starting a project to make an Elegant Objects static analyzer for .Net.

    Here's where I'll be working on it if anyone is interested: https://github.com/yohanmishkin/mandatory-elegance

    I started entering the chapters of the two volumes as Github issues
    Once I'm done entering the issues I'll start knocking them out!
    goqp
    @goqp
    Anyone around?
    yohanmishkin
    @yohanmishkin
    @goqp howdy!
    goqp
    @goqp
    Ah some people are still coming around here!
    Zsolt Sandor
    @sz332
    hello
    yohanmishkin
    @yohanmishkin
    Anyone know if Zerocracy is doing singularly java work?
    goqp
    @goqp
    @ Sarah Mei. This is pattently untrue.

    Hey all, as the Yegor research group project (this chat) is ending now, I am making a new research group for OO enthusiasts.
    if you are especially interested in this project please message me.
    Otherwise I will be posting the invite generally in public chat.
    If I dont see you again on the new chat or here, then its been really fun and thanks.
    goqp
    @goqp
    FYI, as I understand it, the new Yegor chat on Telegram is a business oriented chat for professionals. Theres OO dev along the Yegor paradigm, everything is geared towards work and business needs, but its light hearted and you can goof around too. You can hook up on projects and get paid, get help with applying OO to your code, and so on.
    It is not, however, focused on research or experiments in OO. My chat is for this purpose only and will not be satisfying the sorts of needs as Yegor's telegram chat.
    Zsolt Sandor
    @sz332
    @goqp how can I message you? I am looking forward joining the new chat.
    Victor Noël
    @victornoel
    @goqp just advertise it here, no?
    Stian Soiland-Reyes
    @stain
    @goqp looking forward to invite
    Stian Soiland-Reyes
    @stain
    will there be money for opinions? :)
    Josh Schwartzberg
    @dotjosh
    I just read both books -- anyone have any non-hello-world github repo examples of fully adopting the oop practices mentioned?
    Victor Noël
    @victornoel
    @dotjosh check cactoos and other projects by yegor256 on github
    goqp
    @goqp
    email me at goqp@outlook.com
    i added you guys to a list of people I am inviting personally
    @dotjosh Check out my github for an original OOP approach to Yegor's Hangman. Its beta. I will commit a reformatted version a little later.
    If you want Yegor style then I think one or two of the submissions on his challenge site fit pretty well, you can browse.
    Here is my approach: https://github.com/goqp/Hangman
    goqp
    @goqp
    Here are other people's submittals attempting the Yegor (EO) style: https://github.com/yegor256/hangman
    yohanmishkin
    @yohanmishkin
    @goqp could I bother you to add me to the list too?
    goqp
    @goqp
    I did : )
    I will msg you all when Ive got it up
    anyone around?
    goqp
    @goqp
    alright, anyone who wants to continue with research and experimentation, eventually production, is invited to come to my new group!
    Zsolt Sandor
    @sz332
    @goqp wrote you a private message on gitter,ű
    Joshua Light
    @JoshuaLight

    Hi guys!

    Need some help from OOP mind people. ))

    What if I have something like Item, which can be Weapon, Armor or whatever, and I want to render it on the screen.

    Method Direct3D.Render( Item item ) will render it through image path and some APIs, but Console.Render( Item item ) will render it using just type and name, for example, "Weapon: Frostmourne".

    In such approach there is no way to remove type casting or some kind of getters because every rendering method is tightly coupled with render-specific details.

    There is no way to generalize RENDERING (?).
    There is no way to use inversion of control (what I really want), because Item cannot depend on concrete rendering implementation.
    There is no way to create something like Direct3DItem or ConsoleWeapon, because if it's decorator of Item, it has access to only its public members, but wait, we have only behaviour here...

    Generally speaking, the main problem here is that logic of objects representation is conceptually needs to ASK for data (through cast or getters, whatever). But, for example, Yegor's printers (I like them, actually) are based on idea of TELLING object to print itself (or render itself).

    How this can be possible, if knowledge of object representation exists only in representation system and cannot be shared with object domain?
    Does anyone tried to generalize rendering through some kind of printers?

    Laurent V.
    @monsieurluge
    "Print itself" means, in my opinion, to know how to give the informations to the receiver. In your case, the Item knows how to give to the renderer the mesh, textures, etc
    Game send the [render(Renderer)] message to Item, then Item -> [mesh(data)] -> Renderer, and so on.
    I'm probably wrong but it's what i'll try if i need to do that kind of stuff
    Joshua Light
    @JoshuaLight

    I agree and really like such approach.

    But the problem here is the knowledge about "mesh, textures, etc". Item cannot have that knowledge. Why?

    Well, the easiest answer is just because there is a LOT of such knowledge. Item will blow. Sometimes I can't even access rendering library from domain model (physically).
    The other one is a metaphor of painting: I can represent every object in the world in a tremendous possible ways, and this object doesn't even know about that. Its behaviour remains unchanged.

    Laurent V.
    @monsieurluge
    The Item object is not the same as the RenderableItem. The first exposes the right behaviour to be wear, add bonuses to the player, etc, and the second knows only how to interract with the renderer
    The knowledge must be cut in parts
    Joshua Light
    @JoshuaLight
    But what RenderableItem will be kind of? Is it a decorator over an Item? If RenderableItem has access to data, that allows it to render an Item, then every other object can access the same data, so we already violated some principles.
    Laurent V.
    @monsieurluge
    For me its two different kind of objects, no decorator here
    The data of an Item (mesh, textures, etc) is not the same as the data used to give bonuses to the actor, the fire rate, etc
    Joshua Light
    @JoshuaLight
    Well, again, if RenderableItem can render an Item, then Item should have getters to allow that.