Old 12-13-2015, 02:40 PM   #1
Jonlovesddr
h
FFR Veteran
 
Jonlovesddr's Avatar
 
Join Date: Sep 2008
Posts: 1,597
Default learning to code

I'm a first semester comp sci student and my intro course is an intro to object oriented programming which focuses on java, but I'm kind of struggling since I have no prior coding experience and I might not pass this course
I want to continue learning to code, but it's really discouraging that my first experiences with writing code have been this difficult'
Does anyone have any words of wisdom/encouragement or advice on how to not suck at coding

[if it makes a difference] I've been reading this book to supplement course material
http://www.headfirstlabs.com/books/hfjava/
__________________
Jonlovesddr is offline   Reply With Quote
Old 12-13-2015, 02:42 PM   #2
choof
youtu.be/sM5hlrkaPSo
FFR Simfile AuthorD7 Elite KeysmasherFFR Veteran
 
choof's Avatar
 
Join Date: Nov 2013
Posts: 8,196
Default Re: learning to code

advice is to learn how to code
honestly, if you're a first sem comp sci student and you're getting shit on by java
I would recommend selecting a different major
choof is offline   Reply With Quote
Old 12-13-2015, 02:44 PM   #3
choof
youtu.be/sM5hlrkaPSo
FFR Simfile AuthorD7 Elite KeysmasherFFR Veteran
 
choof's Avatar
 
Join Date: Nov 2013
Posts: 8,196
Default Re: learning to code

https://www.codecademy.com/learn/learn-java
http://docs.oracle.com/javase/tutorial/java/
https://projecteuler.net/
http://programmers.stackexchange.com/
choof is offline   Reply With Quote
Old 12-13-2015, 02:48 PM   #4
Jonlovesddr
h
FFR Veteran
 
Jonlovesddr's Avatar
 
Join Date: Sep 2008
Posts: 1,597
Default Re: learning to code

that's not encouraging
but thanks
__________________
Jonlovesddr is offline   Reply With Quote
Old 12-13-2015, 02:52 PM   #5
choof
youtu.be/sM5hlrkaPSo
FFR Simfile AuthorD7 Elite KeysmasherFFR Veteran
 
choof's Avatar
 
Join Date: Nov 2013
Posts: 8,196
Default Re: learning to code

Quote:
Originally Posted by Jonlovesddr View Post
that's not encouraging
but thanks
java is used as a stepping stone in programming for a reason, it's a very easy language to pick up and it's widely used throughout the world. are you having trouble with the language itself (aka syntax), or are you having trouble with how the language actually works (aka logic)

if it's the syntax, my advice is to spend all your time writing snippits of code
if it's the logic, it depends on how long you've been in the class. if you keep struggling, you'll be utterly left in the dust later on

the lack of programming experience can really only be fixed one way: by continuing to program with java.

Last edited by choof; 12-13-2015 at 02:53 PM..
choof is offline   Reply With Quote
Old 12-13-2015, 02:57 PM   #6
Jonlovesddr
h
FFR Veteran
 
Jonlovesddr's Avatar
 
Join Date: Sep 2008
Posts: 1,597
Default Re: learning to code

seems more like syntax because it feels like there's a ton of vocabulary that i just am not familiar with
and i haven't written a lot of code this semester since most of the course is science and learning OO concepts
i can write plenty of test code in eclipse though so i should start doing that
__________________
Jonlovesddr is offline   Reply With Quote
Old 12-13-2015, 03:11 PM   #7
Contrapasso
FFR Player
 
Join Date: Nov 2013
Posts: 104
Default Re: learning to code

Quote:
Originally Posted by Jonlovesddr View Post
i can write plenty of test code in eclipse though so i should start doing that
then get to coding, brEh
__________________
Quote:
Originally Posted by Ziemniax View Post
the amount of people telling he's bs just shows how freaking good this guy is.
Quote:
Originally Posted by MrPopadopalis25 View Post
Agreed. Same reason why I know god is real.
Quote:
Originally Posted by Ghakimx View Post
If I was the officer, if I saw the guy, I would try to assess the situation properly. What is the race of the guy?
Contrapasso is offline   Reply With Quote
Old 12-13-2015, 03:23 PM   #8
Xayphon
sausage
FFR Simfile AuthorD7 Elite KeysmasherFFR Veteran
 
Xayphon's Avatar
 
Join Date: Nov 2008
Location: Germany
Posts: 1,596
Default Re: learning to code

