Open Side Menu Go to the Top
Register
Programming homework and newbie help thread Programming homework and newbie help thread

01-02-2015 , 09:43 AM
I've heard good things about this book: http://www.codersatwork.com/ but haven't actually gotten around to reading it yet.

Steve Yegge writes some great stuff (http://steve-yegge.blogspot.ca/) and I also like this guy (http://randsinrepose.com/) although its often more about managing developers than a pure tech blog.

Joel Spolsky's blog (http://www.joelonsoftware.com/) is pretty old now but was fairly interesting. Although I feel like he frequently states things as fact that are just his opinion and which I disagree with.

I don't read blogs and stuff nearly as often as I should so I'm probably missing a lot of good stuff.
Programming homework and newbie help thread Quote
01-02-2015 , 10:20 AM
Quote:
Originally Posted by Atlantis1
Sorry I got a bit confused reading the past couple of pages.

I am looking to apply for a job in option trader, as a trader. However I was told being able to code was a plus. I was told either python or c++. I have the feeling I do not have to be super good, since the job I will be applying to is just screentrading.

I am looking to apply for this job in roughly a year. I have an Economic background, I am handy with computers but have never programmed. I am good with numbers and math, but I do not have a mathematics background.

If you were me.

What would you do?
I think being able to code would be in the context of trying to gain insight into how particular algoritms work. I would look at Python first just because it is fairly easy to experiment with test programs due to the interpretor and "duck typing" would be a little easier to deal with when starting out with coding. I would try to implement some very basic programs that deal with Econ/Finance. Perhaps something like a DCF valuation model in a finite period, ymmv.
Programming homework and newbie help thread Quote
01-02-2015 , 10:48 AM
Quote:
Originally Posted by Anais
DePaul graduate credits are 800 an hour, woof! For that kinda money, that degree better suck my d...

Uh, anyway.

Are there any good books the seasoned vets or other newbies might know of that would be skill-appropriate for the starter programmers to read, which aren't your basic "learn language x" book?

Giz picked up a few books on programming for us, but I think they're a bit beyond the level we're at. Just looking for something interesting to read between semesters, but also something I'll understand (as the LC thread here isn't always a good source for that).

Heck, even websites or blogs would be good.
There are a lot of books that fit this criteria. This book, even though it was written quite some time ago, is still widely read and is probably the most famous of this ilk The Mythical Man Month
Programming homework and newbie help thread Quote
01-02-2015 , 11:13 AM
Joel On Software is frequently cited and usually extremely dubious, in my experience.
Programming homework and newbie help thread Quote
01-02-2015 , 02:46 PM
Quote:
Originally Posted by Anais
DePaul graduate credits are 800 an hour, woof! For that kinda money, that degree better suck my d...

Uh, anyway.

Are there any good books the seasoned vets or other newbies might know of that would be skill-appropriate for the starter programmers to read, which aren't your basic "learn language x" book?

Giz picked up a few books on programming for us, but I think they're a bit beyond the level we're at. Just looking for something interesting to read between semesters, but also something I'll understand (as the LC thread here isn't always a good source for that).

Heck, even websites or blogs would be good.
I felt this book was worth my time to read (im a newb)

http://www.amazon.com/Clean-Code-Han.../dp/0132350882
Programming homework and newbie help thread Quote
01-02-2015 , 03:35 PM
Less than six hours, already a handful of well-cited, informative responses.

I told you you guys were awesome, didn't I?
Programming homework and newbie help thread Quote
01-02-2015 , 04:46 PM
Quote:
Originally Posted by Alobar
I felt this book was worth my time to read (im a newb)

