|
Thread Rules 1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution. 2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20) 3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible. 4. Use [code] tags to format code blocks. |
On November 18 2015 05:03 solidbebe wrote:Show nested quote +On November 18 2015 04:15 Cyanocyst wrote: Hey guys, I have literally no coding experience at all. Disappointingly I graduated with degrees in Accounting and Finance last year. But i honestly hate both subjects.
Anyway my university requires significantly more math as pre-requisites for computer science, than it did for either of my majors.
Is high level math directly needed to code at all? I understand that more math could probably sharpen your problem solving skills, and that could indirectly help your coding. Though wanting to know if it is directly related to any language.
Also what is the easiest language to learn for a complete noob? I would like to try to teach my self some kind of coding just to see if it truly is something i'm interested in.
Due to already having degrees, and not wanting to pay for more of them, no matter what, i'll probably never actually be good at this. Though maybe i could make a hobby out of it. There are some programming jobs where you need to have strong math knowledge like games or cgi movies. I'd wager to say this is a very small percentage of programmers who end up in these kinds of fields though. For any other programming, you don't need anything more than basic arithmetic really. Good languages to start with I'd say python and java. They are high level so relatively easy to learn and very well supported ( many tutorials and such ).
Not Java 
I'd go with Python (high level) or C (low level). Python is pretty easy to get a hang on. It's also pretty widely used (mostly for scripting) and there's plenty of resources for it. C is a bit trickier although I'd still suggest at least trying it out since the base of it is so small (as in - you don't have to remember thousands of functions, abstraction layers and what not). With C all you really need is the K&R book, which is just 300 pages. That's nothing compared to some other languages (Thinking in Java is what, over 1k pages and after that you still don't know much?).
Good place to start is the free "Learn X The Hard Way" tutorials: Python C
If you want to go with something else (like Ruby) there are courses for that too: http://learncodethehardway.org/
Also, a nice piece posted in the C book there: http://c.learncodethehardway.org/book/krcritique.html
|
|
On November 18 2015 03:23 WarSame wrote: Every time business rules change, a lot of the code changes. That's why most legit projects design what they are going to do before implementing it. Otherwise you have to go back and change a lot. Try to have an idea of what you're going to do beforehand, but don't worry if you have to go and change things. It's a process.
Thaniri is right about you overcomplicating it. That type of implementation in js is not that hard. If checking a check box makes all other check boxes in a set become checked, then use a list of that set of check boxes. When you need to check them all just loop through the list and check them one by one.
On November 18 2015 03:06 Thaniri wrote: That honestly sounds like you're over complicating a website.
If all you're doing is form controls then you can write simple onclick events where if one box is checked then other html elements get checked/appear in the dom.
You'd be using javascript to manipulate html element attributes in that case.
Thanks both of you! You're probably right. It's just that my skills are so limited in the area of front-end development, so it takes me forever to make it do what I want.
On November 18 2015 03:50 Manit0u wrote:You should really look into integrating AngularJS into your application then. It can handle all of the UI logic very well, works great with RESTful applications and can also improve UX and reduce server load if done correctly. Thanks for the suggestion! I'll check it out. I figured there had to be a framework out there already for this sort of thing.
|
On November 18 2015 06:07 solidbebe wrote: Why not java?
It's not that great for starters. Just compare it to Python...
Java:
public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World!"); } }
Python:
print "Hello, World!"
With Java you have to explain the classes, arguments, visibility, dependency and everything else right away. Not to mention compilation... With Python you just fire your script and it works automagically. Much easier on beginners in my opinion.
My biggest gripe with Java is that it seems like you have to write what seems to be an essay or an entire prayer to the machine-spirits to get even the simplest things done.
|
On November 18 2015 06:07 solidbebe wrote: Why not java?
What arguments against Java for beginners can you think of? Do some of them feel fair to you?
I think mine would be how the start looks like, the most simple programs you can do when introducing someone to programming. The hello-world one in Python 2 is for example:
print "Hello, World!"
You know how the same program in Java looks like. You perhaps ask people to please ignore most of the lines in the program because you can't explain them in a way that's real understanding. If you do try to explain, it's a shitty explanation that's about concepts that make no sense at that point. It feels like both options you have to deal with those strange lines might be a bit harmful and it's neat that this is not a problem with Python.
EDIT: posted too slow
|
On November 18 2015 04:15 Cyanocyst wrote: Hey guys, I have literally no coding experience at all. Disappointingly I graduated with degrees in Accounting and Finance last year. But i honestly hate both subjects.
Anyway my university requires significantly more math as pre-requisites for computer science, than it did for either of my majors.
Is high level math directly needed to code at all? I understand that more math could probably sharpen your problem solving skills, and that could indirectly help your coding. Though wanting to know if it is directly related to any language.
Also what is the easiest language to learn for a complete noob? I would like to try to teach my self some kind of coding just to see if it truly is something i'm interested in.
Due to already having degrees, and not wanting to pay for more of them, no matter what, i'll probably never actually be good at this. Though maybe i could make a hobby out of it. I vouch for the others saying Python is a good choice. Further, check it out with an IDE. An IDE is basically an editor that has a few nice things for your code(highlights words, auto completes variables, etc.). PyCharm is a good, free choice to use.
I started with Java and found it painful. Python is a much nicer language to start with. The helloWorld is just a small example. The similar functions are nice too(consider functions for Java's int vs. Integer).
|
You guys make a fair point. I think python is more suited to beginners as well.
Manitou you suggested c. Dont you think this problem is way worse in c than in java? C is lower level, has a more verbose (and weird) syntax, has a lot of weird intricacies and exceptions and generally deals with more confusing things like pointers, pointers to pointers, function pointers ( really anything pointers ) than java ever does.
|
C is very hard to start with. It's the programming equivalent of cooking a 5 course meal for your first meal. You will probably eventually want to get into C for all that it offers, but there are so many good languages that abstract most of that away until you need it.
However, I think C generally has neater beginner code than Java. Hello world in C is:
int main(){ printf("Hello world!"); return 0; }
Compare that with the ugly mess from Java above.
|
I think you all are making a big deal out of nothing with the java code though personally. I learned to program in Java and the hand waving at the start didn't bother me at all. The same thing happened in pretty much any math class I took prior to university where you just accept that this works and then it'll be explained why later on.
Not learning Java so you can be exposed to pointers and (less detailed) debugging I can get behind, but not knowing what half the words mean in the first program you write is acceptable.
|
Sure, you can just wave it away. It's still very frustrating to most beginners to have to wave away what feels like 1/2 of the program as something they will be able to do down the line. It makes it tougher to follow examples, to read code, etc.
It's not a huge deal - but it is a point against Java for beginners. In my eye, the messy functions and types that Java has are more points against it than the messy basic function in Java.
|
If you're getting into programming on your own I highly doubt you'll have an extended use for C in the long run.
|
On November 18 2015 07:51 WarSame wrote: Sure, you can just wave it away. It's still very frustrating to most beginners to have to wave away what feels like 1/2 of the program as something they will be able to do down the line. It makes it tougher to follow examples, to read code, etc.
It's not a huge deal - but it is a point against Java for beginners. In my eye, the messy functions and types that Java has are more points against it than the messy basic function in Java.
You should embrace this frustration early on so that when you have to deal with legacy code or even just read some code you wrote a year ago you're ready.
|
I started with C and I'm glad I did, but it was in a school with rules to follow. Without that part forcing me to actually understand the depth of C and programming in general, I wouldn't have gained much more from C than any other languages, except I'd have to deal with "weird" stuff every now and then. But again, I'm glad I did come to understand these "weird" stuff, so if you can enforce that curiosity on yourself, sure, why not C to start with
|
On November 18 2015 07:53 Itsmedudeman wrote: If you're getting into programming on your own I highly doubt you'll have an extended use for C in the long run. Good point, but in my school if you wanted decent hands on experience you had to do it on your own outside of class. If you wanted to become a Software Engineer(my program) you almost 100% need C. You can switch to it decently easily after other languages, but you'll need it.
On November 18 2015 07:59 Blitzkrieg0 wrote:Show nested quote +On November 18 2015 07:51 WarSame wrote: Sure, you can just wave it away. It's still very frustrating to most beginners to have to wave away what feels like 1/2 of the program as something they will be able to do down the line. It makes it tougher to follow examples, to read code, etc.
It's not a huge deal - but it is a point against Java for beginners. In my eye, the messy functions and types that Java has are more points against it than the messy basic function in Java. You should embrace this frustration early on so that when you have to deal with legacy code or even just read some code you wrote a year ago you're ready.
There's already enough frustration in other languages to go around. Python's a simple language, but I've sat there for an hour trying to catch an error from negative indices, only to realize that Python treats them as index from the end of a list.
On November 18 2015 08:01 Cynry wrote: I started with C and I'm glad I did, but it was in a school with rules to follow. Without that part forcing me to actually understand the depth of C and programming in general, I wouldn't have gained much more from C than any other languages, except I'd have to deal with "weird" stuff every now and then. But again, I'm glad I did come to understand these "weird" stuff, so if you can enforce that curiosity on yourself, sure, why not C to start with Absolutely. C is great for the weird stuff. Most programmers want to get into it and do some stuff right away. Python's got great basic libraries for games, etc. so they can have a tangible example of their skill. C(and Java, etc.) don't have those nice libraries, but they're great at their own things. Every language has its own unique set of benefits and drawbacks. Python's just happen to coincide with being a great beginner language.
|
On November 18 2015 07:53 Itsmedudeman wrote: If you're getting into programming on your own I highly doubt you'll have an extended use for C in the long run.
I care to disagree here. Most of the languages use C-like syntax, so getting yourself familiar with that will go a long way.
I wasn't really talking about mastering C or anything like that. Just giving it a spin for the most basic stuff (assignment operations, comparison, if/else conditionals, for and while loops). C is relatively simple in this regard but you're going to use it in like 90% of other languages. The difference between C and some newer languages is that C is much less forgiving, thus teaching you better practices from the get go. Also, understanding how strings are actually stored and how some of the commonly used functions that search/compare/do magic with them work is very beneficial. If anyone would go as far as learning some basics of how the memory is assigned and released (heap, stack and all that) it won't be a time wasted.
|
On November 17 2015 18:12 Itsmedudeman wrote:I meant something that could look like if(count == 500) { s++; if(s > 59) { m++; s = 0; if(m > 59) { h++; m = 0; if(h > 12) h = 0; } } }
I could probably think of a better example where it just looks unreadable, but you get my point.
In that instance it sounds like you're trying to replicate some timer logic. The answer to that specific domain then is to use a proper library to handle clock state for you, instead of re-inventing the wheel.
Or, if say you're working in embedded C on a microcontroller (having personally written something roughly like that in embedded C before lol), maybe you don't have access to a proper clock library. But you can structure it more cleanly:
int const ticks_per_second = 500; ... // I don't know how your system is, but might be that one or more of these // are modified in a volatile context (interrupt, w/e). change as needed volatile int counter; volatile int seconds; volatile int minutes; volatile int hours;
...
if(counter % ticks_per_second == 0) { increment_seconds(); }
...
increment_seconds() { seconds = (seconds + 1) % 60; if (!seconds) { // I'm lazy shoot me increment_minutes(); } }
... so on and so forth
Now in a better situation you build up a proper time library, which doesn't even keep track of seconds, minutes, hours individually. Just calculate that shit on the fly when you need it:
int const ticks_per_second = 500; ... // Now we store only counter, and derive everything else. volatile int counter;
int getSeconds() { return counter / ticks_per_second; }
int getMinutes() { ...
Now I realize this doesn't answer your general case, but usually if you get wonky logic you may be able to abstract something out.
|
On November 18 2015 11:27 phar wrote:+ Show Spoiler +On November 17 2015 18:12 Itsmedudeman wrote:I meant something that could look like if(count == 500) { s++; if(s > 59) { m++; s = 0; if(m > 59) { h++; m = 0; if(h > 12) h = 0; } } }
I could probably think of a better example where it just looks unreadable, but you get my point. In that instance it sounds like you're trying to replicate some timer logic. The answer to that specific domain then is to use a proper library to handle clock state for you, instead of re-inventing the wheel. Or, if say you're working in embedded C on a microcontroller (having personally written something roughly like that in embedded C before lol), maybe you don't have access to a proper clock library. But you can structure it more cleanly: int const ticks_per_second = 500; ... // I don't know how your system is, but might be that one or more of these // are modified in a volatile context (interrupt, w/e). change as needed volatile int counter; volatile int seconds; volatile int minutes; volatile int hours;
...
if(counter % ticks_per_second == 0) { increment_seconds(); }
...
increment_seconds() { seconds = (seconds + 1) % 60; if (!seconds) { // I'm lazy shoot me increment_minutes(); } }
... so on and so forth
Now in a better situation you build up a proper time library, which doesn't even keep track of seconds, minutes, hours individually. Just calculate that shit on the fly when you need it: int const ticks_per_second = 500; ... // Now we store only counter, and derive everything else. volatile int counter;
int getSeconds() { return counter / ticks_per_second; }
int getMinutes() { ...
Now I realize this doesn't answer your general case, but usually if you get wonky logic you may be able to abstract something out.
Nice. Just out of curiosity, was my answer to him any good? I'd like for someone obviously more knowledgeable in C than me to give a comment on this little monster I've created. I really need to work my C-foo back up a bit 
http://www.teamliquid.net/forum/general/134491-the-big-programming-thread?page=677#13538
|
I'm not that knowledgeable, but here are some comments :
Your counter create function takes 3 arguments and uses none. The count variable is never increased in your main.
I would probably have called all 3 sub functions (test x, y and z) in the test all, instead of nesting them as you did. I think it's more ressource efficient ? Been a while though...
|
I gotta make a board game working in a network, like a chess game where each player can play on their own computer. Any idea how to do it ? I have to use MVC pattern so it's kinda annoying,...
I was wondering, should I take a Client-Server type of approach, like the Server side is handling the Model-Controler type of things, and a second part, the Client, just handling the View and sending request to the Controler on the Server ? And is the networking part be handled by the Model, or by the Controler ?
My first guess is something like :
Server Side Model : Board, -initBoard(), -Players, -addPlayer(), -currentBoardState, -timeLeft(), -turn, -Point, ... -possibleMove, ... Controler : -move(), -isViableMove(), -changeTurn(), -changeTimeLeft(), -...
Client Side View : -Jpannel -ActionListeners -controlerRequests -Server connection
|
On November 18 2015 08:21 WarSame wrote: Good point, but in my school if you wanted decent hands on experience you had to do it on your own outside of class. If you wanted to become a Software Engineer(my program) you almost 100% need C. You can switch to it decently easily after other languages, but you'll need it. I am a Software Engineer and I don't need C. I am (or was) decent at C++, but I haven't used that in quite a while either. C is quite different from C++, so I wouldn't even consider myself good at C. I need C#, and that's pretty much it. Lots of Cs in here.
|
|
|
|