Learning how to code is certainly not limited to anybody with special abilities. I've never had any computer scientific courses or any maths honor class or anything else that encourages logical thinking in highschool and I still learned how to code in Java to an intermediate level. Being good at coding requires dedication and experience, none of which you currently have. You are still at point 0 and need to understand its concepts and how coding languages require you to think. You really only learn by coding yourself and trying to get programs to do what you actually want.

Java as a first programming language with all its concepts is certainly not easy to learn, but once you get that down, you will have less and less trouble picking up other (imperative) languages, getting used to them, and knowing how to program. It's like a thinking paradigma you need to understand and get used to, it comes with time. I really encourage you to constantly keep yourself busy with programming simple tasks and also challenging yourself to tackle bigger and bigger problems, even if it's just trying to understand terms like public, private, void, extends, abstract, interface, and so on.
Xayphon is offline   Reply With Quote
Old 12-13-2015, 05:02 PM   #9
reuben_tate
Kawaii Desu Ne?
Sectional ModeratorFFR Veteran
 
reuben_tate's Avatar
 
Join Date: Dec 2007
Location: The Kawaiian Island~
Age: 27
Posts: 4,130
Default Re: learning to code

It's kinda hard to help considering the vagueness of the OP. So the only thing I can provide is some generic/vague suggestions:

-practice

