2014-08-22 17:40:08

Sure. It has a community.  I didn't say it did.
But it is small.  This can't even be argued.  Relative to the communities for all the mainstream languages, it is small.  There are a few sites for it. That is all.  All the other more mainstream languages have thousands of blogs, dedicated Stackoverflow tags, multiple books, the list goes on.  This part of my statement is not opinionated.  I can find 10x-100x more documentation for the mainstream languages.  And as for referring to the manual, I'd be willing to bet quite a lot that you referred to the PB one just as much at the beginning.  You have to.  It's how you learn the language in the first place.
I'm just not seeing why, when the question "which programming language should I learn?" comes up, people jump off the good community to help me do it bandwagon, not to mention all the other bandwagons that don't really get replaced in most cases.  I'm not thinking about professionalism here, and I suppose there's something for "because I can use it".  But those who use it are able to do so because they learned it and, if the coin toss went a different way, I don't see why anyone wouldn't be saying the same things about Python.  Or assembly.  I really believe that we could substitute assembly in for Purebasic in this thread and, if enough people in this community had used it, have the same exact conversation.
Python and C++ are what I've seen called multiparadyme.  You can but do not have to use object-oriented features in either.  As of C++11, you have the ability to do the same level of functional programming in both, as both now have good support for first-class functions (see Python's filter for a good example of why this matters).  If you want, you can sort of get such features in any language with a function pointer, but it's almost meaningless without the syntactic sugar and you can't do a lot of the advanced stuff.
And to be honest, you can fake OO in C-like languages, too.  But it requires knowing a lot about memory representations.  The idea is to create a "vtable", to have all instances of the "class" have a pointer to the vtable, and to then call your functions by referencing the vtables directly.  You can wrap this up nicely in macros, if you want and, if you put in the effort, you get inheritance and polymorphism out the other side.  These are however complicated enough that people switch to C++ rather than make their own.  I can assure you that you will want them for a game, too: it's how you can treat all the enemies as enemies and yet have them behave differently.
As for code size with C++, yes, it's a bit larger.  But only because of the #include statements.  I do not count boilerplate code.  I do not suggest C++ to people looking for productivity, but the reasons for this are the same as those I would cite for Purebasic-i.e. code size is not the big one or really even on the table.  What happens is, as  your project gets larger, the extra lines from hello world become less and less compared to the rest.  Libaudioverse is somewhere around 3000 lines now.  At the beginning, the #includes were indeed numerous compared to it, but I'd say they're easily only 0.5% of the project at this point.  Perhaps I should do a specific analysis, but every language has something analogous anyway, so it doesn't really matter.  The rest of the code size question comes down to how good of a coder you are, not so much the language; if adding a feature comes out the other side with *less* lines than when you started, it's a good sign you just did something majorly right.

My Blog
Twitter: @ajhicks1992

2014-08-22 18:59:45

Not everybody appreciates OO. Indeed, many people object to it, if you'll pardon the pun, because it encourages an obsession with the theoretical, rather than the practical, and a top-down rather than bottom-up mentality. This is unsuitable for some programmers, regardless of the project's size. For a nice illustration of this, try Linus Torvalds on C++ (warning: contains naughty words). I'd struggle to find fault with his argument, even though I think it's inappropriate to deny that choice to those who know how to use it correctly and appreciate the abstractions.

Speaking for myself, I'm not willing to compromise that kind of control, even in the name of development time.  C hurts good, but ultimately it's the subset of every other language and if as a programmer you require runtime abstraction, you can build it for yourself.  Many of the best programmers do this; for example, they build themselves replacements for C library routines to handle strings using compact and bounds-checked memory representations, to avoid buffer overruns. This is not suitable for general usage, but it absolutely provides comparable convenience, is more portable, more efficient, and doesn't come with the penalty of constant redevelopment over time as interfaces change. YMMV.

Just myself, as usual.

2014-08-22 23:16:26

But in C, can you import other people's code into your code or do you need to make everything all on your own?
For example, the random module. I don't care how to generate a random number. I just want to have a random number when I need one. so in python I just say
import random
print random.randint(1,5)
that will give me a number between 1 and 5.
The C vs C++ argument is a very fierce one and here is what my favorite take is on it:
C is the mad scientist cackling maniacally while his big, world-smashing robot C++ destroys the world.
So would you rather be the scientist or the robot?



I've never used either, this is just what people have told me. I am planning on using C or C++ as a supplemental language to python. Nothing beats python when it comes to popping out random junk, but:
1. that junk is not always very fast
2. you can have really bad tendencies in python if you don't know what you are doing.


