(Link to AcmlmWiki) Offline: thank ||bass
Register | Login
Views: 13,040,846
Main | Memberlist | Active users | Calendar | Chat | Online users
Ranks | FAQ | ACS | Stats | Color Chart | Search | Photo album
05-03-24 04:57 PM
0 users currently in Programming.
Acmlm's Board - I3 Archive - Programming - looking for a language better suited to my abilities... New poll | |
Add to favorites | Next newer thread | Next older thread
User Post
spiroth10

Paratroopa


 





Since: 01-28-06
From: USA

Last post: 6283 days
Last view: 6283 days
Posted on 12-19-06 12:32 AM Link | Quote
I've been struggling to crank out projects in C++ for awhile now, and while I'm rather comfortable with the language, I just don't seem to ever have the ability to finish the jobs I work on.

Sure, I can code simple things -- probably a lot more than a lot of people -- but I should know more for my 5th or 6th year of C++ coding. I get a lot of the code completed, only to find that I need to use a new technique -- which alone isn't that bad, but after trying to solve the problem for several weeks/months (while asking for help, but not truly comprehending the answers given...) I think its time to switch to a language that helps me be more productive.

the speed/small size of C++ applications is extremely useless if I can't even create a program that works. Not to mention that the more advanced features of the language (in-line assembly, etc.) I am nowhere near even trying to use. (I know as much assembler as my dog)

I'd use a scripting language (python... I like it...) but scripts are harder to distribute on a windows platform, as not everyone has or will download a 10+MB interpreter.

So now I'm looking for alternatives.

BASIC still seems like a fools language to me. not because of its abilities, but because there are oh so many separate compilers with separate syntax -- unlike Java or C, BASIC is more of an outline for a programming language than a language in it's own.

Pascal is a definite opportunity. slightly more complex than BASIC, but less so than C (If I am to understand correctly) are there GUI functions? how about file i/o -- is it easy/hard?

JAVA is another language I was looking at. It has similar syntax to C++ (which I am comfortable coding in) and supposedly removes most of the fuss involved with C++ programs (garbage collection, a bit more flexible/forgiving) and remains object oriented. same questions as pascal -- I heard about project Metisse in netbeans -- is java GUI programming still a nightmare? I'm assuming file i/o is similar to that of C++.

other languages are definitely options as well. Im looking for something that has simpler application and use than C++ code does. syntax is not an issue for me. (although I must say, I do think perl is quite an ugly scripting language...)

my main issue with c++ is that I know what I need to do, but for the life of me, I can't figure out how to do it with the language. I end up producing broken code, that, if it even functions at all, is highly inefficient. usually I don't even get to a point where my projects are usable and I just give up.

edit:

I have located freezepython, which basically includes the interpreter in a package. although the file sizes here are quite unweildy due to DLLs I have to include. (tcl84, tk84m and obviously pyhon25.dll) so a compiled language would still be nice.

Although in the age of fast processors and high-speed internet, so running speed and 3+MB filesize matter (for the average user, not business) ? If I can't find a good compiled language, I'll stick to python.


(edited by spiroth10 on 12-18-06 11:54 PM)
MathOnNapkins

1100

In SPC700 HELL


 





Since: 11-18-05

Last post: 6284 days
Last view: 6283 days
Posted on 12-19-06 02:14 AM Link | Quote
What exactly are you trying to program that would require "new abilities"? It sounds like you just have a hard time completing projects in general, of any sort, to be honest. If you have an ambitious project it takes a lot of motivation to stick with it. I'd say the crossplatform characteristics and speed of C/C++ make it the best bet if you think your end user is willing to compile the program themselves on different platforms (or maybe someone else will do it and distribute it.)

I would think that a basic understand of C++ would be enough to do most tasks. Now, doing them efficiently is another issue entirely but the flexibility is there.

I'd say no to Java b/c of speed... probably in bench mark tests it does all right and everybody says it has improved its speed substantially with subsequent versions. But that doesn't change the fact that everyone still reports to me that it's slow. I used to use it and it was pretty slow even on a fast computer. Also, many things that are easy to do in C/C++ are pretty much a pain in the ass in Java; that's not to say it doesn't swing both ways though.

Python is a pretty nice language and manages to stay pretty fast too, from what I've experienced. Yeah there's an interpreter but it doesn't seem that much of a slowdown.

