Software architects need to burn in hell



  • Status:

    So we have two C# projects:

    Company.API (REST-based web API)
    Company.API.Business (business logic for said API)

    Awesome! I just need a couple of functions in the Business logic for this quick and dirty CLI app I'm making, so I'll just add a reference to it and-- wait...

    Oh right. IoC.cs. This project is one of the stupid ones we have set up with Inversion of Control. What a shitter. Add reference, add reference, add reference, add reference, ok. My "simple" quick and dirty CLI app now pulls in literally 23 other projects, just to make the IoC.cs happy.

    NOW I can finally build-- wait what? "Missing reference: Company.API.Foobar". Uh. Note that doesn't say "Company.API.Business.Foobar". Because that would make sense. No, this particular namespace is in the WEB APP. Company.API.Business has a circular reference BACK to Company.API. Jesus.

    So now my "simple" quick and dirty CLI app now pulls in literally 24 other projects, and builds an ENTIRE WEB APPLICATION.

    HEY GUYZ! SOMEONE TELL ME HOW GREAT IoC IS AGAIN!!!!! Because it's REALLY made my day a joy!



  • Oh and as an added plus, now that I've finally sorted all that bullshit out, I get to debug this error:

    Error 41 The type 'TypeValidator' cannot be used as type parameter 'CONCRETETYPE' in the generic type or method 'StructureMap.Configuration.DSL.Expressions.CreatePluginFamilyExpression<PLUGINTYPE>.Use<CONCRETETYPE>()'. There is no implicit reference conversion from 'TypeValidator' to 'FluentValidation.IValidator<Type>'.

    WHAT THE FUCK IS THIS GIBBERISH.

    EDIT:

    I should note that TypeValidator is literally defined as:

    class TypeValidator : FluentValidation.IValidator<Type>



  • @blakeyrat said:

    this quick and dirty CLI app I'm making

    Who are you, and what did you do with the real blakeyrat?



  • I'm a bit out of touch.

    Why is IOC requiring all these additional references, that a normal library wouldn't?

    Also, can't you just go around the IOC and just pick out the classes you need to instantiate directly?



  • @cartman82 said:

    I'm a bit out of touch.

    Why is IOC requiring all these additional references, that a normal library wouldn't?

    Well the way the project's structured, it might not be much of a difference in the number of references.

    But if they were NORMAL references, it'd be impossible to have:

    Company.API -> Company.API.Business

    And also:

    Company.API.Business -> Company.API

    Circular references like that are a compiler error under normal circumstances. So this IoC configuration is basically using all kinds of reflection bullshit to bypass normal compiler sanity checks.

    @cartman82 said:

    Also, can't you just go around the IOC and just pick out the classes you need to instantiate directly?

    In theory yes.

    In reality the dependency tree is ridiculous.

    FooService requires FooAuthService which requires FooRoleProvider which requires FooRoles which requires Roles which requires CompanyAuth
    FooService also requires FooDatabase which requires Foo blah blah

    I actually started down that road and 2 hours later and got about 6 layers in, then decided just installing the IoC framework would be "easier". Stupid fucking me.



  • @blakeyrat said:

    WHAT THE FUCK IS THIS GIBBERISH.

    BTW, I "fixed" this error by simply doing a Clean, then another Build.

    These shitty third-party black-box libraries are SO black box that even the IDE can't figure out what the fuck's going on with them.


  • Discourse touched me in a no-no place

    @blakeyrat said:

    I should note that TypeValidator is literally defined as:

    I've seen something like that before. Search for "explicit inheritence information" I think.

    IIRC it boils down to "you need to cast your class to the interface". Yes it's just as silly as it seems.



  • @blakeyrat said:

    Circular references like that are a compiler error under normal circumstances. So this IoC configuration is basically using all kinds of reflection bullshit to bypass normal compiler sanity checks.

    Interesting.

    There's probably a good reason why VS forbids you from adding circular dependencies.

    I wonder what wonderful obscure bugs will this cause when you least expect it.

    @blakeyrat said:

    FooService requires FooAuthService which requires FooRoleProvider which requires FooRoles which requires Roles which requires CompanyAuthFooService also requires FooDatabase which requires Foo blah blah

    Sounds like the problem is more the complexity of the stuff you want to use (or over-architected classes) than the IoC itself.



  • I'm actually surprised it builds, but the reason is that if you add a web app to a solution but don't set it to "Startup project" it just builds like a library.

    Which is good I guess. But still stupid.



  • @blakeyrat said:

    I'm actually surprised it builds, but the reason is that if you add a web app to a solution but don't set it to "Startup project" it just builds like a library.

    Which is good I guess. But still stupid.

    Oh yes. If you ever add a reference to a "runnable" project, STOP YOU'RE DOING IT WRONG.

    Those should always be at the edges of the dependency graph.



  • @cartman82 said:

    Oh yes. If you ever add a reference to a "runnable" project, STOP YOU'RE DOING IT WRONG.

    I realize I am doing it wrong, thus this post.



  • @blakeyrat said:

    I realize I am doing it wrong

    I am not long at this forum. But isn't this a very very special post?



  • @blakeyrat said:

    I realize I am doing it wrong, thus this post.

    Very productive post it was.

    We have uncovered that the root of your problem isn't IoS, but the poor design of your solution.

    If we keep digging, you might end up sobbing how you can never feel like a man because your mother bathed you until you were 9 or some shit.



  • I don't usually make posts like this because when I do it's like a big long back and forth about:

    WTF, I did it wrong

    WHY ARE YOU DOING IT WRONG?

    There's no other way to do it

    BUT YOU'RE DOING IT WRONG!

    I know that's why I posted it here

    YOU SHOULD DO IT THIS WAY

    That doesn't work because X

    BUT YOU CAN'T DO IT HOW YOU'RE DOING IT BECAUSE THAT'S WRONG!

    I know it's wrong. That's why I posted it here.

    etc etc etc.

    See the one about sending an analytics pixel on page unload on the old forum archive for a good example of this sort of thread.


  • Notification Spam Recipient

    @Dlareg said:

    this

    Everyone is required to post at least once in the Side Bar WTF something they've done that's worthy of a :wtf:.
    You're not an official member of the forums if you lack such a post.
    Those who are indeed active in the forums but have not yet posted here are merely biding their time for when the weeds start to tumble.



  • Having worked in science and engineering I have produced a lot of shit. A lot of it I cannot find. Some I can but I have to somehow post kind of anonymous. I have some nice code which almost destroyed an actual building.



  • IoC as a concept is good, the people at your company have just gone way overboard.

    Long story short: the architecture sucks.



  • @blakeyrat said:

    quick and dirty CLI app I'm making

    You're making git?



  • UPDATE

    I explained this story to my boss and how long it was taking to sort out all the bullshit (I had just started figuring out which interfaces I needed to implement to bypass the default Auth stuff) and he said:

    Screw it, make a WebClient and just call the API

    So now I'm doing that.


  • Notification Spam Recipient

    @blakeyrat said:

    So now I'm doing that

    Well at least you don't need to worry about deploying an app to the computers, right?



  • @blakeyrat said:

    BTW, I "fixed" this error by simply doing a Clean, then another Build.

    Sounds like a dependency issue. Those are always fun.



  • A non deterministic compiler makes visual studio sound like a sack of asses.


  • BINNED

    @Captain said:

    a sack of asses

    Is that a bad thing?

    Edit: found it, well I guess it depends on the quality of the asses then.


  • Considered Harmful

    @Captain said:

    A non deterministic compiler makes visual studio sound like a sack of asses.

    You mean like Go?



  • Every time I call malloc() I get a different result. Suuuuuuuck...



  • If you had just checked, you would have found out that malloc() is not deterministic, according to the SQL standard. šŸ˜›



  • Also, the C# language specification is only available as a docx file. Ughffff.


  • Fake News

    @Dlareg said:

    I have some nice code which almost destroyed an actual building.

    I'm curious what that could be.

    Just don't post it anywhere @flabdablet can read it, he wouldn't mind putting it in the "long name" field above every single one of his posts.


  • Winner of the 2016 Presidential Election

    @Tsaukpaetra said:

    Everyone is required to post at least once in the Side Bar WTF something they've done that's worthy of a :wtf:.You're not an official member of the forums if you lack such a post.

    šŸ˜¢

    But...but..I'm perfect! Or inexperienced. That's probably it, actually. Anyone hiring? šŸ˜¬



  • @Tsaukpaetra said:

    Everyone is required to post at least once in the Side Bar WTF something they've done that's worthy of a :wtf:.

    I did some terrible c macros trying to avoid repeating logic. Totally not worth it, I'm reverting that shit.


  • Notification Spam Recipient

    @fbmac said:

    c macros

    You only do macros once. šŸ˜›


  • Winner of the 2016 Presidential Election

    @fbmac said:

    I did some terrible c macros trying to avoid repeating logic. Totally not worth it, I'm reverting that shit.

    Mm, macroni 'n' C's.
    Ā 
    Ā 
    Ā 



  • It is actually a very simple piece of basic :wtf: ery.
    if (8 == p) { p = 7}
    This was supposed to clamp the int p value of a PID controller to values of 7 or lower. The initial software only gave increments of int 1. After an update it became smarter and also had steps of 2 and 3.
    In normal life this is not much of a problem.
    When controlling the rotation of several tons of radar systems the structural integrety of the building became in danger. Some vibrations where felt and cracks appeared in the walls. The building was evacuated and checked for several weeks before people were allowed inside.
    I guess that is what you get if you let a intern program system critical systems and do not provide proper guidance.



  • @Tsaukpaetra said:

    You only do macros once.

    One of my most favorite set of macros

    #define STRING2(x) #x
    #define STRING(x) STRING2(x)
    #define FILE_LINE __FILE__ "(" STRING(__LINE__) ") : "
    #define PRAGMA_MESSAGE(x) message( FILE_LINE #x )
    #define PRAGMA_TODO(x) message( FILE_LINE "TODO: " #x )
    #define PRAGMA_FIXME(x) message( FILE_LINE "FIXME: " #x )
    

    Then use like
    #pragma PRAGMA_TODO(Implement with new requirements)


  • Notification Spam Recipient

    @dcon said:

    my most favorite
    Because having your to-do list is better to appear in the build logs for visibility?



  • @Tsaukpaetra said:

    Because having your to-do list is better to appear in the build logs for visibility?

    These are frequently short term / in development things. Essentially reminders so I don't forget to update something. It takes very few interruptions before my stack faults. So... Yes.

    (The best thing about that pragma is that it generates a line in VS's output window that can be double-clicked.)



  • @Tsaukpaetra said:

    Because having your to-do list is better to appear in the build logs for visibility?

    You can use it to annoy your coworkers.

    #pragma PRAGMA_TODO(Who wrote this awful code, Was it Anthony?)
    

  • Notification Spam Recipient

    Lol, probably? If it ended up that I am blamed, and it is indeed correct, I will be gracious enough to uphold such a judgment.
    In fact, I support my stuff (mostly) past reasonable expectancy. If anyone wants to call me back up to fix something I made years ago, I'll first put them on hold for a second and celebrate the fact that my stuff had a life span measured that long, then resume the call and help out where I can. I like to think I have that kind of integrity, as unappreciated and tactically worthless it is.



  • @dcon said:

    One of my most favorite set of macros

    #define STRING2(x) #x
    #define STRING(x) STRING2(x)
    #define FILE_LINE __FILE__ "(" STRING(__LINE__) ") : "
    #define PRAGMA_MESSAGE(x) message( FILE_LINE #x )
    #define PRAGMA_TODO(x) message( FILE_LINE "TODO: " #x )
    #define PRAGMA_FIXME(x) message( FILE_LINE "FIXME: " #x )
    ```</blockquote>
    
    Remind me again why the intermediate `STRING2` macro is needed? It's one of those things I used to know but have now forgotten through lack of use.


  • This post is deleted!


  • @flabdablet said:

    @dcon said:
    One of my most favorite set of macros

    #define STRING2(x) #x
    #define STRING(x) STRING2(x)
    #define FILE_LINE __FILE__ "(" STRING(__LINE__) ") : "
    #define PRAGMA_MESSAGE(x) message( FILE_LINE #x )
    #define PRAGMA_TODO(x) message( FILE_LINE "TODO: " #x )
    #define PRAGMA_FIXME(x) message( FILE_LINE "FIXME: " #x )
    ```</blockquote>
    
    Remind me again why the intermediate `STRING2` macro is needed? It's one of those things I used to know but have now forgotten through lack of use.</blockquote>
    
    `STRING2(__LINE__)` will just produce "\_\_LINE\_\_".  Here's a full explanation:
    
    http://www.jaggersoft.com/pubs/CVu10_1.html

Log in to reply