As someone who just uses python and a little javascript, I can say that the only reason I don't use global variables, exec or eval functions along with while loops all over, is because people have said "This is bad coding practice" It isn't really any different speed wise when you are just starting out.
But there is a reason why python is so syntactically pretty and I think part of it is that is completely based off C.
Learn code the hard way does have a "learn C the hard way" but they don't have "learn C++ the hard way"
Here are the reasons why he says to learn C:
You can't be sloppy and half-assed about what you write or nothing will work.
it's a simple language you can figure out on your own
C's not hiding things from you that those other languages try and fail to obfuscate.
It is the Devil, Satan, the trickster Loki come to destroy your productivity with his seductive talk of pointers and direct access to the machine.
The C programming language's only failing is giving you access to what is really there, and telling you the cold hard raw truth.


So, why do you not get the above in C++? How syntactically similar are the two? Is it like python and javascript?
Or are they basically the same, but with a couple differences like American and British?
speed wise, is there a difference?


I've got my productivity language, what would be the language to help me:
understand APIs from big programs like Sonar, Spotify or even google, give me better programming practices and most of all, give me a language to write a specific DLL or module that I can use in my project that will be super fast when ran?
Does this sound more like C or C++?

2014-08-22 23:34:15 (edited by Sebby 2014-08-22 23:49:40)

I think you'd better stick to Python.

Of course you can use a random-number generator implemented in C; in fact, if you use your OS support, you are using one written in C, most likely (not the C library, but an in-kernel implementation).

And to answer your question: I'd rather be the mad scientist. smile

It is my considered ( but not very hard smile ) opinion that you should learn C, if for no other reason than that it will help you appreciate all the other languages, including C++ and Python.

The reason to look at C++ is that, much like C, there is a tendency--some would argue, to the demerit of object-oriented programming--to have a 1:1 correspondence between the primitives of the language and useful features. Yes, this does cost runtime performance, but it's nothing like as bad as either Python or Java (Python is actually getting slower over time). Yet, like C, C++ is quite dangerous, and as Linus Torvalds intimates, it's quite easy to hurt yourself with it. You can see why it's used in embedded systems development.

APIs should all have C interfaces, because it's the lowest common denominator. Therefore learn C, and everything that follows can be expressed as a binding to C, and you will be in a position to understand the lowest level implementation of a library. It's not all that hard, really it isn't.

Or don't bother. Enjoy the comforts of standing on the shoulders of giants. Hey, who's to impress, really? smile

I confidently predict that Python will be the next Java. Those smug Python programmers will never live it down. big_smile

Just myself, as usual.

2014-08-23 00:35:33

I'm waiting for the next big language to come along and have something that is even half as pretty as python.
Would you say python has been getting slower? Python 3 supposedly removed a lot of the junk that was making it slower and bulky.
How easy is it to create an application in C? I know unix was made in python, but anything like a .exe file that uses C?
The "learn C the hard way" requires windows people to get a VM or distro of linux and I just got a new computer, so don't have linux installed yet.
I also can't stand some of the little bugs and uncostomizability Orca has, NVDA is heaven in that respect.
To go hand in hand with that, I don't know how to use jedit half as well as I know EdSharp.
Now, how hard would it be to port NVDA to linux? LOL

2014-08-23 01:27:52