http://www.amazon.com/Clean-Code-Han.../dp/0132350882
Seconded.
Programming homework and newbie help thread Quote
01-02-2015 , 08:43 PM
Quote:
Originally Posted by ChrisV
Joel On Software is frequently cited and usually extremely dubious, in my experience.
Dubious, how so? I am an infrequent reader but looking at the links he has, the topics look to be discussion worthy.
Programming homework and newbie help thread Quote
01-02-2015 , 09:00 PM
Quote:
Originally Posted by adios
Dubious, how so? I am an infrequent reader but looking at the links he has, the topics look to be discussion worthy.
A lot of the frequently cited articles are from like 2000 and tend to be a bit out of date. I dunno, the articles aren't terrible or anything, I just feel like they tend to be either correct and obvious, or non-obvious and dubious. This is partly because the stuff that is "obvious" was not obvious in 2000.
Programming homework and newbie help thread Quote
01-02-2015 , 10:50 PM
For me the biggest problems are the articles where he focuses on shipping installable software. I think a lot of his points here were misguided at the time and are now just plain antiquated.

But his good articles are still good imo.

Edit: I guess some might be considered 'obvious' but he writes about the concepts well and for newer developers there are lots of obvious things that they just haven't thought of.
Programming homework and newbie help thread Quote
01-03-2015 , 08:59 AM
Quote:
Originally Posted by adios
I think being able to code would be in the context of trying to gain insight into how particular algoritms work. I would look at Python first just because it is fairly easy to experiment with test programs due to the interpretor and "duck typing" would be a little easier to deal with when starting out with coding. I would try to implement some very basic programs that deal with Econ/Finance. Perhaps something like a DCF valuation model in a finite period, ymmv.
Thanks!
Programming homework and newbie help thread Quote
01-03-2015 , 10:30 AM
From his blog:
Quote:
Some of you may have seen my final column in Inc., in which I announce my retirement from blogging effective March 18th, the 10-year anniversary of Joel on Software.

Writing for Inc. was an enormous honor, but it was very different than writing on my own website. Every article I submitted was extensively rewritten in the house style by a very talented editor, Mike Hofman. When Mike got done with it, it was almost always better, but it never felt like my own words. I look back on those Inc. columns and they literally don’t feel like mine. It’s as if somebody kidnapped me and replaced me with an indistinguishable imposter who went to Columbia Journalism School. Or I slipped into an alternate universe where Joel Spolsky is left-handed and everything he does is subtlely different.

I’m not going to stop writing altogether.

What I am stopping is the traditional opinionated essay that has characterized Joel on Software for a decade. I’m not going to write Ten Ways to Get VCs to Salivate, I’m not going to write Why You Have To Buy a $10,000 Italian Espresso Machine for your Programmers, and I’m not going to write Python is For Aspergers Geeks or Ruby is for Tear-streaked Emo Teenagers. After a decade of this, the whole genre of Hacker News fodder is just too boring to me personally. It’s still a great format... the rest of you, knock yourselves out... I just can’t keep doing that particular thing.
I think this combined with his most recent post is basically confirming what Chris and JJ are pointing out. The blog has relevance but was much more relevant years ago. I read his post on Unicode. It was pretty good, a little too wordy, could have been written in one or two paragraphs. He does go a little over the top in my view.

Google is a good friend.
Programming homework and newbie help thread Quote
01-16-2015 , 06:46 PM
simple function asking user for temp, then asking if they want to convert it from Cels to Fahrenheit or vice versa.

for the 2nd prompt when i hit 'f' it works correctly, when i hit 'c' it gives the answer but also adds "Invalid input". maybe i'm going crazy but what's the difference?

