Hello daniweb community i'm new here and glad to join this amazing website. Well want I need to understand is how I learn to become a competent computer science major and learn to write code very well. I have always had a knack for this and I love it alot but i'm lost on where I should start. At the moment im learning ruby and have been messing around with RoR. So what language should I learn first? I already know that computer science is more about how it works and algorithms and ETC. I want to go into my class next semester and feel confident and ready and bascially grasp everything. Please give names of books as well, thank you. Oh i'm also very open minded about everyones response so feel free for constructive critcism and mistakes you have made so I can better myself.
- 3 Contributors
- forum6 Replies
- 45 Views
- 5 Years Discussion Span
- comment Latest Post by phorce
It's great that you want to study computer science! It's indeed an interesting field and I'm sure you are going to enjoy this journey.
To answer your question; I will always suggest people who are new to the world of programming and computer science to start out with Python. Python is a great languages for beginners and it's only gaining in populerity. You will find it fairly easy (especially since you have been working with Ruby) and it will teach you what you need to know to move on to "bigger" languages like C/++, Java etc.
There's courses online which teaches Python through computer science, some of them are:
Especially the last one helped me a lot when I started out with Python and computer science.
You will find that there's a lot of diferent ways and opinions about where to start out with this. I have given you my recommendation which is based on my own personal experience.
@Anima Gives you some great recommendations, with regards to Python. Python is easy to learn and is becoming a lot more popular in commercial sense. Some programmers that have been developing for many, many years are taking up Python now because it offers such a high commercial gain; even if the job isn't in Python.
@Anima Templi thank you with the suggestion I will take look into python,and is ruby useless or should I continue to persue it. @phorce I thought php and C++ was the only ones with "commerical gain" lol I was mislead thank you.
C++ is a massive language, that requires years and years of experties in order to do the smallest of tasks. Let me give you a simple example: Let's say I want to develop an algorithm for an FFT (Fast Fourier Transform) pretty common in signal processing.
In Python I would:
from cmath import exp, pi
def fft(x):
N = len(x)
if N <= 1: return x
even = fft(x[0::2])
odd = fft(x[1::2])
return [even[k] + exp(-2j*pi*k/N)*odd[k] for k in xrange(N/2)] + \
[even[k] - exp(-2j*pi*k/N)*odd[k] for k in xrange(N/2)]
print fft([1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0])
Whereas in C++
#include <complex>
#include <iostream>
#include <valarray>
const double PI = 3.141592653589793238460;
typedef std::complex<double> Complex;
typedef std::valarray<Complex> CArray;
// Cooleyâ€“Tukey FFT (in-place)
void fft(CArray& x)
{
const size_t N = x.size();
if (N <= 1) return;
// divide
CArray even = x[std::slice(0, N/2, 2)];
CArray odd = x[std::slice(1, N/2, 2)];
// conquer
fft(even);
fft(odd);
// combine
for (size_t k = 0; k < N/2; ++k)
{
Complex t = std::polar(1.0, -2 * PI * k / N) * odd[k];
x[k ] = even[k] + t;
x[k+N/2] = even[k] - t;
}
}
// inverse fft (in-place)
void ifft(CArray& x)
{
// conjugate the complex numbers
x = x.apply(std::conj);
// forward fft
fft( x );
// conjugate the complex numbers again
x = x.apply(std::conj);
// scale the numbers
x /= x.size();
}
int main()
{
const Complex test[] = { 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0 };
CArray data(test, 8);
// forward fft
fft(data);
std::cout << "fft" << std::endl;
for (int i = 0; i < 8; ++i)
{
std::cout << data[i] << std::endl;
}
// inverse fft
ifft(data);
std::cout << std::endl << "ifft" << std::endl;
for (int i = 0; i < 8; ++i)
{
std::cout << data[i] << std::endl;
}
return 0;
}
You notice the massive difference? In that, if I wanted to do a simple test, then the likly-hood I would do it first in Python and then when I'm 100% sure, C++ would be the next cause of action.
Hope this helps
Oh, yeah that is a huge difference gonna take the python route, If I ever got caught in some problems is it fine if I dm you?
Not at all. Although, that's why the forum is there.. So just post your question there :)