Can C# decompress unknown files compressed with CoDec::Compress calls in C/C++?

This is a discussion on Can C# decompress unknown files compressed with CoDec::Compress calls in C/C++? within the C# Programming forums, part of the General Programming Boards category; I find it ironic that he failed to realize an imprecision on my post, while deciding to batter at someone ...

  1. #16
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,412
    I find it ironic that he failed to realize an imprecision on my post, while deciding to batter at someone whose post was stainless, judging them as clueless.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  2. #17
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,590
    Son, Bubba has more lines of code under his armpit than you can possibly carry in your brain. I suggest you find another target.
    Hehe. This made me laugh. While I do program quite a bit I'm sure there are many members here with many more years of experience than I and who have written far more code than I have. That being said I do appreciate the defense.

    At the OP:
    Let's look at your original post in detail and allow me to explain why I feel the way I do about it:

    C# is a much more structured programming language...
    Please explain. I will go out on a limb here and say that no one here feels this way. Why do you? How is it 'more structured'? What does 'more structured' mean? It is a very broad and very vague claim.

    there's less that could go wrong...
    In context this means that you believe in C# there is less that could go wrong. Please explain this as my viewpoint is that in any programming language there is a whole host of things that can go terribly wrong. Languages are tools and as such can be misused and abused. Please understand that be it C++ or C# or Java or Visual Basic or whatever language you want that the code can go terribly wrong very quick if there is a lack of design or a poorly thought out design. This is why I take issue with this statement.

    ...and I don't have to rely on getting my C++ correctly built to handle all the possibilities, plus I would be spending a lot more time having to go through possible cases with C++ whereas I could use C# to simplify things a bit as stated below.
    Really? Do you feel that 'handling all the possibilities' is somehow poor programming practice? I feel quite the contrary and believe that it is the programmer's responsibility to not only handle but test error conditions to ensure they are handled correctly or gracefully. Why would choice of language change this fundamental software engineering principle? Based on that statement alone I would never want to see or work with your code. Now your code may actually handle things correctly but your choice of words here is quite poor. I would not recommend saying this to any competent programmer without expecting some kind of rebuke.

    Classes mean a lot more in C# than they do in C++ and the nature of them means if correctly designed, I could save a lot of programming just by building the classes properly.
    I already addressed this statement in my first post so I won't spend much time on it. But in short correctly designed classes in any language that supports them or..correctly designed code in any language will save you a lot of re-factoring and will reduce the number of bugs. This has nothing to do with language and is more about using good software engineering practices.

    There is much more developed Windows Forms accessibility in the Microsoft C# implementation.
    This is no longer true. You can access WinForms from C++/CLI but I do not recommend it. Microsoft recommends using WPF for all future development but the transition and adoption has been slow primarily due to the WPF designer (codenamed Cider) in MSVS 2008. MSVS 2010 has a much better designer and various developers have had more time to digest WPF and become accustomed to it. Those who have adopted WPF recently usually wonder why they ever enjoyed WinForms in the first place. The XAML for WPF is a bit annoying at first but after spending some time with it most devs really start to enjoy WPF. So your statement is true and yet not so true.

    That being said, I do find C# more difficult than C++ to get to grips with, maybe it's because C# actually requires you to think things through and plan out your methods and program flow, where with C++ you can get by with messes of simplistic statements that don't really represent the flow through your program properly. I did try C++ initially, but after someone pointed out that a lot of poorly built code would look like spaghetti code with no real meaning or purpose,
    With this kind of mindset you will have no more success in C# than you did in C++. Please if you are not thinking things through and planning before you write code then do not write code. You must think, plan, and design your code prior to implementing it. If you do not you are simply asking for trouble later. Poorly built C++ is spaghetti code but poorly built C# is just as much spaghetti code. So in essence poorly built and poorly designed code is just plain and simple poor code. The use of good software engineering principles can and will alleviate a lot of these problems. I assure you that my early projects were spaghetti code but some of my more recent work is most assuredly not spaghetti code in C#, C++, C++/CLI, or whatever language I'm using. Spaghetti code is not a factor of language but a factor of skill and experience.

    ...I decided I wanted to at least give C#'s more methodical programming a try.
    You seem to be misinformed about C# and the benefits it offers. What exactly do you mean by C#'s methodical programming? This is not a feature of C# that I am aware of nor a reason to use or not to use it. C# and C++ are very similar and yet very different but this is not on either list.

    I did want to have a thorough go at doing it in C#, if someone could point out things C# could not do with data manipulation from an input file that are possible with C++, then please do.
    There is nothing you can do in C++ that you cannot do in C# and there is nothing you can do in C# that you cannot do in C++. That being said there is such a thing as using the right tool for the job. C++ and C# are both adept at file handling, number crunching, etc. C# is obviously not as fast as C++ but it is very fast. I personally enjoy both languages very much and only rarely have I found times where C# appeared to be working against me instead of for me. This happens less in C++ but that could be because I am more familiar with it.

    However, kindly take discussion of which language is better to the appropriate forum here, as I do not wish for this topic to devolve into "which language is better" discussions and flaming.
    Quite honestly, and I will be frank here...you have not shown that you know enough about either language to start a flame war. If there was a flame war here, and I'm not aware of any, it would be about your statements instead of about C++ and C#. We have had many discussions about C# and C++ and all of us realize at the end of the day they are both just tools of the trade. Use whichever one works the best for your project. You can never go wrong with that mindset.

    I do apologize if my post seemed I was yelling at you because that was not the intent of it. But I am not 'acting' as if I know this or that because I work in both of these languages every day. Do I know everything about C# and C++? There is no way in the world I would make that claim because there is always something I do not know or have exposure to. Keep in mind that a lot of people visit these forums and many of the regulars around here are professional programmers. They know their stuff inside and out and you would learn much and do well to listen to them. If you are willing to listen, learn, and help others as you learn more and more then this forum is the perfect place for you. I would not be half the programmer I am today without the members of this forum. There are some very talented and experienced programmers here on this forum and they will help you better your skills if you will let them.
    Last edited by VirtualAce; 01-07-2011 at 05:42 PM.

  3. #18
    Registered User
    Join Date
    Jan 2011
    Posts
    8
    You know, after reading Bubba's post, I think I'm looking for a language that's easier to get to grips with.

    I want to know if there is a programming language out there that can help people who have a general idea of what they want to accomplish but lack programming skills or the time to develop such, and that uses an interpreter to write out code from some queries the user inputs.

    I will say that no language would be a substitute for writing code, but both of these languages have a really steep learning curve. I wonder if I'm wasting time trying to learn the ins and outs of these languages, but should just get on with solving the problem at hand.

    Cheers ...

    DarkVoid

  4. #19
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,412
    As for the imprecision in my post, I obviously meant to say you cannot separate interface from implementation in C#, not "you cannot separate declaration from definition in C#". Dunno why I wrote that...

    This is the one thing that annoys me in C# and that leads to confusing and hard to read code, that while not exactly classifiable as "spaghetti code", it's not far from it. Now, the ability to partition classes definitions in C# is quite interesting. But that's the only device we have in order to facilitate class maintenance. It's just not enough. C# is thus incredibly dependent of the IDE tools in order to be maintained and the code to be followed. Whereas C++, not so much.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  5. #20
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,590
    This is the one thing that annoys me in C# and that leads to confusing and hard to read code, that while not exactly classifiable as "spaghetti code", it's not far from it. Now, the ability to partition classes definitions in C# is quite interesting. But that's the only device we have in order to facilitate class maintenance. It's just not enough. C# is thus incredibly dependent of the IDE tools in order to be maintained and the code to be followed. Whereas C++, not so much.
    I agree and disagree. I detest not having headers but I also detest headers in C++. I detest them b/c the IDE does not facilitate my use of them and forces me to do a ton of copy/paste to get my headers and impl all squared away. There is the class designer but the code it spits out is messy IMO and I'd rather not use it. I do not know of a way to change this.

    However in C# I detest not having headers because it makes the code hard to read. I use regions a lot because it is very hard to see the structure of a C# class at a glance. Plus if you use the very nice auto commenting feature in MSVS 2008+ for C# you will have a lot of comments in your code. I use StyleCop and FXCop which forces me into a style based on a set of customized rules as and such there are a lot of comments. It does make the code very hard to read so I normally try to divide it up into Fields, Public methods, Private methods, Properties, etc. StyleCop forces you to put various methods and fields in a certain order so this fits right in with it.

    Also due to the lack of headers in C# you can have an interface in a DLL that has no implementation. The reference to the DLL acts as a header so other parts of the code can access the interface. This is very strange and contrary to C++ and takes some getting used to. I was definitely not used to having a DLL with a pure virtual class in it (IE: a C# interface class) and no implementation. In C++ you would merely put this into a header and then clients would include the header, derive from the interface, implement, etc.

    Also I think overall C# code is just uglier than the equivalent C++. This could be because of the lack of headers and the fact that the files get quite lengthy. Of course this could be a result of my lack of experience with C# but I would like to think I am fairly adept at designing classes in either language.

    C# is definitely an awesome language and the team at MS responsible for it did a tremendous job. It is not without its quirks and areas that need a bit more attention in future versions but overall it is a solid programming language.

  6. #21
    Registered User
    Join Date
    Jan 2011
    Posts
    8
    Quote Originally Posted by Bubba View Post
    I agree and disagree. I detest not having headers but I also detest headers in C++. I detest them b/c the IDE does not facilitate my use of them and forces me to do a ton of copy/paste to get my headers and impl all squared away. There is the class designer but the code it spits out is messy IMO and I'd rather not use it. I do not know of a way to change this.
    You make an interesting point there about headers. Particularly with the Microsoft Visual C++/C# implementations, you need to specify the proper headers in the former and the proper namespaces in the latter. However, both Microsoft's Visual C++/C# won't tell you if you need to use an associated include or using statement for these namespaces when you write a new function that uses a namespace.

    However in C# I detest not having headers because it makes the code hard to read. I use regions a lot because it is very hard to see the structure of a C# class at a glance. Plus if you use the very nice auto commenting feature in MSVS 2008+ for C# you will have a lot of comments in your code. I use StyleCop and FXCop which forces me into a style based on a set of customized rules as and such there are a lot of comments. It does make the code very hard to read so I normally try to divide it up into Fields, Public methods, Private methods, Properties, etc. StyleCop forces you to put various methods and fields in a certain order so this fits right in with it.
    I like comments. I'm a fan of comments, in fact I would go out of my way to comment every line of code in my program if there were only enough time in the universe! Aagh! Stop me already! Seriously, comments are good, if they are used where and when needed. Otherwise they're more of a nuisance than a help.

    C# is definitely an awesome language and the team at MS responsible for it did a tremendous job. It is not without its quirks and areas that need a bit more attention in future versions but overall it is a solid programming language.
    It's definitely a good language, but generally speaking, I think Microsoft need to stop being so damned determined to make their Visual series of compilers/editors so hard to use that you feel as if you need a university degree in using them!

    They could start to help new users trying to learn something by handing them small servings of help when needed most and with something that helps the user understand why code they're using wouldn't compile instead of cryptic error messages that only refer to a line where something is wrong, especially when it depends on something Microsoft don't mention in their own code examples. I spent over an hour trying to find why one particular section of code wouldn't work in C++, it turned out that I'd slightly misspelled one command, and therefore the compiler decided I had an error somewhere further down and never told me about the incorrect command.

    You wouldn't believe it could happen but there are some C++ commands that are similar but which have very different syntax, and if you put the wrong command there, you will spend a lot of time trying to find and fix bugs due to this!

    Cheers ...

    DarkVoid

  7. #22
    Registered User
    Join Date
    Aug 2003
    Posts
    1,198
    Debugging and finding compile errors is something you will learn with time. As you program more you will start to recognize error messages and you will connect them to a particular error, so that is something that will improve as you improve.

    Visual studio probably feels hard to use now because (i guess) you are still quite inexperienced with it. This is only natural since it is a full programming suite that accomodates several languages and it has alot of tools that may seem redundant for a hobby-coder but are absolutely vital for professionals (and some nifty ones you and me probably don't know about ). This also is something you get used to, as you use the IDE and find out new features all the time you will find that it is quite nice to work with (at least in my opinion).

    About the comments on C# vs C++, I must say I agree with pretty much all of what bubba is saying. Sure C# has partial classes but I think this can be dangerous aswell since if you want to get a good overview over a class you
    1. Have several files to scan through and if you aren't careful and say put member data in all of the partials then you might have a real problem trying to figure exactly what data you are using.
    2. might miss a file which then leads to an incomplete overview

    But on the other hand, it's nice not having to write headers

    That said though I think Microsoft has done a damn good job with VS to make it a good C# dev. platform.

  8. #23
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,590
    @DarkVoid:

    I took the time to digest your post in great detail and I asked you some very pointed questions. If you want to discuss C# I need to get a feel for where you are with it to see if I can assist you. So back to the original question what exactly are you trying to do and why are you using C# to do it?

  9. #24
    Registered User
    Join Date
    Jan 2011
    Posts
    8
    Quote Originally Posted by Bubba View Post
    @DarkVoid:

    I took the time to digest your post in great detail and I asked you some very pointed questions. If you want to discuss C# I need to get a feel for where you are with it to see if I can assist you. So back to the original question what exactly are you trying to do and why are you using C# to do it?
    I could answer you better if I could attach a file, so it could be unpacked directly. Unfortunately I can't attach zip files to this board. Is there a PM function on these boards, and does it allow zip files to be sent?

    As far as working with C# is concerned, I'm still pretty new to the whole concept and about as new to it all as I am with C++, but like I said in earlier posts I wanted to create real code, not something that looks like a mess of spaghetti and is impossible to debug.

    Cheers ...

    DarkVoid

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. added start menu crashes game
    By avgprogamerjoe in forum Game Programming
    Replies: 6
    Last Post: 08-29-2007, 01:30 PM
  2. Linking header files, Source files and main program(Accel. C++)
    By Daniel Primed in forum C++ Programming
    Replies: 3
    Last Post: 01-17-2006, 10:46 AM
  3. Reading compressed files
    By clancyPC in forum C Programming
    Replies: 4
    Last Post: 10-04-2005, 10:38 AM
  4. Writing Compressed Image Files
    By BenBartle in forum C++ Programming
    Replies: 1
    Last Post: 03-09-2005, 07:55 PM
  5. Replies: 1
    Last Post: 05-02-2003, 07:27 PM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21