Code:
float main()
{
	float temp;
	char convert;

	cout << "Enter a temperature: ";
	cin >> temp;
	cout << "Press 'c' to convert Fahrenheit to Celsius. Press 'f' to convert Celsius to Fahrenheit. ";
	cin >> convert;

	if (convert == 'c')
	{
		float ftemp, ctemp;
		ftemp = temp;
		ctemp = (ftemp - 32) / 1.8;
		cout << "The Fahrenheit temperature (" << temp << ") is \"equivalent\" to the Celsius temperature (" << ctemp << "). ";
	}
	if (convert == 'f')
	{
		float ftemp, ctemp;
		ctemp = temp;
		ftemp = ctemp * 1.8 + 32;
		cout << "The Celsius temperature (" << temp << ") is \"equivalent\" to the Fahrenheit temperature (" << ftemp << "). ";
	}
	else
	{
		cout << "Invalid input. ";
	}
}
Spoiler:
i didn't put "equivalent" in quotes because i'm a psycho or something, prof specified it to be that way, i assume to show us the backspace function
Programming homework and newbie help thread Quote
01-16-2015 , 07:36 PM
Quote:
Originally Posted by pewpewpew
simple function asking user for temp, then asking if they want to convert it from Cels to Fahrenheit or vice versa.

for the 2nd prompt when i hit 'f' it works correctly, when i hit 'c' it gives the answer but also adds "Invalid input". maybe i'm going crazy but what's the difference?

Code:
float main()
{
	float temp;
	char convert;

	cout << "Enter a temperature: ";
	cin >> temp;
	cout << "Press 'c' to convert Fahrenheit to Celsius. Press 'f' to convert Celsius to Fahrenheit. ";
	cin >> convert;

	if (convert == 'c')
	{
		float ftemp, ctemp;
		ftemp = temp;
		ctemp = (ftemp - 32) / 1.8;
		cout << "The Fahrenheit temperature (" << temp << ") is \"equivalent\" to the Celsius temperature (" << ctemp << "). ";
	}
	if (convert == 'f')
	{
		float ftemp, ctemp;
		ctemp = temp;
		ftemp = ctemp * 1.8 + 32;
		cout << "The Celsius temperature (" << temp << ") is \"equivalent\" to the Fahrenheit temperature (" << ftemp << "). ";
	}
	else
	{
		cout << "Invalid input. ";
	}
}
Spoiler:
i didn't put "equivalent" in quotes because i'm a psycho or something, prof specified it to be that way, i assume to show us the backspace function
your second if should be an else if. The way you've written it, it's gonna print "Invalid input. " every time convert != 'f'
Programming homework and newbie help thread Quote
01-16-2015 , 08:08 PM
doh ty