-If you get stuck, look at someone else's code (Google is your friend). When one first starts learning something, sometimes it's easiest to learn by imitation. Try copy/pasting some code and modifying it to suit your needs. If you do this though, make sure you go through the copied code line by line, and try to understand exactly how that piece of code is working. Eventually, you'll be good enough to where you don't need to Google them anymore (e.g. I would hope don't have to google "how to loop through elements in array" 30 million times before you can do it on your own). You can pick up a lot of things from someone else's code such as good coding patterns and good code styling (e.g. variable names, use of whitespace, etc).

-Focus more on the algorithm/logic and the different paradigms in imperative and OO-programming as opposed to the syntax or memorizing function names in the Java standard libraries. Personally, I'm horrible when it comes to the latter (syntax and function names) but those are a quick google search away. The syntax will come naturally to you over time.

-Learn how to read the official documentation. Tutorials and stuff can help, but sometimes you need to go directly to the source to get the information you need. For example, this is the official documentation for Java's String Class: here.

-Learn how to effectively use your IDE. Make use of any code completion features and such. For example, for many IDE's, when you type a function call and start entering parameters, it'll tell you what the parameters are.

-Comment your code. First, by commenting your code, it forces you to think about what the piece of code is actually accomplishing. Second, comments help for when other people (including future versions of yourself) have to read your code.

-When trying to program, sometimes it helps to not jump straight into coding. In essence, you want to create an algorithm. In cooking, people call this a recipe. If you can write a recipe, you can code. First, think about how you would describe the algorithm ("recipe") to another person, in English terms. It can even be an algorithm that involves the other person using a paper/pencil setup. Now, for each step in the algorithm you came up with, clarify the step and/or break down the step into smaller steps such that every step is unambiguous. Once you have your collection of unambiguous steps, then they should easily translate into code.

-Learn how to trace your code (by hand). Given a piece of code, you should be able to tell what the output is going to be. This is a good skill for debugging, especially for small test cases and edge cases.
__________________
AMA: http://ask.fm/benguino

Not happening now! Don't click to join!



Quote:
Originally Posted by Spenner View Post
(^)> peck peck says the heels
Quote:
Originally Posted by Xx{Midnight}xX
And god made ben, and realized he was doomed to miss. And said it was good.
Quote:
Originally Posted by Zakvvv666
awww :< crushing my dreams; was looking foward to you attempting to shoot yourself point blank and missing
reuben_tate is offline   Reply With Quote
Old 12-13-2015, 05:26 PM   #10
leonid
I am leonid
FFR Simfile AuthorFFR Music ProducerD7 Elite KeysmasherFFR Veteran
 
leonid's Avatar
 
Join Date: Oct 2008
Location: MOUNTAIN VIEW
Age: 31
Posts: 8,073
Default Re: learning to code

Try learning functional programming language as well when you have time (Haskell, Scheme, etc)
__________________



Proud member of Team No
leonid is offline   Reply With Quote
Old 12-13-2015, 08:39 PM   #11
aperson
FFR Hall of Fame
Retired StaffFFR Simfile AuthorFFR Veteran
 
aperson's Avatar
 
Join Date: Jul 2003
Location: Houston
Posts: 3,302
Send a message via AIM to aperson
Default Re: learning to code

Quote:
Originally Posted by leonid View Post
Try learning functional programming language as well when you have time (Haskell, Scheme, etc)
Agreed. J is an excellent language to pick up.
__________________
aperson is offline   Reply With Quote
Old 12-14-2015, 04:17 AM   #12
Reincarnate
x'); DROP TABLE FFR;--
Sectional ModeratorFFR Veteran
 
Reincarnate's Avatar
 
Join Date: Nov 2010
Posts: 6,334
Default Re: learning to code

No love for Scala?
Reincarnate is offline   Reply With Quote
Old 12-14-2015, 09:45 AM   #13
reuben_tate
Kawaii Desu Ne?
Sectional ModeratorFFR Veteran
 
reuben_tate's Avatar
 
Join Date: Dec 2007
Location: The Kawaiian Island~
Age: 27
Posts: 4,130
Default Re: learning to code

Jon here is struggling with the fundamental paradigms and general syntax of an imperative programming language (in this case Java). I don't think trying to get him to tackle functional programming languages is the best course of action at the moment, at least from a pedagogical standpoint.
__________________
AMA: http://ask.fm/benguino

Not happening now! Don't click to join!



Quote:
Originally Posted by Spenner View Post
(^)> peck peck says the heels
Quote:
Originally Posted by Xx{Midnight}xX
And god made ben, and realized he was doomed to miss. And said it was good.
Quote:
Originally Posted by Zakvvv666
awww :< crushing my dreams; was looking foward to you attempting to shoot yourself point blank and missing
reuben_tate is offline   Reply With Quote
Old 12-14-2015, 12:07 PM   #14
rushyrulz
Digital Dancing!
Retired StaffFFR Simfile AuthorFFR Music ProducerD7 Elite KeysmasherFFR Veteran
 
rushyrulz's Avatar
 
Join Date: Feb 2006
Location: 72 billion club, NE
Age: 28
Posts: 12,523
Default Re: learning to code

Quote:
Originally Posted by leonid View Post
Try learning functional programming language as well when you have time (Haskell, Scheme, etc)
SML was pretty OK, too bad my professor was a massive dickhead about it.
__________________

rushyrulz is offline   Reply With Quote
Old 12-14-2015, 12:11 PM   #15
justin_ator
Washed Up
FFR Simfile AuthorFFR Veteran
 
justin_ator's Avatar
 
Join Date: Mar 2007
Location: Winter Garden, FL
Posts: 7,415
Default Re: learning to code

Quote:
Originally Posted by reuben_tate View Post
-Comment your code. First, by commenting your code, it forces you to think about what the piece of code is actually accomplishing. Second, comments help for when other people (including future versions of yourself) have to read your code.
This may not seem important at the time, but it truly is an incredibly helpful thing - it allows you to not only "explain" your code to someone else but also allows you to recall later on how you solved a particular problem or how your output was coming about. Logic (once you get used to it) may make sense to you one day when you're slaving away at making something work how you want it to, but when you come back to it you could be looking at it like you are reading Greek. I coded a battleship program in C++ and the "AI" I was developing was not overly intuitive. I didn't bother commenting well the first time through, and the next time I went in to work on it and debug something for an issue I was having, it was a nightmare. I had to essentially re-learn the process I was using.

Quote:
Originally Posted by reuben_tate View Post
-Learn how to trace your code (by hand). Given a piece of code, you should be able to tell what the output is going to be. This is a good skill for debugging, especially for small test cases and edge cases.
I do this all the time. If you think you should be getting a certain output and you're not, trace through piece by piece and gather your expected output and behavior at each point. Once you've done that, add in catches or change minor things to test or display your output along the way, allowing you to see where things went wrong if they weren't popping out to you before.

Quote:
Originally Posted by reuben_tate View Post
-When trying to program, sometimes it helps to not jump straight into coding. In essence, you want to create an algorithm. In cooking, people call this a recipe. If you can write a recipe, you can code. First, think about how you would describe the algorithm ("recipe") to another person, in English terms. It can even be an algorithm that involves the other person using a paper/pencil setup. Now, for each step in the algorithm you came up with, clarify the step and/or break down the step into smaller steps such that every step is unambiguous. Once you have your collection of unambiguous steps, then they should easily translate into code.
This is probably my #1 used thing when writing new code on something. If it's a simple project that uses concepts I already know I may dive into writing code, but almost 95% of the time I am going to actually start by writing "pseudo-code", or paraphrased steps of what I need to accomplish to reach the goal. You absolutely want to break this down to the smallest pieces for every step along the way, and over time you'll be able to start filling things in with code (ie I need a variable for this, or I need to loop through a function for this outcome, etc).

Best of luck with things. Practice really does make perfect.
__________________
justin_ator is offline   Reply With Quote
Old 12-14-2015, 04:31 PM   #16
rushyrulz
Digital Dancing!
Retired StaffFFR Simfile AuthorFFR Music ProducerD7 Elite KeysmasherFFR Veteran
 
rushyrulz's Avatar
 
Join Date: Feb 2006
Location: 72 billion club, NE
Age: 28
Posts: 12,523
Default Re: learning to code

Guys he's in java 1, basically learn to regurgitate the following:

pretty much copy paste this into template.java and cp it to whatever you're working in
Code:
import java.util.Scanner;

public class PROGNAME{

	public static void main(String args[]){
		Scanner input = new Scanner(System.in);
	}
}
Object reference creation code:

Code:
Objname refname = new Objname(args);
and to call the object's methods:

Code:
refname.someMethod(args);
use appropriate scoping or you'll regret it. Learn the difference between public, private, protected in variable and method declaration.

Java is verbose as shit and I hate it. The syntax can get pretty messy, especially with exception handling. Commenting, tracing, and pseudocoding are good practices that have been suggested in this thread.
__________________

rushyrulz is offline   Reply With Quote
Old 12-14-2015, 05:09 PM   #17
Reincarnate
x'); DROP TABLE FFR;--
Sectional ModeratorFFR Veteran
 
Reincarnate's Avatar
 
Join Date: Nov 2010
Posts: 6,334
Default Re: learning to code

Honestly, I recommend Python to most people learning to code, because it's about as close to pseudocode as you can get. Once you get the hang of actually making stuff, it's much easier to introduce things like C++, Java, etc.
Reincarnate is offline   Reply With Quote
Old 12-14-2015, 08:20 PM   #18
Jonlovesddr
h
FFR Veteran
 
Jonlovesddr's Avatar
 
Join Date: Sep 2008
Posts: 1,597
Default Re: learning to code

thank 2 all
if i pass this final i can take the next course in the sequence in the spring and i have 6 weeks to prepare and get ahead
if i fail then ill have to wait until next fall to retake it which is really shitty...
__________________
Jonlovesddr is offline   Reply With Quote
Old 12-14-2015, 08:42 PM   #19
llyair
Wiki Staff
FFR Wiki StaffFFR Veteran
 
llyair's Avatar
 
Join Date: Jun 2014
Posts: 307
Default Re: learning to code

Everyone starts from somewhere and just trying to ask for info/help is definitely the right mindset for improving! To re-emphasize what everyone else said, it's important to think about how you want to code the solution before jumping in and realizing halfway through that it doesn't work and you have to start over again. One of my professors used to recommend about 50/50 ratio for planning/implementing, and from experience I pretty much agree give or take depending on the problem, because usually if you design or do pseudocode correctly, implementing isn't too bad.

I think at this point it's just important to ask as many questions about your code as possible. Don't just read books about Java, do lots of practice, some OOP concepts/data structures that are hard to memorize without context (inheritance, polymorphism, interfaces, abstract classes, lists, hashmaps, etc.) can become a no-brainer once you see how they're used.

And also try implementing (or thinking about implementing) things different ways. Then ask, "well why does this way not work?" Or, "Why is that way better?" If you still don't get it, look for a different way of explaining that makes sense to you - everyone thinks differently, and that's okay.

And if you run into any weird syntax you don't understand, GOOGLE IT! In Java, keywords (final/constant/protected/etc.) have vastly different meanings, and learning how to properly use them can prevent bugs... And another nice thing is, a lot of the keywords' concepts carry over into other languages, so it's usually worth it to try understanding them. I definitely recommend investing the time to ask the questions now, when you're in your first semester, rather than later when a good foundation will be critical and you'd also be busier with other upper level classes xD

Another big thing that was very helpful for me was learning how to debug properly to find out what's not working. Adding print statements is fine at first, but a debugger is much more powerful. Eclipse has a good debugger.

Last edited by llyair; 12-14-2015 at 08:47 PM..
llyair is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 08:14 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
Copyright FlashFlashRevolution