1 2 3 4 5 6 7 8 9
Player (42)
Joined: 12/27/2008
Posts: 873
Location: Germany
Warp wrote:
What irks me is when people start inventing flaws that it doesn't have (eg. templates being slower than explicit code), or exaggerate problems that are completely inconsequential in 99.99% of cases (such as compiling times being longer in certain situations.) If you had stated actual problems C++ has compared to other languages, accurately and without exaggeration, then I wouldn't have had any complaint.
Twice you have implied that I'm arguing in bad faith, and this is all because of assumptions of yours that are entirely your fault, therefore my answer now won't be as polite. First of all, who the hell do you think you are to say I'm inventing stuff? If you had any idea of what I do, you'd have known that I actually came across those things and got hammered by them, so at least for me, they are important. You mileage may vary, but stop with the "inventing and exaggerating" bullshit. If you really think I'm inventing stuff you are actually insulting my intelligence, because there's no reason I would invent flaws to discredit a language that I know well and use a lot. Still, you want to school me on how to do my job saying that I'm "needlessly restricting" myself and your argumentation rests solely on the fact that I can ignore them because you did for 15+ years. Although you think this is relevant enough to repeat "guess how many times" like a 10 year old, I'm sincerely not impressed by that, and I think you'd spend your time better taking "the stuff I'm full of" from your behind. Thank you.
Banned User
Joined: 3/10/2004
Posts: 7698
Location: Finland
So it has become a pissing contest now? Who has the more experience and who knows more about the language? I'm sorry, but if you say things like C++11 just makes the language needlessly complicated, or you are having naming clashes with standard library functions like 'fill' or 'distance', then it doesn't really matter what you do as your job and how long you have been doing it. You don't know what you are talking about.
WST
She/Her
Active player (489)
Joined: 10/6/2011
Posts: 1697
Location: RU · ID · AM
Happy sysadmin day everyone… :) Sorry for off topic… :)
S3&A [Amy amy%] improvement (with Evil_3D & kaan55) — currently in SPZ2 my TAS channel · If I ever come into your dream, I’ll be riding an eggship :)
Joined: 6/19/2005
Posts: 180
WST wrote:
Happy sysadmin day everyone… :) Sorry for off topic… :)
That is beautiful. Oh, man. I gotta send my dad (network engineer) this picture.
WST
She/Her
Active player (489)
Joined: 10/6/2011
Posts: 1697
Location: RU · ID · AM
S3&A [Amy amy%] improvement (with Evil_3D & kaan55) — currently in SPZ2 my TAS channel · If I ever come into your dream, I’ll be riding an eggship :)
Editor, Active player (297)
Joined: 3/8/2004
Posts: 7469
Location: Arzareth
WST wrote:
https://github.com/Herzult/SimplePHPEasyPlus
Looks like someone managed to translate enterprise java into php... When were the "namespace" and "use" words introduced in php? I have not seen them before... And I've only been out from PHP programming for less than a year.
WST
She/Her
Active player (489)
Joined: 10/6/2011
Posts: 1697
Location: RU · ID · AM
I don’t recall, but I’ve been using them already quite long time. I think they were introduced in 5.3. Btw, there are many other new things in the latest versions, for example, Python-like array notation ($foo = [1, 2, 3]) or «yield» operation…
S3&A [Amy amy%] improvement (with Evil_3D & kaan55) — currently in SPZ2 my TAS channel · If I ever come into your dream, I’ll be riding an eggship :)
WST
She/Her
Active player (489)
Joined: 10/6/2011
Posts: 1697
Location: RU · ID · AM
S3&A [Amy amy%] improvement (with Evil_3D & kaan55) — currently in SPZ2 my TAS channel · If I ever come into your dream, I’ll be riding an eggship :)
WST
She/Her
Active player (489)
Joined: 10/6/2011
Posts: 1697
Location: RU · ID · AM
Apologies for the third post in a row, just wanna show you this: http://daylerees.github.io/ These are color themes for popular text editors, including Sublime Text and TextMate. You can get them from https://github.com/daylerees/colour-schemes . Hope you guys enjoy.
S3&A [Amy amy%] improvement (with Evil_3D & kaan55) — currently in SPZ2 my TAS channel · If I ever come into your dream, I’ll be riding an eggship :)
Post subject: Seemingly everyone hates c++
Joined: 3/18/2006
Posts: 971
Location: Great Britain
I've been learning python for around 3 months as my first programming language. As it is only a hobby, I have no clear trajectory to take once I finish all of these python books. Can anyone recommend a language that will enable me to learn more, build general desktop apps, and perhaps complement python? Everyone says C. But I wonder if it is used for anything beyond device drivers and such anymore. And those same people tell me that they hate C++.
Post subject: Re: Seemingly everyone hates c++
Joined: 4/13/2009
Posts: 431
antd wrote:
Everyone says C. But I wonder if it is used for anything beyond device drivers and such anymore.
I would not recommend C as a language to anyone except for those who really need it due to practical constraints.
And those same people tell me that they hate C++.
There is a lot of hate against programming languages out there... C++ is not a bad programming language. It's quit good, actually. But it is hampered by not having any good GUI framework, either built-in or available by 3rd party (in my opinion). Have you given C# a go?
Joined: 7/2/2007
Posts: 3960
Python is actually really solid. You can build general desktop apps using PyQt or wxPython. I do work in some programs where we mix C/C++ and Python, but that's mostly because my job sometimes requires detailed control over memory use, which Python doesn't give you. Most tasks don't require that level of control though. If you want to learn a new language once you feel you have a handle on Python, you might consider branching out into the "weirder" languages like Scheme or Haskell. To some extent, programming is about training yourself to think in new ways, so languages that are drastically different from the traditional "imperative" model (which Python uses) can be good exercise for your brain. The techniques you learn can also be applied in more traditional languages.
Pyrel - an open-source rewrite of the Angband roguelike game in Python.
Post subject: Re: Seemingly everyone hates c++
Banned User
Joined: 3/10/2004
Posts: 7698
Location: Finland
antd wrote:
Everyone says C. But I wonder if it is used for anything beyond device drivers and such anymore. And those same people tell me that they hate C++.
I would not recommend C for a beginner (or for anybody for that matter.) It may be easy to write your first "hello world" program, but immediately when you need to do anything requiring a dynamic amount of memory allocation, you run into difficulties. C++ makes many things a lot easier, but it requires you to know what to use (to make those things easier) and what not to use, and how to properly use them. Unfortunately there aren't many good C++ tutorials out there. Other, "safer" languages may be better for beginners. Most of them will offer most of the tools you need on the get-go, and most of them will give runtime messages when you do something wrong (such as accessing a data container out of boundaries). If you want a language you can write a GUI'd program with easily, I suppose C# could be one possibility, but it will be Windows-only. (Theoretically the language is available for other systems, but in practice you can forget about it.) (Personally I program in C++ and Objective-C++ as my payjob. It's all the rage in the iOS side of the world, and that suits me just perfectly. However, it does require quite a lot of experience to get fluent at. Probably not something a beginner can immediately get into.)
Post subject: Re: Seemingly everyone hates c++
Joined: 4/13/2009
Posts: 431
Warp wrote:
...Unfortunately there aren't many good C++ tutorials out there...
Well, tutorials are crap. But there are good books, fortunately.
WST
She/Her
Active player (489)
Joined: 10/6/2011
Posts: 1697
Location: RU · ID · AM
EEssentia wrote:
But it is hampered by not having any good GUI framework
Are you kidding? Have you ever heard of Qt? It’s considered one of the most developed cross-platform GUI frameworks today. It can also be used from Python (PyQt), as Derakon mentioned. If you guys speak of C#, how about Vala then? Is it good for a beginner?
S3&A [Amy amy%] improvement (with Evil_3D & kaan55) — currently in SPZ2 my TAS channel · If I ever come into your dream, I’ll be riding an eggship :)
Joined: 4/13/2009
Posts: 431
WST wrote:
Are you kidding? Have you ever heard of Qt? It’s considered one of the most developed cross-platform GUI frameworks today. It can also be used from Python (PyQt), as Derakon mentioned.
Know of it. Tested it. Didn't like it. Partly because it requires its own IDE which is garbage and partly because the GUI part doesn't seem to be updated and Qt Quick is still garbage, and, of course, Qt is still full of ugly pointers everywhere for absolutely no reason. And yeah, the doc isn't too forthcoming of what must be pointers and what need not.
creaothceann
He/Him
Editor
Joined: 4/7/2005
Posts: 1874
Location: Germany
The Lazarus framework (based on FreePascal, similar to Delphi with Object Pascal) is another possibility. The only drawback is that documentation is somewhat sparse, but you can use Delphi documentation/tutorials/example code with a bit of modification. (And if you want to use tabs in your code you're in for a world of pain.)
Post subject: Re: Seemingly everyone hates c++
Tub
Joined: 6/25/2005
Posts: 1377
antd wrote:
Can anyone recommend a language that will enable me to learn more, build general desktop apps, and perhaps complement python?
To "learn more", C or even assembler will certainly force you to help you to learn more about the inner workings of your computer. Which is a good skill to have if you ever need to debug a binary third-party-dll, an emulator rom or similar. Understanding the basics is also important if you ever need to really really optimize some algorithms. That being said, if all you ever want is some simple desktop apps, it's doubtful whether these skills are worth learning.
EEssentia wrote:
[Qt] Partly because it requires its own IDE which is garbage
The garbage part is debatable, the requirement part is simply false. Their IDE is a pretty recent thing, and most Qt devs would continue to use something else until it matures enough.
m00
Post subject: Re: Seemingly everyone hates c++
Joined: 4/13/2009
Posts: 431
Tub wrote:
The garbage part is debatable, the requirement part is simply false. Their IDE is a pretty recent thing, and most Qt devs would continue to use something else until it matures enough.
This is just my opinion. Don't take it as facts.
Post subject: Re: Seemingly everyone hates c++
Banned User
Joined: 3/10/2004
Posts: 7698
Location: Finland
Tub wrote:
To "learn more", C or even assembler will certainly force you to help you to learn more about the inner workings of your computer. Which is a good skill to have if you ever need to debug a binary third-party-dll, an emulator rom or similar. Understanding the basics is also important if you ever need to really really optimize some algorithms.
We have already been through this. A beginner doesn't need to "debug a binary third-party dll, an emulator rom or similar". Heck, I have been programming professionally for over 10 years and I don't need to do that. You don't need to know C or asm to learn how the CPU works and what kind of code a compiler produces. You don't need to know C or asm to "really really optimize some algorithms". In fact, you extremely rarely, if ever, need hardware-level optimization. Even in the extremely rare cases that you do, you don't need to know asm for this. Asm doesn't help you at all. What you need to know is how things like CPU caches and memory fetches work. Neither C nor asm teach you this in any way, shape or form. (Yes, I'm serious. It's not like machine code dictates, or even shows in any way, how memory caches work, how large they are, and how data is fetched from RAM to caches.) I don't even understand why this myth is so persistent. Here is an example of an article I once wrote about a low-level optimization. Do you know how much C or asm you need to know to understand how to make this kind of optimization? Zero. All you need to know is how memory caching works, and how your particular programming language arranges its data containers in memory. There is no need to know even a single machine code instruction.
Post subject: Re: Seemingly everyone hates c++
Joined: 3/18/2006
Posts: 971
Location: Great Britain
EEssentia wrote:
Have you given C# a go?
I haven't yet. First I will try to get a solid grasp of programming concepts using Python, and then I will take a look at it.
Warp wrote:
Tub wrote:
To "learn more", C or even assembler will certainly force you to help you to learn more about the inner workings of your computer. Which is a good skill to have if you ever need to debug a binary third-party-dll, an emulator rom or similar. Understanding the basics is also important if you ever need to really really optimize some algorithms.
We have already been through this. A beginner doesn't need to "debug a binary third-party dll, an emulator rom or similar". Heck, I have been programming professionally for over 10 years and I don't need to do that. You don't need to know C or asm to learn how the CPU works and what kind of code a compiler produces. You don't need to know C or asm to "really really optimize some algorithms". In fact, you extremely rarely, if ever, need hardware-level optimization. Even in the extremely rare cases that you do, you don't need to know asm for this. Asm doesn't help you at all. What you need to know is how things like CPU caches and memory fetches work. Neither C nor asm teach you this in any way, shape or form. (Yes, I'm serious. It's not like machine code dictates, or even shows in any way, how memory caches work, how large they are, and how data is fetched from RAM to caches.
My first experience of programming was actually in ASM. For some reason, I was interested in it, and I needed to learn MIPS32 in order to reverse engineer the PRNG for my Final Fantasy VII TAS. I became quite familiar with ASM and wrote several small applications with it. It's very strange going from ASM to Python. All of the assembly books immediately spoke about the importance of performance, and that one should always avoid using the MULT or DIV instructions, because they can be 100x slower than bit-shifts (I think they are called rotations in some high level languages?). So this caused me to start writing Python code using bit-shift operations and avoiding multiply and divide :-P I also wrote very strange code that heavily used other bitwise operators; eg, using XOR to check for equality. The resulting code was not very readable (according to StackOverflow). It's actually been quite difficult to stop thinking the ASM way... Thanks for everyone's input. I've started to become interested in how exploits work, and how vulnerabilities are used. If pursue this route, I guess I have no choice but to learn C? :-P
Post subject: Re: Seemingly everyone hates c++
Joined: 4/13/2009
Posts: 431
antd wrote:
It's very strange going from ASM to Python. All of the assembly books immediately spoke about the importance of performance, and that one should always avoid using the MULT or DIV instructions, because they can be 100x slower than bit-shifts (I think they are called rotations in some high level languages?).
Shifts are shifts and rotations are rotations. I have not heard of any language that names shifts rotations since they're two fundamentally different things.
So this caused me to start writing Python code using bit-shift operations and avoiding multiply and divide :-P I also wrote very strange code that heavily used other bitwise operators; eg, using XOR to check for equality. The resulting code was not very readable. It's actually been quite difficult to stop thinking the ASM way...
Sounds like you need to start doing high-level programming. The compiler will do a lot of these low-level optimizations for you. But even so, for modern processors, it's not guaranteed that these "optimizations" really will do anything because they are highly sophisticated hardware that are optimized to bring out as much performance out of your code as possible, often in ways you haven't intended your program to be run in.
Thanks for everyone's input. I've started to become interested in how exploits work, and how vulnerabilities are used. If pursue this route, I guess I have no choice but to learn C? :-P
As you've been told, you don't need to learn C. You need to learn about computer architecture. If you need a language to practice it in, you're better off with C++ IMO.
Player (146)
Joined: 7/16/2009
Posts: 686
Warp wrote:
Unfortunately there aren't many good C++ tutorials out there.
I'm inclined to disagree. While, yes, many of the tutorials you'll find within the first three pages when googling for "C++ tutorial" are absolute crap, good tutorials do exist. Rather than searching for general tutorials, just decide on something specific you want to do and google how to do that in C++. Any problems you run into? Google those too. One tutorial a really like is from hugi, a demo scene magazine. Although the setup's a bitch (I still prefer Visual Studio over anything else), the coding and explanation is solid.
Warp wrote:
All you need to know is how memory caching works, and how your particular programming language arranges its data containers in memory. There is no need to know even a single machine code instruction.
To be fair, using C or C++ makes it easier to arrange data in whatever way you want, or access data in ways that managed code doesn't allow (copying 4 bytes from an array by casting char* to int*, that sort of thing). It also helps that, unlike C#, C(++) doesn't pretend that structs are somehow primitive types. Many high-level languages make a point out of hiding how data is stored, because it's not something the programmer should be concerned about. Although most often true, this does mean it's a lot harder to do things just slightly different from how the language wants you to do it.
antd wrote:
Thanks for everyone's input. I've started to become interested in how exploits work, and how vulnerabilities are used. If pursue this route, I guess I have no choice but to learn C? :-P
This very much depends on the kind of vulnerabilities you want to investigate. Web security is an entirely different matter from cryptography, for example. However, from the sound of it, you already know Python and ASM to some extent. As such, I'd think that what you're lacking in skills is not so much in programming itself, but rather in software design. I don't know if you've ever done much with class inheritance, interfaces, properties and such, but if you haven't, I'd recommend to take up C#. It's easy to write simple, console-based applications, create GUI applications using Visual C#, do some drawing (System.Drawing or (yuck) XNA) or even build web applications. This means you can focus on designing your code: what classes do I need, how do they need to interact etcetera etcetera. It's a skill many programmers* lack, and it's an important one. All in all, I think it mostly depends on what you want to learn and what you enjoy the most. If I were you, I'd pick some simple programming task (Mandelbrot?) and do it in a few languages. Whichever one you enjoyed the most, you learn more about. Until you're sick of that and you repeat the exercise. * Or at least many of my fellow computer science students. All the assignements require 2, 3 classes tops.
Player (100)
Joined: 3/20/2008
Posts: 466
Location: Montreal, Quebec, Canada
Heh, been a while since I've visited this topic. I'm only 2 or 3 semesters away from finishing my undergrad, and I've learned quite a bit in the past few years. Some random observations: I'm currently taking a C++ course. At first I hated the language since I couldn't even get a handle on inserter and extractor operators (embarrassing, I know :P). I rather like how simple it is to use file streams compared to Java, and being able to overload operators is awesome. Templates are great too. What I don't like are qualifiers like std and all the weird variable types like size_t. Just having a program that doesn't have "using namespace std" already looks too verbose to read smoothly. I also find it annoying how being able to pass by value, reference and const reference adds a layer of complexity to parameters and return types. Can't say I love having to deal with pointers or de-allocating memory from the heap. Regardless, we've been given some great assignments to do, my favorite being a mini-search engine that would rank sentences in a document based on how well it matches a keyword. It was the most fun I've ever had programming and the first time I ever felt "passionate" about a program, losing track of time working on perfecting my creation. Another interest course I’m taking involves working in a team of 11 people to create a spreadsheet application. Our project is split into 3 iterations, developer, tester and documenter, and our 3 sub-teams rotate roles each iteration. It’s a software engineering course and I absolutely hate the lectures because the content is unbelievably abstract to the point of uselessness without industry experience. The teacher prattles on about software architecture, requirements, domain models, agile development, and it’s just so meaningless without context. On the other hand, it’s a blast to work with a team even if we do often get disorganized. I’ve also learned how to read large programs (12+ classes, each with ~1000 lines of code), which mostly amounts to following function calls and learning to read programs in a non-linear manner. I find most of my classes get bogged down with extreme levels of abstract detail. In a system hardware course, for example, I found it hard to pay attention to lectures on the MARIE architecture, but then had a great deal of fun mucking around with a MARIE simulator. I’m much more interested in experimenting with code and building useful applications than getting my head lost in trying to understand how a compiler interacts with a linker or how to micro-optimize a portion of code with loop unrolling. Something I’ve been picking up on lately is that learning how to program is very different from learning a more traditional concept. For instance, you get in the habit of constantly looking at reference material (Ex/ properly using an interface like Observer in java) and reading answers from Stack Overflow as opposed to say, reading a history book and learning a bunch of facts in a linear manner. You get used to drawing diagrams and planning a lot before writing even a single line of code, and setting up all your classes and methods before adding content to them. Hell, lately I’ve been finding that IDEs like Eclipse are so helpful that you can often learn how to use a method just by typing [object name].[autofill] and then letting the mouse hover over the autofilled method to give a description of what it does. As a last thought, I talked to a friend who works in the industry and he told me that he prefers to hire Comp Sci grads with no experience because older people with multiple master’s degrees don’t even know how to perform basic tasks in Excel, still use Internet Explorer, etc, and that the generation after me are screwed since schools aren’t teaching students how to read & write properly anymore. He encouraged me to look for work even though I haven’t graduated yet, and the fact that I know how to google for answers by itself puts me in the top 75th percentile of the tech workforce. I don’t know if he’s exaggerating or not but it certainly encourages me to go get some first-hand, real world experience of what it’s like to have a career in IT.
Banned User
Joined: 3/10/2004
Posts: 7698
Location: Finland
Scepheo wrote:
To be fair, using C or C++ makes it easier to arrange data in whatever way you want, or access data in ways that managed code doesn't allow (copying 4 bytes from an array by casting char* to int*, that sort of thing). It also helps that, unlike C#, C(++) doesn't pretend that structs are somehow primitive types. Many high-level languages make a point out of hiding how data is stored, because it's not something the programmer should be concerned about. Although most often true, this does mean it's a lot harder to do things just slightly different from how the language wants you to do it.
You are right in that a lower-level language like C or C++ allows for better space-optimization of data. This kind of optimization is often laborious, difficult or even outright impossible in higher-level languages (with some exceptions, of course.) While it's not very common (especially nowadays, as speed and RAM has increased and keeps increasing), sometimes it can be beneficial if your data takes as little RAM as possible, ie. it's packed into memory as tightly as is physically possible (even going so far as individual values taking less than one byte of space, ie. you start using bitfields, or "manually" encode your values into less then 8 bits and pack them together into bytes). I have quite a lot of experience at this kind of optimization in C++. Most higher-level languages lack the capacity of this kind of optimization completely (or if it's possible in them, it's often difficult; some exceptions notwithstanding.) Some programming languages are actually horrendously lavish in their memory usage (at least by default.) (Note, however, that there can be downsides to the tight optimization, and some upsides to the "lavish" approach that many other languages use. The former can often be harder to make work, or be efficient, in a multithreaded program, while the latter often allows for automated multithreading.) Anyway, my original point still stands: You don't need to know machine code (or even what kind of machine code the compiler is producing) in order to perform these space optimizations.
Vykan12 wrote:
What I don't like are qualifiers like std
For some reason many people detest having to write, or see, the "std::" prefix. However, this is a bad instinct. I can tell from extensive experience that once you start religiously using it, your code actually becomes clearer and easier to read at a glance, than when not using it. For one, the familiar "std::" prefix allows you to see where standard functions/types are being used from a quick glance. It also more easily distinguishes those standard names from your own names (especially if you use some custom prefixing scheme). There isn't even a theoretical downside to this. Secondly, the "std::" prefix conveys a surprising amount of information that might not be immediately apparent. For example, suppose that you see in some program a line of code like this:
Language: cpp

if(equal(a, b, c))
What does that tell you? Not much, really. It could be anything. It could be a custom function that compares three values to see if they are all equal. This line also doesn't really tell what the type of those values 'a', 'b' and 'c' are. You'll have to look somewhere else to find that out. However, assume that the line had been like this instead:
Language: cpp

if(std::equal(a, b, c))
Now this is an entirely different story. With the simple addition of the "std::" prefix we now know a whole lot more about that line of code. For one, we immediately see that it's a standard function, not a custom function. Even if we didn't know or remember what the function does, we know where to look. Secondly, if we know what std::equal() does, we understand a lot better what that line is doing: It's comparing two iterator ranges. Which in itself is giving us even more information: 'a', 'b' and 'c' are iterators. Did the code become more illegible with the addition of "std::"? No! The exact opposite!
1 2 3 4 5 6 7 8 9