edit: hmm still getting the same thing ;[ both c/f computing temps correctly, but the 'c' (and only 'c') getting 'Invalid input' as well.

it's the same code as above except replacing the aforementioned 2nd 'if' with 'else if', but here it is anyway:

Code:
float main()
{
	float temp;
	char convert;

	cout << "Enter a temperature: ";
	cin >> temp;
	cout << "Press 'c' to convert Fahrenheit to Celsius. Press 'f' to convert Celsius to Fahrenheit. ";
	cin >> convert;

	if (convert == 'c')
	{
		float ftemp, ctemp;
		ftemp = temp;
		ctemp = (ftemp - 32) / 1.8;
		cout << "The Fahrenheit temperature (" << temp << ") is \"equivalent\" to the Celsius temperature (" << ctemp << "). ";
	}
	else if (convert == 'f')
	{
		float ftemp, ctemp;
		ctemp = temp;
		ftemp = ctemp * 1.8 + 32;
		cout << "The Celsius temperature (" << temp << ") is \"equivalent\" to the Fahrenheit temperature (" << ftemp << "). ";
	}
	else
	{
		cout << "Invalid input. ";
	}
}
Programming homework and newbie help thread Quote
01-16-2015 , 08:26 PM
It works fine for me. Maybe you're somehow still using the old executable?
Programming homework and newbie help thread Quote
01-16-2015 , 08:30 PM
Clean, then build.
Programming homework and newbie help thread Quote
01-16-2015 , 08:49 PM
Quote:
Originally Posted by pewpewpew
doh ty

edit: hmm still getting the same thing ;[ both c/f computing temps correctly, but the 'c' (and only 'c') getting 'Invalid input' as well.

it's the same code as above except replacing the aforementioned 2nd 'if' with 'else if', but here it is anyway:

Code:
float main()
{
	float temp;
	char convert;

	cout << "Enter a temperature: ";
	cin >> temp;
	cout << "Press 'c' to convert Fahrenheit to Celsius. Press 'f' to convert Celsius to Fahrenheit. ";
	cin >> convert;

	if (convert == 'c')
	{
		float ftemp, ctemp;
		ftemp = temp;
		ctemp = (ftemp - 32) / 1.8;
		cout << "The Fahrenheit temperature (" << temp << ") is \"equivalent\" to the Celsius temperature (" << ctemp << "). ";
	}
	else if (convert == 'f')
	{
		float ftemp, ctemp;
		ctemp = temp;
		ftemp = ctemp * 1.8 + 32;
		cout << "The Celsius temperature (" << temp << ") is \"equivalent\" to the Fahrenheit temperature (" << ftemp << "). ";
	}
	else
	{
		cout << "Invalid input. ";
	}
}
The code is right, next step is to use argc and argv as input parameters to main. In that way the user has the option to enter temperature and/or temperature type on the command line. Although I know at Intel and from what I've heard it is the same at Microsoft, instead of
Code:
if (convert == 'c')
they do this:
Code:
if ('c' == convert)
In that way if it is coded with = instead of == the compiler will generate an error.

Last edited by adios; 01-16-2015 at 08:57 PM.
Programming homework and newbie help thread Quote
01-16-2015 , 08:54 PM
Quote:
Originally Posted by KatoKrazy
Clean, then build.
heh, this is the first time i've heard of Clean before, had to check the menus.

i tried cleaning/building/running again and still get the same issue. tried exiting out of visual studio and re-opening, same thing.
Programming homework and newbie help thread Quote
01-16-2015 , 09:08 PM
Quote:
Originally Posted by adios
The code is right, next step is to use argc and argv as input parameters to main. In that way the user has the option to enter temperature and/or temperature type on the command line. Although I know at Intel and from what I've heard it is the same at Microsoft, instead of
Code:
if (convert == 'c')
they do this:
Code:
if ('c' == convert)
In that way if it is coded with = instead of == the compiler will generate an error.
thanks i'm confused with part of your comment though, isn't the user already entering temperature/type on the command line with the current code?
Programming homework and newbie help thread Quote
01-16-2015 , 09:51 PM
Quote:
Originally Posted by pewpewpew
thanks i'm confused with part of your comment though, isn't the user already entering temperature/type on the command line with the current code?
No the inputs are coming from stdin outpu is going to stdout. Say you name your program ConvertTemp. When you run your program from the command line you type ConvertTemp and your program gets control and it prompts the user. You can add a feature that if you enter something like

ConvertTemp 40 C

The user isn't prompted because the proram reads its inputs from the command line. That is the idea.
Programming homework and newbie help thread Quote
01-17-2015 , 10:53 AM
Thought a switch statement might be a good way to fix the selection error
Programming homework and newbie help thread Quote
01-17-2015 , 11:54 AM
Quote:
Originally Posted by pewpewpew
doh ty

edit: hmm still getting the same thing ;[ both c/f computing temps correctly, but the 'c' (and only 'c') getting 'Invalid input' as well.

it's the same code as above except replacing the aforementioned 2nd 'if' with 'else if', but here it is anyway:
Your current code works fine for me. I think you must have a build problem, like others have suggested. You must be running a stale executable. Try to find any copies of the built executable and delete them all. What IDE are you using? Visual Studio?
Programming homework and newbie help thread Quote
01-17-2015 , 12:31 PM
Had so many issues with visual studio when I was first starting, always happened when I tried to save code under a new file and it would refuse to compile the new stuff.
Programming homework and newbie help thread Quote
01-17-2015 , 03:15 PM
Quote:
Originally Posted by Anais
Thought a switch statement might be a good way to fix the selection error
A switch statement would work and i think it is probably a better way to go for this function.
Programming homework and newbie help thread Quote

      
m