The SRK Programming Thread


#1

If you code in any language, be it C, Java, Ruby on Rails, bash, kourne, whatever, post here to find like-minded individuals and perhaps some help if you’re stuck.

It’d also be helpful to post what languages you can code in.

Personally, I use Java and C quite frequently and would consider myself well-versed in both.


#2

haha. basic and pascal. honestly though, i used to be able to code in visual basic/java/c++ but it has been probably 8 years since i’ve written or edited anything.


#3

C++ hasn’t changed much, VB is still pretty useless except for sweet GUIs. Java is a bit different these days! Get with the times.

Trying to learn x86.


#4

I code in RPG IV v6. Doing it full time for the past few years developing clinical apps for a hospital.


#5

I am a veteran of around 10 years of Java and J2EE development. I also like to play with C and, more recently, have gotten into functional languages like Scala.


#6

I program in a variety of languages, but like many people, I’m most experienced in C++. If you have any questions about any programming issue, I probably can help.

I really want to find a motivation to use Lisp.


#7

I’m going to school majoring in information science/business, but the first year curriculum is strictly programming. I’ve been messing around with Java for a couple years and this year started PLT Scheme (Lisp, it’s what the Northeastern University Intro to CS class is taught in) but I really don’t know where I’m going to end up. My classes were taught with the mantra that it is a class in program design/OOD and not a class in Lisp/Java/C++/etc., which I think is great considering how fast things change in the computer industry.

It just seems like there’s so much out there to try to wrap my head around. I started reading about and screwing with Visual C# this summer but my job is taking most of my time and I’ve gotten lazy with it. To those of you who know a little more about the industry and such, what would be the best thing to do while I’m still in school to put me ahead of the curve when I get out?


#8

Learn the fundamentals and theories. Languages change, and different companies use different standards. Most languages aren’t difficult to pick up if you have a solid understanding of the theory and principles of programming.

Case in point, in college, most of my CS classes were theory based C++ or Java. However, now that I’m “out in the field” I do almost all of my work exclusively in T-SQL.

Also, try to get some classes in lots of different areas. I skipped out on the Database Design course (it was an elective), but now I’m a Database Administrator. Who woulda thought, right? :rolleyes:


#9

Thanks for the tip. This fall I’m taking Intro to OOD (looking forward to this) and Computer Organization, which I have no idea what it will be about but it is required, and Principles of Information Science.

Spring is probably going to be Computation Theory and Database Design… fun! :rolleyes:


#10

Luckily SQL is pretty easy to pick up!


#11

Wow ok so I just found this thread and am eager to ask some questions!

First off, I am learning C# as my first language: is this a good idea? I am already about half way through a ‘Learn C# in 21 Days’ book and, although people were telling me to look at Java, I figured I should plow on with what I have and hopefully it will be easy to transition anyway if it makes sense in a career context (something I am, in the long term, aiming for).

Sooo… ok where to start. Well, I’d like to test out if I understand something correctly or not and that is the ‘get’ and ‘set’ keywords in C#.

The example in the book is for setting up ‘properties’ for private variables. This means that you set up a public variable that other classes can access (such as your Main class), and then use this public variable to set the private variable. Apparently it makes sense to keep some variables private and, although I don’t fully understand why at the moment, I guess I can sort of guess at it (code which is constantly referring to the same variable might end up being slower/more buggy in unpredictable ways due to storage issues?)

So ok here’s how I see it at the moment:

class Example
{
private int x;
public int y
{
get
{
return x;
}
set
{
x = value;
}
y = 5;
}

Now, here’s how I’m understanding this at the moment:

  • when you make the literal ‘5’, and have it ready to put into the public integer ‘y’, the ‘get’ block of code executes (which ‘returns’ the private variable ‘x’)
  • when you actually put the ‘5’ into ‘y’, the ‘set’ block of code executes (putting the ‘value’ of y into x)

So, in a way, what get and set do is deconstruct the process of actually allocating values to variables in order to squeeze in a couple of other processes (properties)?

So hey I hope this thread will keep my motivation up for this. I’ve just read about protected variables at the moment, which are basically like private ones but are accessible to derived classes.

Ah ok so one other question… in what other ways are ‘get’ and ‘set’ used other than for manipulating private variables as above?


#12

Programming isn’t like learning a foreign language, you don’t “know X languages” the same way

These parts you have to re-learn again and again:

  1. Being able to set up your development environment - Ridiculous, I know, but finding, installing, and properly configuring the tools you need to program in some languages can be outrageously difficult