@sebby
Again: I do not use C++ specifically for the object oriented programming.  Libaudioverse was going to be 100% C, and I wrote the necessary primitives.  The reason I switched was not classes, it was smart pointers which, when making graphs of interconnected nodes, are really useful.  If we were not in C++11, Libaudioverse would still be C.  Had that happened, I'd still have missed a lot-virtual methods have turned out to be a bit of a godsend for parts of Libaudioverse, and so too has <algorithm>.  I'm not all over OO as "the" way, but you have to admit that classes make a nice abstraction over the construction/destruction/bunch of methods that take the same first parameters stuff.
As for speed between them, I noticed no difference.  This was also a reason I was sticking with C.  Once I'd completed the conversion (and it is a full conversion, not C++-as-C), it still ran just as fast as before.  This actually surprised me a great deal and was totally unexpected.  I have heard of cases of math library developers using C++ over C because, via tricks with templates, you can actually get faster code; whether or not this is true, most of the math libraries I can find (in my case, specifically glm) are C++.  But this may have to do more with operator overloading.
As for top-down versus bottom-up: I think that top-down is what you want to aim for, but that bottom-up is what you get practically.  Even in OO.  But being able to do top-down, even a bit, leads to more flexible software with less corner cases.  I did purely bottom-up with camlorn_audio, and it really shows in a bad way.  The one isn't feasible, the other leads to bad code, but I think there's a happy medium in the middle.
But my point wasn't that C++ is great.  C++11 brings it into bearable and fine if you know what you're doing but not so great if you don't territory.  My point was merely the contradictory reasoning: Purebasic is C plus libraries, Purebasic is paid, and yet Purebasic is somehow way better than either of these even in terms of the learning curve.
And as for Python being the next java, I don't think so.  There's a core thing in Java that allows many, many mediocre or even bad programmers to make progress: it assumes you are a bad programmer and does everything it can to lock you in a jail cell and plug all the outlets.  Case and point: checked exceptions, lack of operator overloading, lack of multiple inheritance (somewhat alleviated in 8, far enough that the few cases I'd use it for can be done), lack of first class functions (also somewhat alleviated in 8), and epic amounts of boilerplate.  If Python becomes the next java, it's because people seem to be starting to realize that Java's philosophy makes a lot of good programmers run in horror, or perhaps it's just that the good programmers are finally running and dragging the market with them.
@Frastlin:
Python's syntax is so far from C as to be unrecognizable.  It's definitely not based on C.
Every programming language provides some mechanism by which you can include code written by others and most include a standard library.  The answer to the question "can I include someone else's stuff" is always, always yes, but the convenience varies.  In the case of C/C++, you have headers and #include, which is almost the same as copy-pasting the contents of the header into your file.  This is a historical artifact from the days when compilers had to run on only a couple megabytes of ram and when modern techniques would cause us to wait additional hours, not additional milliseconds.
I have also heard that Python is getting slower, but think this doesn't matter; our computers are getting faster way faster than python's getting slower, even if it is.
As for what you want, look at C first.  You *have* to know what it means to be C to call stuff from other languages, as there's almost no way to directly map C++ classes.  Libaudioverse does it by wrapping the C++ classes in a manually written C API, because that's actually possible once you know how.
But in your case, I do not know what you would be doing that is going to run too slow.  If it is, consider the algorithm, not the language.  I'm only doing heavy C/C++ right now because of Libaudioverse, which performs something on the order of 100 million math operations per second.  I agree with sebby: you probably want to stick with Python for now.

My Blog
Twitter: @ajhicks1992

2014-08-23 01:45:55

@camlorn, I am tired of your little "smart pointers" and shit like that. Who cares! Who cares if a language has this and a language has that! No one! Stop trying to "convince" us to use either language. Oh, and about your statement in post 39? You are wrong here. I have actually ran programs for python 2.7 on 3.3.
Look. I'm sorry for blowing up on you like this, but: will you please stop trying to convince us to use C++ because its got smart pointers? Who damn cares if its got that. Its not built in automatically. I've never heard of a compiler which automatically manages memory for pointers for C or C++. Have you? Probably not. If you want to prove to me that C++ is so cool, why don't you write an entire game, with everything that, oh, DM Project Alpha has, and see how hard that is. Its a hell of a lot harder in C/C++ than it is in PB. Get this through your head: We use the languages that we choose because it gets the damn job done. If you keep trying to get us to stop using PB or some other language, I'm reporting you. This is gone on far enough, and I've had it with you. I haven't heard anyone else tell me, "You should use so and so because its got so and so."
I understand that you like smart pointers, yes, but can you please try these languages that you say are bad for like 3 to 4 years, and get to know everyone who uses it, before you make accusations? It would really be nice. Then, once you get to know everything about the language, come back to us about it and tell us what you think.
I understand your opinion, but just stop! Please?
OK, I shouldn't have blown up like that, but your just really getting on my nerves.

"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.
My Github

2014-08-23 05:03:28

Ethin, that post wasn't what you would call constructive debate. The impression I received from the over all post was that he was giving points on his specific language, not converting you to the language of choice. He specifically spoke about smart pointers, then recommended python also.

I'll quote Camlorn here.
"lot-virtual methods have turned out to be a bit of a godsend for parts of Libaudioverse, and so too has <algorithm>.  I'm not all over OO as "the" way, but you have to admit that classes make a nice abstraction over the construction/destruction/bunch of methods that take the same first parameters stuff."

In what way did that sound like he was trying to make people use a specific language? The nature of Libaudioverse means that he literally has to focus on other languages. If the library is going to be used, he needs as much compatibility as humanly possible.

Yes python 2.7 programs will run with 3.3, if you are close enough to python 3's changes.

I'll give a basic example.

print(" 5 divided by 2 is " + str(5/2)+".")

Python 3 uses float division by default. Python 2 does not. Using this in a serious application could result in rather interesting problems.

Deep in the human unconscious is a pervasive need for a logical universe that makes sense. But the real universe is always one step beyond logic.

2014-08-23 06:19:14

Yes, there are a couple programs that can run on both python 2 and 3. I think they may use several try statements, but python 3 is going back to the function calls, everything is a function!
You can do the totally understated named arguments for everything! smile
Why don't other languages use named arguments?
def hello(name="fred, text="world"):
    print("Hello, I am %s and I say: %s" % (name, text))


hello(text="This is my really awesome text!", name="Sam")


and it runs just perfectly!
Most people have told me to go for C++ as a C language, and C++ is much easier to run on Windows, so that is what I will probably go for.
How interchangeable is C and C++?
Are they like python 2 and 3? or bigger than that?
What language will help me best in creating algorithms and good practices? Is that C? Because, frankly, a lot of my programming now is kind of trile and error. As I talk to people, learn more and read more, better modules I end up writing. It is so bad sometimes that I end up going back through my whole game and rewriting it to fit a new, smaller and more easy-to-handle engine.
Although, I've done that several times with the game I've been working on since December and it is still a concept demo... I think though that I should just finish something with the bad code and put it out as a concept. If people like it, I can restructure it. If not, I can trash it and do something different!
How have other people dealt with this problem? Is it a common difficulty?

2014-08-23 07:02:51

What I personally do is I release a game if its good enough, no matter if the code is messy or not. My coding stile would be considerde quite horible by some. What i've found though is that as long as your game works, and you've at least tested it, it won't matter how messy the code, the players will still play it.

Check out the new reality software site. http://realitysoftware.noip.us

2014-08-23 07:07:42

Your methid is exactly what I do when i'm developing a game. What I tend to do is if i'm doing something in which i'm not sure the community will like, I will get it to a playable state and release an early concept demo. It mostly has an incomplete storyline, but what I do then is expand on the storyline each update so that everytime an update comes out, people can always expect something story wize unless I say it was just a quick patch fix. This methid appears to have worked out quite well for me, because since I started developing games because I always test each bit of story that gets added, I have only had to release a patch for my game 2 or so times. 1 for death match v2.0 when I was still coding in bgt, and 2 for snow race simpply because beta 4 had quite a few nasty bugs.

Check out the new reality software site. http://realitysoftware.noip.us

2014-08-23 07:07:57

Here is a whole section on
Using dlls in python directly


extending python with C or C++




cython


PyPy


and there are all kinds of JIT compilers for making python code faster.
But there is a reason why python's real name is CPython, and I'm not sure why that is, other than it was written in C and many many functions (xrange being the most well-known one) that are directly called from a C program.


If you do the following, you can see some difference in python's performance:

import time

s = time.clock()
for a in range(50000000):
    if a == "fred":
        print "yes"
    elif a == "Jan":
        print "Yes"
    elif a == "love":
        print "No!"

print "This lasted %s seconds" % (time.clock() - s)



Then run it as xrange(50000000). You get a nice one second speed gain! LOL
So does good algorithm creation come with experience or would learning C really help? That is what I'm facing now, how to make the best algorithms all the time!

2014-08-23 07:21:49 (edited by tward 2014-08-23 07:24:17)

Frastlin, yes, in C it is totally possible to import other people's code into your project. that is the entire point of libraries and header files. Header files and libraries is the way in which C programmers import or include code others have written into their project. That's precisely how my game engine works. I include the proper header files, proper libraries, and bingo I have got what I need to build a basic game ready to go.

I know you are really new to programming, have little experience outside of Python, but this is precisely why you should explore languages like C. This would give you a foundational understanding of programming at the lowest common denominator , and will teach you better programming habits and concepts. C is a lot less forgiving in some cases than Python so you have to be a more advanced programmer to use it effectively.

However, getting back to your point about including other people's code to perform your random generation you would start by including the stdlib.h header, probably get the current system time using the functions in time.h, seed the random generator, and use the rand() function to generate a random number. It is a little more involved than in Python, but the whole point is that most C compilers come with a built-in rand() function and if you want a better random generator you can write your own or borrow a better one from a library. Including other people's code in C programs is a simple process.
As for the C verses C++ debate I won't take a stand on that argument. Myself personally I tend to use C++ more because I was taught C++ first, and was trained in object orientated programming. However, since I knew C++ I eventually taught myself C, and I think both C and C++ both have their place in a developer's toolkit. Ultimately it comes down to preference for me.

As for your comment about Unix being written in Python your not even close. The Unix kernel is written in straight C as is various Unix-like variants such as FreeBSD, Linux, and Mac OS. It is not even possible to write a kernel, drivers, etc in Python. Python is more geared for application development and scripting rather than the kind of low-level programming required for operating system kernels, drivers, etc.

As for writing applications in C its not really that difficult if you know C well. Most of the applications for Linux, for example, are written from the ground up in C. A few are written in C++, some are written in Python, but I'd say the lion's share of apps are C.

As for porting NVDA to Linux I seriously hope you are being rhetorical. The answer to your question is its not possible without an absolute rewrite from scratch. The way NVDA works and the way Orca works are totally different, and the accessibility of Windows and Linux are very very different as well. You'd be better off donating your time to Orca development and developing/testing it to make it a better screen reader.

Ethin, please, chill out man. I can't help but think your explosion and tirade in post 57 was way over the top. I realize you like Pure Basic,, want to defend it, but your issue with Kamlorn is one of perspective. Its clear you two can't agree to disagree, but I find your reaction to his comments more irritating than anything Kamlorn has said.

To put a different spin on this debate I think a lot comes down to how advanced someone is. How long someone has been programming. I myself have been programming in C and C++ since 1999,, that's 16 years,and thus I tend to favor those languages from my skills,  education, and experience. Its natural that something like Pure Basic which was obviously designed for beginners isn't going to appeal to me. I get the feeling, reading between the lines, Kamlorn is something of a more advanced developer than you and Pure Basic is for him a turn off. The two of you can't agree because you are at different ends of the programming perspective, and see different advantages and disadvantages in the languages you are using.

As for your challenge if I had the time I could easily write a game in C++ with all the features the DM Alpha has, and in a sense I have already done that since Mysteries of the Ancients was written in C++. I take your point about difficulty, but you aren't proving anything by that challenge. To you writing a game in C++ is much harder for you because you probably aren't as familiar with it as Kamlorn or I am so from your perspective C++ is really hard. I personally don't think so because I have been developing software, a lot more than just games in it, for roughly 16 years so I would consider such a challenge to be fairly easy for me personally.

Finally, I found your over all message in post 57 to be really unprofessional and not a constructive criticism of Kamlorn's points. I don't think he was trying to convert anyone to C or C++, but to point out what he finds useful in those languages. If that offends you I'm sorry but its your problem. You seem to be the one getting all bent out of shape, upset, and acting childish over this discussion.

Sincerely,
Thomas Ward
USA Games Interactive
http://www.usagamesinteractive.com

2014-08-23 15:26:54

Ethin, you need to take a step back man. Camlorn states his oppinions, and he states them with authority and knoledge. If this is an issue for you, i suggest you stop replying to the thread, as Camlorn has done nothing to break forum rules. You are walking the fine line between oppinion and flaming, just keep that in mind. Now, if Camlorn had attacked you personally, this would be a very different post, but he has not, so eas up on your ranting please.

2014-08-23 17:07:42

Hi,
@Ethin: No offense, but with posts like these you are proving your lack of professionalism, which, in my book was very very thin ever since your posts about a possible compiler in the Dragonflame topic.
I assume we are adults, so if you are tired of someone's opinion, you are not enforced to read it, let alone tell everyone about it.
Everyone is biased towards a certain language, for obvious reasons. Some features make a language more or less useful and since we are not the same, opinions will differ.
To reflect on a couple things you raised:
Yes, people who care about programming will certainly care about language features. OOP and smart pointers can be useful, but just because they are there it does not mean they have to be used every time you write code.
Memory management is not the task of a compiler. In most high level languages, however, you will find some form of memory management (not necessarily garbage collection).
PureBasic is great for many things, especiallyfor beginner level programmers, because it uses a lot of third party components. The language itself could be a lot better, but this does not change the fact that it is a great product. As with every product, however, you have limitations. As long as you are aware of these, you can't go wrong. Camlorn has his negative opinion, because he is aware of these. Think of vb6 versus PB.
As this topic deals with PB, if you like it, purchase it and use it. Noone is going to stop you.

Rob

----------
Robjoy, AKA Erion
Visit my site for all the things I do and to contact me.
You can also stop by for a slice of Pi

2014-08-23 22:55:21

To put my cards on the table and be very explicit about my opinion of C++:
I am using C++ because Libaudioverse literally cannot be written in anything more programmer-friendly.  I am not using C because C is missing a lot of things that make life just a bit more bearable.  I am using smart pointers because, at the level I am having to work, I do not have a GC.  I can't even afford to use the GC if one was available because I am writing realtime audio code and even a millisecond pause not in my control can and will cause problems.  Yet, because of the data structures I must represent, manually freeing stuff is next to impossible to get right.  Every single feature of C++ that I bring into the project has to be carefully considered beforehand, lest it slow things down in a way that cannot be fixed later without rewriting everything.  Coding like this is not fun, at all.  I believe that C++11 brings C++ even further from C in that you can "fake" having a Gc and that you have a very nice syntax for anonymous functions and closures.  I would not point a new programmer at C or C++-I find it adequate, but only because I spent a lot of time finding it inadequate and figuring out what kinds of practices I would regret next week when I had to extend something.  Please do not mistake adequate for undying passion, or anything above just barely acceptable.
And to put my cards on the table about Purebasic, since this seems to be necessary:
I used and owned Purebasic for quite a while.  This would have been around 2005.  I did a lot of stuff in it, sadly lost with my first computer-this was before I knew about version control, FTP servers, or external backups.  I am speaking as someone with the experience of being a programmer that went through something like 5 variants of Basic, including the lesser-known BNS basic for the Braille 'N Speak 2000 (my first language).  I stuck with three for a long period of about 4 years: Libertybasic, Freebasic, and Purebasic.  Purebasic, of all of them, was the closest to C; I went there directly after using it.  The one thing I wish I had been told from this period was that there were more capable languages, as I didn't find C++ or Python until years later.  If I could go back and make myself skip the low-level languages in which it's actually obvious how many instructions every line is likely to need, I'd probably be twice as far along as I am now-the higher level languages take away so many concerns.  Nevertheless, I am speaking as a former Purebasic programmer and am at least passably fluent in at least 10 programming languages at the moment.
@frastlin
You can go to C or C++, but I'm not sure how much it would help.  C and C++ tend to have their own special best practices revolving around the fact that they're ridiculously low-level, and it took me a year or so of serious use (camlorn_audio) to reach the point where the statement "C++ is a write-only language" stopped being true.  If you don't know what you're doing, you can bring together too many features into code that is nearly impossible to extend or understand, even a day later.  As for the relation, C++ is (mostly) a superset of C; there's only one gotcha I know of, but you won't encounter it for a while.  The point of knowing where C ends and C++ begins is super useful because almost everything can call out to C or C++ functions with C linkage and using only C data types.   For that reason, starting with C can help you design multi-language libraries better.  As for running them on windows, every C++ compiler I can think of is also a C compiler, so installing C++ *is* installing C.
But in terms of algorithms and best programming practices, you'll get these just as well with Python.  Possibly better: a lot of things like test-driven development are really easy there and really hard elsewhere (on that note, look up and learn py.test.  You can thank me later).  The piece you seem to be missing is experience, nothing more; experience will let you determine when you shouldn't use things, when spending an hour to rewrite a piece of code will be worth it later, etc.

My Blog
Twitter: @ajhicks1992

2014-08-23 23:30:50

At camlorn: i might have asked this before so bare with me if i have. But is there an accessible ide one could use to program in either c, c#, or c++? I ask because as a programmer still learning, a nice feature would be code correction, or some type of accessible debugging tool. When i played around with vb6 a few years back, the ide was accessible, and it had some interesting auto correct features that appeared helpful on the surface at least. So, i guess my question is, can i get an application that will auto compile for me, and offer debugging capabilitys? Sounds lazy i know, i'm sure i could figure out command-line tools, but i'm just looking for a launching point to really launch my inthusiasm for programming in general, as for me at least, it's been an on again, off again interest for several years.

2014-08-24 00:21:54 (edited by camlorn 2014-08-24 00:28:18)

Unfortunately, not really.  The only one that even professes to be accessible and the only one I've ever had much luck with is Eclipse.  Learning Eclipse is probably as complicated as learning the command line tools you would be using anyway, and the autocomplete/code correction isn't actually accessible even there (or at least not that I know of).  Not to mention that the latest versions are currently broken with NVDA: this has been on my to-patch list forever now, but I don't use IDEs so I haven't had the motivation to slog through the Python metaclass at NVDA's core.
If you are on Jaws, you can kinda get VS2010 working.  2012 is a complete wreck, and even 2010 and jaws has bugs all over the place that make it very sarcastically enjoyable.  I do remember the days of 2008 and think of them fondly.  2013 is kinda sorta better, but the debuggers are broken still and MS says that they won't have them in 2014 either.  So...sorry, and do tell the command prompt I said hi.  It's only bad for the first week, and I'd suggest looking up Virtuawin because Virtuawin has been a godsend for me and my 6-8 open windows (hope, teamtalk, command prompt, editor, explorer, and at least one internet browser).
Edit:
C# has no command line debugger anymore.  This is true of all the .net languages.  C++ has Gdb and Cdb, but which you want depends on the compiler.  If you're a windows programmer, Cdb (works with VC++ executables) is your choice, but it has an amazing learning cliff.  Gdb is for MinGW or Linux systems and works with executables made with Gcc.  Its learning curve is more gentle for C, but both are equally hard when debugging C++ I think.  Disclaimer: have not used Gdb with C++, but did spend about 2 months debugging near-continuously with it for a godwars variant with a coder with barely enough knowledge to cause problems faster than I can fix them and who wouldn't listen about really needing version control.
But seriously, do not underestimate the debug print: printing the variables of interest at the point of interest.  For Libaudioverse, this has been the only way; even for other software, good logging is going to be a lot more helpful in many cases.

My Blog
Twitter: @ajhicks1992

2014-08-24 01:28:16 (edited by Ethin 2014-08-24 01:30:26)

OK, guys, I'm sorry for what I said in post 57. I was just angry because to me it seemed like Camlorn was being a no-it-all kind of guy. I'm sorry about that. I'm actually using C to learn how to use Flex and Bison. Oh, how wonderful it'd be if there was a flex and bison for purebasic. It'd be really cool, eh? I could try that, you know. It'd be a very tempting project. You know, I think I'll start working on that. It's going to be soooooooooooooooooo much fun! It'll be named 'pbflex' and 'pbbison'. Wait, that doesn't sound good. I think I need suggestions for names for the too!
Oh, I just realized something. A little help for using command line parameters in PB would be nice. If anyone knows how to do that, please tell me! I can't do anything without that!
And as programmers say, Programming is always fun as long as you want it to be.

"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.
My Github

2014-08-24 04:30:14 (edited by Sebby 2014-08-24 05:40:49)

@frastlin: You may have to wait quite a while.

Or you could get a Mac, and learn Swift. smile

Unix is written mostly in C. In fact, C was designed for implementing Unix. smile

You can learn C and C++ incrementally. Learn C so that you know what that language provides. Then learn C++ so you know what that provides (objects, exceptions, templates, runtime dynamic allocation, (very nearly) first-class functions and lambdas, all that jazz). You'll also be able to use all these nice well-written implementations for useful things like strings, algorithms, structures, etc. like a proper industrialist. But you've got to start somewhere. smile

@camlorn: I guess we'll have to see how portable your library ends up being. That's the real test; as soon as you discover that some "Unspecified" behaviour in STL makes a subtle difference to the way your library behaves depending on the compiler in use, or a helpful exception right in the middle of a stack unwind leaves you with no option but to abort hard, you've hit the nail of dangerous abstractions on the head. smile

I did take a brief look at C++ 11, but the only takeaway from it that I got that really mattered was that the C++ committee has clearly decided to please all the industrial and academic types with even more bewildering levels of syntax sugar to support the very latest language features, and that some of the best bits of Boost had been pulled in to make the language slightly more portable. Progress! One of these days I'll sit down and try to actually figure it out, but right now I'm not convinced you actually require C++ for anything; by the time you've turned off all the dangerous and/or unpredictable bits you're back where you started, basically C with a few more syntactical conveniences, and a few nice standard library routines. Not to say you can't use them if you really are careful (compare COM in C and C++, it's really night and day), just that again, for some folk, it doesn't warrant the use of C++. We can certainly agree that C/C++ is more mainstream than PureBasic though, but of course by itself that's no reason not to use it, either. For me, it's clear why I use C, but if "C but prettier" is what people want, why not let them have it? Tcl is "C but prettier" too (actually, Tcl 8.6 finally introduced OO, but you can easily leave it out if you choose) and I use that, irrespective of popularity, though to be fair that's probably because I understand the implementation well enough to extend it when I need.

As to my comment about Python evolving into Java: the primary argument given by Pythonistas seems to me to be that Java encourages "Cookbook" design, by providing all the libraries for every conceivable use case. Well, just look at Python 3 and the enormously expanded base classes. It's not Java yet, but it must soon turn into it. smile As you said there are market forces at work, and yes, the runtime is really slowing down. This is bad for server applications, so they'd better work on it.

As to Visual Studio, I'm still in two minds about whether or not to renew MSDN. I too remember 2008 with much fondness. I don't like to reward M$'s lack of commitment like this, but they have such nice platform support, it seems a shame to have to resort to using substitutes or earlier versions, so I've just exported all my stuff as build files and tweaked and run them from the CLI. But I'd rather not. If they leave me with no option, I have heard great things about CMake.

Edit: transpires that C++ supports lambdas but first-class functions are limited by the garbage collector. I didn't know that, so I'm correcting.

Just myself, as usual.

2014-08-24 05:48:57

I can't convey the things I like about C++11 in a short post, so I won't try.  It's a major boon for those of us who think in functions, and I've already hit smart pointers to death.  Worth noting that both of these things existed--to some extent--in Boost: one day I will learn how they managed to fake lambdas, but I'm definitely not there yet.  Nevertheless, lambdas, atomics, cross-platform threading, shared_ptr, hash tables, and tuples are the big ones.  I do not touch nor suggest touching variatic templates, and the rest is aimed at library developers in my opinion.  Gcc, Clang, and VC++2013 all implement everything that I'm likely to want from it.  If it weren't for the few killer features from C++11 that I absolutely had to have, I'd still be pure C and wouldn't have spent the 3 weeks converting properly.
I've not yet seen a case of the stl throwing exceptions only on one platform, but I've not yet started aggressively compiling on Linux/Mac.   I'm currently overcoming the fact that all cross-platform audio libraries I can find are either lacking features or coming with crippling bugs, so I've got bigger concerns.  I keep hearing this from the older programmers, but am unsure how true it still is as we seem to have converged on 3 implementations instead of 10-20.  I looked into it pretty intensively, and everyone seems to be saying it's okay now.  But I'm not using the STL too heavily: it's only really strongly used in the graph execution planner, and I know how to reimplement smart pointers if needed.
Cmake is good and awful in exactly the same ways as Php.  It gets a job done and does it well, but going even a bit beyond what it "wants" to let you do is headache-inducing and there's 5 ways to do everything.  That said, literally everything else is too slow (scons) or provides no support for actually figuring out where things are (excluding autoconf, but that's really Linux only).
And as for Python, I've not seen anyone complaining about performance post 3.4, but have heard some stuff about 3.3 and earlier having I/O problems.  The slowdown--if any--is minimal enough that all the articles about why Python 3 is bad don't seem to mention it.  Since Pypy now supports Python 3, it doesn't much matter-go use that and you get a JIT and, as of a couple months ago, an experimental implementation of STM (also known as GIL-less Python).  I need to do proper research on the slowdown, but I would also argue that servers are I/O bound for the most part anyway.