BASIC.... okay we all know who will chime in about FreeBasic so I'll leave that to him. It seems like a decent language so I'll give him that.

Pascal doesn't seem (to me at least) to see a lot of mainstream attention anymore in the programming community. I think it would almost fall in the realm of antiquated languages unless you use Delphi. That uses Object Pascal. I dunno, maybe we have some Pascal fanboys lurking around here, but I don't really see any advantages of learning this language at this time.

In any case, my final suggestion is to stick with either C++ or switch to Python. Both are pretty flexible and popular. Though I think if you were to ask us this question it would be better to give examples of programs and code you are trying to implement first.
Guy Perfect









Since: 11-18-05

Last post: 6285 days
Last view: 6284 days
Posted on 12-19-06 04:50 AM Link | Quote
C++ is likely the most widely-supported programming language, and it's very flexible and is standardized. Combining capability with power is something that you can't get just anywhere, but this language seems to pull them both fairly well. I advise you stick to it, because in the long run, you nearly have a guarantee that it will be useful to you regardless of the circumstances.



If you want ease of syntax and functionality, then some variation of BASIC would probably be the way to go. Along the lines of what you said, variations in BASIC are as numerous as there are grammatical errors in the post database of this web site.

For something steadfast that has proven its worth over time, I recommend Microsoft Visual Basic, specifically version 6. It's the most malible and powerful version prior to the .NET changeover, and is as simple as sleep to learn how to use.

Since VB programs are typically compiled to self-contained native code, it runs well under Windows and emulates well under Wine.



Java is becomming more standardized and it's ported to tons of different platforms. Both are high points in my book, but I'm very displeased with the fact that it's based on an idea where it operates on an exclusively object-oriented level. My own sentiments about OOP aside, the language has contracted its fair share of criticism about this. Enumerations weren't possible in Java until enough people complained.

The fact that it cannot compile to anything native to the processor can be considered a setback, but the fact that one single binary can be run on any equiped computer is a major advantage.

From a programming perspective, Java is similar to C++ except that it requires objects to do anything beyond the scope of your own functions. File I/O, for example, is done by a specific thing.



If you're going for productivity and easy GUI interfacing, then Microsoft .NET would probably be your choice of languages. There are proprietary variations of C and BASIC in there, so if you're familiar with either, you can take full advantage of the framework. GUI construction is as simple as click-and-drag, and the coding behind them can be as simple as you wish.

As with Java, .NET requires a computer equipped with a runtime and is known to be significantly slower than alternatives because of it. However, also like Java, it is becomming somewhat of a de facto norm.



For practical purposes, I suggest you stick with C++. If you want to make your programs more powerful, you can eventually work down to C. If you want to make your time more productive, you can eventually work your way up to .NET or stick with C++.

On the other hand, if you want to make your life easier, you'll probably be best to buy something Microsoft.
spiroth10

Paratroopa


 





Since: 01-28-06
From: USA

Last post: 6283 days
Last view: 6283 days
Posted on 12-20-06 10:18 PM Link | Quote
basically the project I'm trying to complete now is a configuration utility that exchanges one line in a text file with another. (the config files have values, ie lighton=1 or dog=0)

hell, I could probably code a text editor pretty quick in C++, but this is different. Ihave to go to a character on a specific line and overwrite the value. Definitely not a strong area for C (Perl would probably do the job well, but my project is for a game, and most windows gamers don't happen to have Perl installed on their PCs.)

I know the io of C++ in basic terms, once you get into using binary [mostly c io] and bit size I get lost though. I can output a variable to a blank file, append it to the end/beginning, read it, and copy it to an identical file, but I just can't figure out how to copy the file to a buffer (at all) edit it, and then rewrite it to the text file (probably can figure that part out if I can get the buffer...)

the only buffer experience I have is with images (SDL/Allegro), and this is TOTALLY different.

an alternate route would be to take the file line by line, assign each line (over 200...) to separate variables, edit the ones I need to, erase the original text file, and rewrite them all to a new text file with the same name in exact order.

With C/C++ io it's enough to drive me mad. I can't seem to figure out how to do it with other languages either, but with lua/python I've been able to read the file with a lot less code, and that makes me think editing it might be easier as well -- but python info is sparse on the web, and I've looked over all I can find (yes the official tutorial too...).

It seems I've jumped into something extremely painful to code. I might just give up on this one. Hell, I don't think I could accomplish this task in BASIC...


(edited by spiroth10 on 12-20-06 09:19 PM)
Guy Perfect









Since: 11-18-05

Last post: 6285 days
Last view: 6284 days
Posted on 12-20-06 10:32 PM Link | Quote
I made a thread not too long ago that writes a buffer of raw bytes into a file using C (amongst other things). I put a comment in there that shows that reading said bytes from said file takes the same arguments.

1) After loading into the buffer, scan through it with a normal For loop looking for newline characters. In Windows, newlines are two bytes: 0x0D 0x0A, in that order.