  2. Interfacing with pre-existing of hardware/software tools - This can be anywhere from a piece of cake (showing message windows in VB/C#) to a nightmare bitch from hell (communicating large amounts of data quickly between C# and a C++ legacy DLL)

  3. Operands - These change from language to language, but you can usually find them in a couple of seconds, so it’s not that big of a deal

  4. Best design practices - Knowing when and where to put what for a good product. String blah = “blah blah”; blah += " blah blah"; isn’t always a good idea/feasible. You should also know what a language is best for. While it may be theoretically possible with enough wrangling to design a 3d game in SQL, it’s probably not your best choice

All in all you’re looking at somewhere between a day and a month’s work to get basic “fluency” in any given programming language

The really challenging part is the CS and project management under the hood, that’s what’s important to learn in college


#13

I would learn C to start. People who don’t have a very strong knowledge of C generally don’t know how the machine works. If you start with some managed language like C# you will not learn a thing about memory management.


#14

Well I don’t have access to college right now, but could you just explain what CS stands for? I’m hoping it isnt something obvious that I’m just not figuring out for myself…

And Chris, are you saying you’d recommend going back to C instead of even C++? Maybe that’s a good idea. When it comes to memory management all I’m learning in C# are things like whether to store data as signed or unsigned bytes, integers, decimals and the like. Could you give me a taste of what I’d learn in C with regard memory management that I don’t get in C#/Java/C++? Is it to do with them being object oriented while C is before all of that?


#15

Computer Science…?


#16

I’ll just give a quick and brief explanation, but of course I won’t be giving the subject any justice!

For anything but the most trivial applications, you’ll be manging large amounts of memory on the fly. This is what we call “allocating” and “deallocating” memory. Those are just technical terms you don’t have to worry too much about, but the gist is you need to understand that you can’t willy nilly use up memory! You also have to take care not to access regions of memory you don’t have the access to. Speaking of regions of memory, its best to just think of it as a series of bytes you can store values in.

Ignoring the complications of manged memory, you have a number which points to each of these values. These numbers are called “pointers” in C/C++ and other low level languages. You’ll spend alot of your time properly manging these pointers in low level languages, making sure to not do anything “illegal” in the process. Something other to keep in mind is that allocating/deallocating memory on the fly can be time consuming for a computer, so you’ll often want to be careful how often you perform those types of operations.

This is a pretty big subject, and I just want to give a brief idea of what you would be dealing with in a non-memory managed language like C/C++. Consult the internet for more on this subject!


#17

If you want to understand the true nature of pointers and stack/heap allocation and all things memory, consider learning x86 assembler :wgrin:


#18

I didn’t see this post.

Um, I believe someone already covered a lot of what you’d learn in C, but I want to stress that you might want to learn a lower level language before you learn a higher level one. Yes, higher level languages are easier to learn, as most of the “behind the scenes” stuff (memory allocation, for instance) is done for you, but without learning the lower level stuff first, chances are you never will, and will never fully understand how your code works. I would suggest C as a good starting point, and maybe even trying out some x86 assembler, as I previously mentioned. It’s hard (really hard D: ) but well worth it in my opinion. I wish I had learned some assembler before I learned Java/C.


#19

I think you’d be better off starting with something more approachable like C# or Java so you can make some fun/useful apps, and then learn about how memory management actually works later on

If you jump in with C, you might just get frustrated and quit before you get anywhere

You don’t really need to get a 4 year degree to be able to program, there you’ll mostly learn about advanced topics like how to organize data in memory, how to write/optimize algorithms, and how to analyze chunks of code and understand why they don’t work as well as you’d like them to

My friend was better at coding before he went to college than most people with a 4 year computer science degree, and all he did was read books/write a lot of miscellaneous programs


#20

Bumping an old ass thread but I have a question. 99% of my work is done with RPG IV but as we all know the industry is constantly changing. To help myself along (and slightly at the request of my superiors) I need to pick up on the Visual platform, specifically .NET. Now I downloaded Visual Studio 2010 through my MSDN (gotta love work for buying that for me) and this shit is so different than what I am used to. Is there any good material for the transition from one type of coding (even along the C lines) to the Visual style? It could be ebooks, testing materials, etc. I am just looking for a nice pathway to help me bridge the gap from one style to the Visual style which is different than anything I have worked with before. The only other styles I have any type of experience with are assembler and Fortran which I highly doubt have much use in the .NET system.