My Blog
Twitter: @ajhicks1992

2014-08-24 06:13:19

@camlorn: fair enough, I'll indulge long enough to learn C++ 11 more aggressively. It's about time I filled those gaps in my knowledge, anyway. It's true that I've heard many people comment that portability is now "Less of an issue", too, but the usual caveats about "The dark corners of C++" apply. But I'm not going to stop you if you think you're up to it.

CMake: it might just be the only option, at this rate. Autoconf/automake do work on Win32 albeit clumsily; you usually only need them for builds of already cross-platform stuff using CC. MS stopped providing a cc-compatible interface a while ago when they discontinued Interix, so that leaves MinGW or Cygwin, both of which are out of favour with the Wintel corps.

And Python 3: I'm holding back for now. I don't mind people using languages of choice, but having your mailing list deliveries slowed down by the runtime performance of the language the list manager is written in, or the memory requirements, is a real bummer. I do hope it's getting sorted out.

Just myself, as usual.

2014-08-24 06:46:13

Can you provide sources?  I googled the Python slowdown, but found nothing conclusive or, really, anything that would account for something noticeable in such a situation.  I've not looked closely at Python 3 myself yet as my interests with Python all seem to converge back at Twisted.  Gevent is a bad idea, the people who want to help me know Twisted, and Asyncio doesn't have a few of the pieces I want.  Also, everything but Libaudioverse is on hold because everything depends on Libaudioverse.
My knee-jerk reaction is that this is likely to be poor implementation in the mail server, but I do not at the moment have enough information to make such claims.  I find it very surprising that a mail server can run on both because, unless it's using trollius, it's not using one of the "big" (and thus optimized) options, at least none of the ones I'm aware of.  Imho, in a language with a plethora of better options, why use TCP sockets yourself?

My Blog
Twitter: @ajhicks1992

2014-08-24 07:19:24

Something to do with Python3 enumeration being slower. I have to be honest, as I'm not a Python developer myself, much of what I know about performance is hearsay, mostly the results of benchmarks. But I can say that Python performance does have an effect on speed of processing lists in Mailman. As it's only the mailing lists, once the mail is queued with the MTA, written in C, the performance will be high again, but there is a bottleneck at the point the list mail is being dispatched by Mailman. Apparently Mailman 3 will have a whole new architecture compatible with Python 3, so this is presumably going to work properly; until that time, it's required for the stable branch of Mailman 2 that you use Python 2.7.

Just myself, as usual.

2014-08-24 17:19:23

They may be doing the following hack somewhere:
list(mydict.keys())
Or similar, which would indeed cause slowdowns.  In general, programs that run on both versions are not-quite-Python, and you typically bring in something like six.  Given the age of the software, it's possible they never quite transitioned to the new stuff in 2.x-I'm thinking mostly of iterkeys, itervalues, and xrange.  But I'd still be very, very curious to see what their actual problem is-I'm assuming they at least run on Python 3, otherwise we couldn't say that it was slower there.

My Blog
Twitter: @ajhicks1992