Framework WTF



  • Before you read this post, keep in mind that this "framework" is used as an example of good coding in a software engineering class.

    The Pop Framework

    Here's a sample class:

    class cArchiveHint : public CObject
    {
    	DECLARE_DYNAMIC(cArchiveHint) //so we can check the runtime class in 
    
    CPopView::OnUpdate.
    private:
    	CArchive * _parchive;
    public:
    	cArchiveHint(CArchive *parch):_parchive(parch){}
    	~cArchiveHint(){}
    	CArchive* parchive(){return _parchive;}
    };

    There are several classes like that one in the PF, most as useless. The names are also somewhat misleading - for example, the file PopDoc.h contains these classes:

    cArchiveHint
    cTimeHint
    CPopDoc (capital C is not a typo, the classes switch between the two often)

    CPopDoc has nothing to do with documentation. I don't really know what it does, though, since its methods have definitions like "cBiota* pbiota();", and data members like "static const int PATTERNS;". Even though it's C++ code, macros are used heavily for things like runtime type detection. It might have something to do with event handling, based on code in the .cpp:

    Not to mention most of the configuration parameters for the classes are static. So, if you want to have one instance of CArmedCritterRival move slower than the others you'll have to subclass is (maybe cSlowArmedCritterRival). The exception are the data members that with names like _someval, or mrealspeed, or pdt.

    There does not appear to be any documentation for the framework, not even a UML flowchart or autogenerated API documentation. I'm trying to create a small guide for the quarter, but if you never hear from me again you'll know why. It's because I'll have bleached my eyes out.



  • Well, the forum seems to have stripped my newlines. Put a few of these
















    in there.



  • Do you not recognize that framework?

    It's Microsoft Foundation Classes (MFC), that abomination of a C++ API that wraps Win32. All of those macros, like IMPLEMENT_DYNAMIC, or IMPLEMENT_DYNCREATE are part of MFC. *shudder*

    Just so you know, CPopDoc likely doesn't refer to documentation, but to a *document*, which is the way MFC refers your data objects (the Model portion of a Model View Controller/MVC architecture). I'll bet CPopDoc derives from CDocument.

    Did I mention how much I hate MFC? There are so many good things about it, so many good ideas, implemented in so terrible a way. It's like two people were behind the entire design -- one a damn good software architect, the other a fucking looney -- and they just split the whole project in half, then sewed it all together and called it MFC. Tell  your professor to look into .NET. He'll get 10 times saner after his first .NET program.



  • @Whiskey Tango Foxtrot said:

    Tell  your professor to look into .NET. He'll get 10 times saner after his first .NET program.

    He doesn't want to use .NET, because according to him it doesn't run on Linux.



    The whole class is a WTF



  • @Lews said:

    He doesn't want to use .NET, because according to him it doesn't run on Linux.

    The whole class is a WTF

    That's awesome...  don't you love academia.



  • Did I mention how much I hate MFC?
    There are so many good things about it, so many good ideas, implemented
    in so terrible a way. It's like two people were behind the entire
    design -- one a damn good software architect, the other a fucking
    looney -- and they just split the whole project in half, then sewed it
    all together and called it MFC. Tell  your professor to look into .NET.
    He'll get 10 times saner after his first .NET program.




    Ugh, don't encourage writing client side programs that require gigantic
    VMs. Every program needing hundreds of megs of RAM may be fine on the
    server-side where only one program at a time is in use anyway, but I
    happen to like being able to multitask.



    (although, C++ programs aren't always much better - firefox.exe is at
    77MB right now, and I've only had it open for a couple hours)



  • @Goplat said:

    Did I mention how much I hate MFC?
    There are so many good things about it, so many good ideas, implemented
    in so terrible a way. It's like two people were behind the entire
    design -- one a damn good software architect, the other a fucking
    looney -- and they just split the whole project in half, then sewed it
    all together and called it MFC. Tell  your professor to look into .NET.
    He'll get 10 times saner after his first .NET program.




    Ugh, don't encourage writing client side programs that require gigantic
    VMs. Every program needing hundreds of megs of RAM may be fine on the
    server-side where only one program at a time is in use anyway, but I
    happen to like being able to multitask.



    (although, C++ programs aren't always much better - firefox.exe is at
    77MB right now, and I've only had it open for a couple hours)




    There's something wrong if your .NET programs need hundreds of megs of
    RAM. I've written programs in C# and while they aren't the tiniest in
    RAM usage, they certainly don't use a lot. They also start up pretty
    fast and run well too. .NET is a great framework and a great option for
    client side apps.



  • @Lews said:

    @Whiskey Tango Foxtrot said:

    Tell  your professor to look into .NET. He'll get 10 times saner after his first .NET program.

    He doesn't want to use .NET, because according to him it doesn't run on Linux.

    The whole class is a WTF

    First, go to your dean/chair/head/whatever of the Computer Science dept, and lodge a formal complaint. Then, if your school has those end-of-semester competence questionaires like mine did, blast him there. Write a novel about how shitty the class was and how moronic the professor was, and how you are now stupider for having taken the class. Not that I'm trying to insult you, but that line (stolen from Billy Madison) works wonders in my experience....  



  • @Goplat said:

    Ugh, don't encourage writing client side programs that require gigantic VMs. Every program needing hundreds of megs of RAM may be fine on the server-side where only one program at a time is in use anyway, but I happen to like being able to multitask.

    (although, C++ programs aren't always much better - firefox.exe is at 77MB right now, and I've only had it open for a couple hours)

    .NET is no different than Java in that regard, and .NET actually is faster than Java in most cases (anecdotally, I'd say every case).



  • @Goplat said:

    Ugh, don't encourage writing client side programs that require gigantic VMs. Every program needing hundreds of megs of RAM may be fine on the server-side where only one program at a time is in use anyway, but I happen to like being able to multitask.

    Do you even grasp how the .NET framework works?  Your "gigantic VM" is an pair of itty bitty compilers (csc.exe is 76K, ilasm.exe is 220K) that convert your high-level-language code into intermediate language (IL) - essentially a hardware-agnostic assembly language - and then JIT-compiles it at runtime (and only when necessary - the system caches the compiled result) into native machine code.  VB6 was the last "VM" language.

    That's not to say that one cannot write bloated code in .NET.  However, it's not like C++ where you could compile in every static library known to man.



  • I think Goplat may have been referring to the System.*.dll files that are required by the runtime. Well, only mscorlib.dll is required, but the other parts of the .NET library are very useful. The whole download is only around 10 MB.

    I think Goplat may have just been trolling.



  • Er, I meant around 20 MB...



  • @GalacticCowboy said:

    VB6 was the last "VM" language.

    I think I'm having a flashback...

    VBRUN.EXE

    MY EYES! MY EYES!



  • @GalacticCowboy said:


    @Goplat said:

    Ugh, don't encourage writing client side programs that require gigantic VMs. Every program needing hundreds of megs of RAM may be fine on the server-side where only one program at a time is in use anyway, but I happen to like being able to multitask.

    Do you even grasp how the .NET framework works?  Your "gigantic VM" is an pair of itty bitty compilers (csc.exe is 76K, ilasm.exe is 220K) that convert your high-level-language code into intermediate language (IL) - essentially a hardware-agnostic assembly language - and then JIT-compiles it at runtime (and only when necessary - the system caches the compiled result) into native machine code.  VB6 was the last "VM" language.

    That's not to say that one cannot write bloated code in .NET.  However, it's not like C++ where you could compile in every static library known to man.



    Well, the first .Net app opened does load quite a bit of system assemblies, but after the first, they're shared among all of the opened apps. The original complaint either came about because most people don't really know how much memory is really in use at any given time (some of it may be reported multiple times) or too much exposure to Java. (shiver!)

Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.