2) When you find the line you want to change (scanning with a secondary For loop), resize the buffer so it's big enough to accomodate for any increase in size. Then, using another For loop, scoot every byte--from last to the current position--forwards into the new area. Then set the bytes in question to your new value.

If the resulting buffer will be smaller, simply scoot all subsequent data backwards then resize the buffer to the new size.

__________


If it will help you, I can provide sample code to accomplish this feat in both C and BASIC.
spiroth10

Paratroopa


 





Since: 01-28-06
From: USA

Last post: 6283 days
Last view: 6283 days
Posted on 12-21-06 12:29 AM Link | Quote
thanks, but Im still a bit... lost...

I'll *try* to screw around with your code in C, but to be honest, it's a bit above my head.

If I keep at it, I might be able to get it to work eventually, but I have to learn new skills either way.

and I dont think doing it in BASIC would make things much easier (would it?) as the concept is the same, just simpler syntax. it's going about creating code that would actually do this that is the trouble for me...


1) After loading into the buffer, scan through it with a normal For loop looking for newline characters. In Windows, newlines are two bytes: 0x0D 0x0A, in that order.

2) When you find the line you want to change (scanning with a secondary For loop), resize the buffer so it's big enough to accomodate for any increase in size. Then, using another For loop, scoot every byte--from last to the current position--forwards into the new area. Then set the bytes in question to your new value.


is that 3 nested for loops? I guess I could do that (I've used nested loops before...)


If the resulting buffer will be smaller, simply scoot all subsequent data backwards then resize the buffer to the new size.


thats where you got me.

also, these lines are not directly above/below each other. I need to skip between over 50+ lines at certain points.

I get the basic gist of the code you wrote, but I still have no idea how to apply it to what Im doing... I don't think I'm cut out for this stuff anymore...
Guy Perfect









Since: 11-18-05

Last post: 6285 days
Last view: 6284 days
Posted on 12-21-06 12:59 AM Link | Quote
Ah, I see. It's not a matter of thinking up ways to do things; it's a matter of not knowing how to do things in the first place.

Yeah, I'd say the first thing you should learn about is how to use buffers.



In C:
int BuffSize; char *Buffer
BuffSize = 64;
Buffer = calloc(BuffSize, 1);
// Do stuff here
free(Buffer);

In BASIC:
Dim BuffSize As Long, Buffer() As Byte
BuffSize = 64
ReDim Buffer(0 To BuffSize - 1) As Byte
' Do stuff here
Erase Buffer



In both examples, the Buffer variable works as a raw byte array. Buffer[0] is of type char for C, as Buffer(0) is of type Byte in BASIC. Both arrays have a lower bound of 0 and an upper bound of 63.

In the page I linked in my previous post, I was rejoicing that I was able to use any kind of data I wanted--an array of user-defined structures in the example--inside the block of memory declared by the program. You can't do that in BASIC. What you have in BASIC is an array of Byte variables. No more, no less. In C, you can do whatever you want in there with pointers.

In any case, the in-memory buffer is your best friend when working with file data. Depending on the file (say, less than 5MB), you can usually load the whole thing into memory, but larger files (media files, databases) may need to be accessed little pieces at a time.

While it's different checking things like "if (Buffer[Pos] == Search[0])" is certainly a different way to go about a routine, it gives you far more control.



All-in-all, I think you'll be fine with C or C++. You already know how to use them, so I'd say it's best to stick with it and expand your base knowledge. Learn how to use buffers, and I'm sure you'll come up with many applications to use them.
Add to favorites | Next newer thread | Next older thread
Acmlm's Board - I3 Archive - Programming - looking for a language better suited to my abilities... |


ABII

Acmlmboard 1.92.999, 9/17/2006
©2000-2006 Acmlm, Emuz, Blades, Xkeeper

Page rendered in 0.035 seconds; used 398.80 kB (max 483.05 kB)