[Burichan] [Futaba] [Greygren] [Plusle]  -  [Home] [Manage]
/tek/ Technology Archived Board plus4chan home [baw] [co/cog/jam/mtv/tek] [ck/coc/draw] [pco/coq] [a/mspa/op/pkmn] [Burichan/Futaba/Greygren/Plusle]
[Return] [Entire Thread] [Last 50 posts]
Posting mode: Reply
Name
Email
Subject   (reply to 2655)
Message
File
Password  (for post and file deletion)
  • Supported file types are: GIF, JPG, PNG
  • Maximum file size allowed is 7168 KB.
  • Images greater than 200x200 pixels will be thumbnailed.
  • Currently 634 unique user posts.

File 129385971659.jpg - (14.82KB , 320x240 , dingwen[1].jpg )
2655 No. 2655
I saw a TED speech about essentially today you have no excuse to not be able to program- we should be teaching it to kids so that use computers as a tool, not a video game console to the interwebs, and that programming is something that all computer users should be able to do, and I agree.

So I'm trying to learn to program. The most practical I can think of is Java, for making actual programs, and having taken a little bit of programming in the past it looks the most familiar to me, plus you can get a working GUI virtually right away. Is Java a good language to start with? I know people will say "C++, faggot" but I tried reading a book about that and it looks a bit... overwhelming. I'd go with python but that looks a bit TOO easy.

what was YOUR first language? how many do you know now and do you think your first language contributed to how easy it was to learn more than one? Do you actually program for a living? What'd you recommended to do, first off?
Expand all images
>> No. 2656
QBASIC,

...Don't judge me.
>> No. 2657
HTML

the thing with the programming languages is that while they're all syntactically and procedurally different, they all perform more or less the same function. So at the basic level you'll understand that every language has the same kind of operation, but slightly above that they'll start to differ.

Java is the wave of the future due to its' complete take over of the smart phone market. It's a good language to start with and a good language to continue with. Its' critics seem to cite its' memory clean-up as its' primary issue, as javas' environment contains automated memory clean up and frankly that is never as good as a program designed to clean up the memory used on its' own how many programmers actually adhere to this is a different story.

C is for the hardcore and #C is for the corporate. C++ is basically C with updated libraries and support for extended use with those and user made libraries. C in some form is recommended because it is the line between modern programming languages and old-school assembly and if you get any kind of programming job some knowledge of it is probably required.

Don't under-estimate Python. One of its' key features, namely the need for correct syntax, makes it longer and harder to program for than languages that ignore "white space". However the benefit is that the code must always be correctly punctuated, and is thus easy to review. It is nearly as powerful as C, but not as oriented towards hardware control. Python is easily and frequently integrated with databases in running the LAMP configuration (Linux, Apache, MySQL, Python/Perl) and provides the backend to our lord and master the Google.

Those are the 3 I know something about. I can speak about Ruby on Rails or Javascript or PHP but I am not familiar with the arguments for or against their use.

This is problem of everyone learning programming, and what people who want to program perhaps don't understand at first:programming is a matter of constantly learning languages. It gets easier with time, yes, but new languages also come out, and programmers are expected to keep on top of them even if their code can do everything the new language is meant to do in a single line.
>> No. 2660
HTML was the first coding language I ever fucked around with, but that's not really programming so it doesn't count.

The FIRST programming language I learned was a bit of BASIC in an engineering class so I could program a BOEBOT. Then I fucked around with MATLAB for a while in another class, but that was mostly self-taught because the teacher knew fuckall about what he was doing. The only language I really know a decent amount of is C++ because I took a full class just on C++ for engineers. If you've got good references and you learn shit in the right progression, it's a fairly easy language to grasp as long as you're not just completely allergic to learning to program.
>> No. 2661
>>2657
>This is problem of everyone learning programming, and what people who want to program perhaps don't understand at first:programming is a matter of constantly learning languages. It gets easier with time, yes, but new languages also come out, and programmers are expected to keep on top of them even if their code can do everything the new language is meant to do in a single line.

I can see where you're coming from, but I still think the option should be there at least at an early age for children to learn. I don't know how it is most places, but anywhere I've ever been the earliest the option to learn programming pops up for kids is high school and more commonly right around college. Programming classes really ought to be available commonly in middle school at the least these days. It's like learning a foreign language after all, the earlier you start the easier it is to catch on.
>> No. 2662
File 129395137397.jpg - (187.06KB , 748x910 , script[1].jpg )
2662
>>2657
>Python
>almost as powerful as C

s...shit... well do you think I should give it a try? maybe it's general simplicity visually would be a good idea, I've only ever heard really great stuff about it. The programming GUI is sort of scary, IDLE is some serious command line level looking shit.

I wonder if I shouldn't do something like dual-boot some Linux distrobution, I hear you need a bit of coding savvy to get around that?
>> No. 2663
I think my first programming language was something like LOGO. It was whatever you did to make the turtle move around on the computers in elementary school. But I didn't really start programming programming till Batch scripting and QBasic when I was about ten. From there I moved on to VB, then HTML (and javascript), C, PHP, and Ruby (initially via RPG Maker 2000), and these days I've dabbled in about a zillion others like Python and Perl.

But honestly, when I need to program something these days I usually do it in HTML and/or PHP. For all they're "not programming languages," the simplicity of making a web page and testing it, not to mention the level of power possible in modern web browsers using just HTML, Javascript, PHP and MySQL covers just about any program I want to make--and making it a webpage makes it instantly portable, on top of that.


QBASIC was really easy to learn, and yeah, I'd say knowing how to do that lead me to being able to learn the others. Learning to think programmatically is the biggest part of learning to program. Learning the general syntax of a new language takes, like, an afternoon or a weekend (though you'll need a refresher each time you do it if you don't program in it regularly) as long as you can Google specific classes and special operators and things.
>> No. 2664
The problem I can see with trying to teach programming to the masses is that every single time I've tried to either read about it or have it explained to me, it felt like trying to follow a person with aspergers telling you half of a conversation, speaking in acronyms and using a lexicon of terms freely that you simply aren't ken to. The WORST aspects of trying to learn anything from stereotypical trekkies, comic geeks or that ilk. There's so much to cover, and programming is really only for the people who have some pre-existing knowledge of things they don't understand.

Honestly I think if you're going to do that, go for broke and just teach C. It's powerful, it's timeless and will likely still be around until we replace 1s and 0s with something else. The way I understand it, C# is for stubble, C++ is for soul patch, and C is for beards.
>> No. 2667
Java is probably good if you just want to play around a bit; I haven't used it in about five years, and I hear they really cleaned up the syntax for basic stuff since then.

If you don't want to go that deep and want immediate results, though, I'd recommend Javascript. Loose typing, low "prep" coding (like including files or having to go PUBLIC STATIC MAIN just to throw up an alert box) and all you need is a text editor and any modern browser. It will give you a basic idea of coding in general, but if you want to do real coding you will want to continue with Java. Something in the .net suite might be worthwhile as well.

>>2660
>HTML was the first coding language I ever fucked around with, but that's not really programming so it doesn't count.
Thank you. A lot of non-coders seem to have trouble understanding that HTML is not a programming language-- it's a markup language (the ML part of HTML), otherwise referred to as a stylizer (though the "style" part has gone more to CSS now). A program computes data-- HTML does no such thing, it merely takes available data and arranges it structurally.

If you want to mindfuck, learn Haskell.
>> No. 2669
>Out of curiosity, look up Hello World to see what it looks like in "a few" programming languages.
>mfw IT'S FULL OF STARS.

Why do we have so many languages god fucking damn. It's like Jay Leno's garage in here.
>> No. 2670
Disclaimer: I'm in the early stages of learning myself...
I'm a student who is changing his major to C.S. starting this spring. I've had some general programming experience in the past - including Java - but in my free time I've been studying C++.
Technically my first language was VB.Net way back in the day and it did an alright job of introducing me to some of the basics of programming. You could start there but I think it would be in your best interest to start with something that isn't geared toward one specific platform.
Another thing you should consider is what your goals are for programming - where you want to go with it/what you want to write. Then consider what language would best help you accomplish those goals. This will require some research on your part.
Personally, in my view as of this moment, I'd suggest C++. It's a very versatile language and is used virtually everywhere.
But yes, it can definitely be overwhelming. By no means is it the "simplest" or "cleanest" language out there. However, you can help yourself by using good learning tools/references.
If you decide to give it a look, these are good starting books:
- C++ Primer Plus (try to get the latest edition)
- Ivor Horton's Beginning Visual C++ 2010
You can download Visual C++, which is a good IDE for a beginner to use from Microsoft for free...
Also, you may want to have these sites bookmarked:
- http://www.cplusplus.com
- http://www.cprogramming.com
And these are just some of the resources out there... Oh and I personally chose C++ at the beginning because it is largely used in game development - which I'd like to make a hobby.
>> No. 2671
Really Stupid Question that Probably Belongs On Google time:

How important is it to know Machine Code/Native Code? I know, it's niche. But in my head I just imagine that somewhere in some laboratory at Intel, AMD and others, there must be cutting edge motherfuckers that know how to converse with hardware models. If only in order to design hardware architecture. As a person with a fascination for assembly and speaking directly to electronics, and a soft spot for all things super efficient and quality, are there even jobs anymore for people that know Machine Code and Assembly the way your everyday programmer knows C, Lisp, Python or Perl?
>> No. 2676
>>2671
depends on usage. For the engineering of new tech, it's necessary, hence for business it is necessary.

But for practical, everyday use? Not very. Writing a driver or similar is not something one wants to do everyday. Scripting languages like Perl are recommend for everyday Nix use though.

For windows I'm just trying to find a driver detection and download program right now.
>> No. 2677
>>2676
I've got a friend or two trying to get me to comprehend C. If I can actually get to the level where I could use it for anything I'd need to program, (a big IF since the process is.. slow) I think I'd *really* like to take up tedious, hobby programming in Basic. Ideally getting to the level of understanding native code for new or proprietary hardware seems like it'd be a great niche.
>> No. 2679
>>2677
If you can get access to it through a university or some-such, it might be worthwhile to train in MATLAB's scripting language. It's a little more complex than BASIC will be, but (from experience) it's easy for beginners, and I'd guess that the syntax will be closer to the true programming languages than BASIC will be.
>> No. 2680
>>2664
But really, I can say from personal experience that it's completely different beast just talking to someone who knows coding or reading a guide of some sort as opposed to actually taking a class which gives you hands-on experience with the language. For the longest time I tried to teach myself some kind of programming because I thought it was be interesting, but no matter how much I tried I could never really understand what was going on. I encountered all the problems you named, guides use acronyms or terms without explaining what they are, or they assume you already know something you've never heard of. In a class, you can assume that all the students know nothing to begin with, and start from basic (hurr durr no pun intended). After all the trouble I'd had trying to teach myself, the second I was in a programming class I caught on in no time flat. It's the difference of being in a teaching environment and having someone there whose job it is to answer all the questions you have about shit that doesn't make sense. I mean sure, not everyone's going to get it just like not everyone who takes a foreign language understands it. But some will.
>> No. 2681
The secret to learning a programming language is to use the Help file. That's how I first learned BASIC.

For the languages it supports, w3schools isn't bad for beginners who have no idea what they're doing. Some of their coding practices aren't great, but it'll walk you through coding in the various web scripting languages, including PHP.

Really, if you can learn the syntax for Javascript, you've already basically learned C and C++. You just need to learn details from there. But really that's true of any programming language. The main things you need to know how to do to be able to learn any programming language are:

1. How to assign and access variables.
2. How to do an "If/Then/Else" statements. May as well learn the equivalent of Switch, too, but if you know If/Then/Else you don't actually need Switch, it just makes your life easier.
3. How to do Boolean math.
4. How to do Loops and related control structures.
5. How to make functions, return values, and break out of the current subroutine.
6. How to access member variables and functions of objects (if the language is object-oriented)
7. How to define your own classes.

ADVANCED(-ish. We're still on easy mode, really)
8. "Include"-type statements to make other scripts part of the current program. Mostly an organizational thing rather than actually increasing your programming powers, but it's good form.
9. Variable types and how to work with them. (You'll want to know stuff like searching strings with Regular Expressions. Luckily, Regular Expressions are pretty universal, with only slight variations from one Programming Language to another).
10. Arrays and hashes
11. Writing to and reading from external files or databases.
12. Accessing the API.

MORE IMPORTANT THAN NEW PROGRAMMERS EVER REALLY WANT TO ADMIT:
12. "Programming Etiquette." In other words, things like how to use comments and white space to keep your code readable, proper naming protocols for functions and variables, and learning to document your code. This is going to vary from language to language and may have slight variation within organizations / communities, but overall there are generally "rules" for how to work with these things in any given programming language that make reading other people's code less like trying to see the future in goat entrails.


Once you've got all that stuff, you basically know that programming language. Everything from there is going to be learning the details of a given class, and that can easily be figured out in about five seconds if you've got an internet connection and a way to search Google.


The biggest thing about learning programming isn't learning syntax, it's learning to think like a machine. Once you can think like a machine, you can write in pretty much any language just by googling example code even if you've never worked in the language before.
>> No. 2686
>>2681
>Programming Etiquette

Good lord yes. The C++ class I was taking last semester had a big group project where we build a program to play Battleship against the computer. I was my group's assembler and I cannot tell you how fucking terrible it is trying to deal with other peoples' code when they can't be bothered to even indent anything (which the program we were using does for you most of the time) or include a single god damned comment. And then there were the wonderful group members who insisted on making up stupid joke names for every variable or function they wrote.

Terrible.
>> No. 2702
>>2667
>If you want to mindfuck, learn Haskell.
Come at me bro

For a new programmer, learning with Haskell is no harder than learning with any other language. For someone who already knows how to program, learning Haskell is as hard as learning to program in the first place. You're better off learning Haskell first!

Also the real mindfuck is J.
>> No. 2813
I've started to learn C++, just because every other self teach book for every other language I've looked at seems to require knowing at least a little of how to program as a prerequisite. So here's the question: I'm learning this entirely on my own. No backup, no class, no nothing. How do I keep from wanting to blow my brains out?
>> No. 2814
>>2813
I've never desired to blow my brains out while programming, so I'm not sure I have an answer to that. Are you hungover? Because that might be causing your desire to die, if so.
>> No. 2815
>>2814
Totally sober, but very, very frustrated.
>> No. 2816
>>2813
The best advice I can give you is to give yourself a project to work on. Trying to learn C++ just to learn is with no goal in mind can be frustrating as hell, but if you have a clear goal of what you're working toward and trying to do you'll make things a lot easier on yourself.
>> No. 2817
>>2816
Easier said than done.
>> No. 2819
>>2817
So make a game. That'll force you to use most of the tricks that you'll need to know to be a decent programmer, like how to use loops and control structures efficiently, the sorts of mathematical functions you've got to use the Math class for.

A game that can be played in the console window, since you don't want to jump write in to writing graphics engines, but making text adventures is how I got my start on programming. And knowing how to use the console is a big leg up when you want to debug your projects, since a live log of what your program's going through is a lot more useful than having to set breakpoints.

You don't want to have to deal with a complex parser at this stage in your learning, either, so a Zork-style Text Adventure is probably shooting too high. If you ever played Legend of the Red Dragon or games like that back in the BBS days, that's the sort of thing to shoot for.
>> No. 2821
File 129594570572.jpg - (25.50KB , 404x500 , beginningcgameprogrammi.jpg )
2821
>>2813
That can be difficult. Conventional wisdom says start with a command line interface and use either VIM or EMACs to write your initial programs.

But that can be a difficult environment to set up, let alone code in. I just got back into College for coding, and my instructor has us using the jGRASP IDE for windows. It's primarily for Java but I believe it has an option for C++ coding. It has a self-contained compiler and such, and was developed by a university for easy comprehension.

And really, if you're going to do this, sit down with a basic textbook and run through it for starters. Once you have a grasp of the basics, you can start fucking with them, and move onto more difficult concepts like data structures.

pic, unfortunately, is not an embedded book file merely an example of a text I own
>> No. 2838
>>2819
Attempting to emulate some kind of board game can be a good way to learn too, as stated back here >>2686 my class had us recreate battleship and that's something that can be done entirely in the console output window, just playing around with text output.
>> No. 2847
like everyone else my first experience with programming of anykind was html. soon after that i was dicking around with premade php scripts. even back then i didn't understand how php worked. it was only till recently after i took a c++ entry level course in college did I learn how programming works (there's a difference).

even now i'm not very good at it, it'll take me hours along with the online documentation to finish a script to do something, but it is a learning experience so i always take away something from it.

i only work with bash or even python, but the concept is the same and it serves my need.

my recommendation to anybody when learning how to program is to find a good teacher. i say this because for people like me, the concepts are just so unusual that you'll never 'get it' without a hands on approach.
also some scripting language, since you just skip over the boilerplate and learn how it works.

i dunno, it's just me.
>> No. 2905
>>2813
I have been programming for ten years and C++ still makes me want to kill myself
>> No. 2921
>>2905
Wow, really?

Did you have any sort of instruction in it, or has your experience been completely self-taught?
>> No. 2922
1st year CSC student here with a stupid question, why do some people seem to hate Obfect-Oriented programming so much?
>> No. 2923
>>2922
Herp, meant
>Object
>> No. 2925
>>2921
I started in high school and majored in CS in college.

>>2922
Because in the 80s and 90s people got really religious about it for no apparent reason. No two people can even agree on what "object" means, much less "object-oriented," yet half the programmers in the world seem to thing that as long as their code is object-oriented enough, nothing can go wrong. And when something does inevitably go wrong, the solution is to wrap it in extra layers of giant inheritance hierarchies and remote method invocation and seven kinds of reflection, all while ignoring the real problem.

Talking about OO makes me feel like an alcoholic. Just read these links.

http://paulgraham.com/reesoo.html
http://chaosinmotion.com/blog/?p=622
>> No. 2937
>>2925
One of my professors once said "a good programmer is a lazy programmer"

meaning why write 50 lines of code when you can do it in 1 line of code.

the thing is you have to know how to write it in 50 lines before you can write it in 1. I don't think that means you have to know how to write it in 50 classes.
>> No. 2938
>>2937
There's something to be said for code that can be easily read and maintained though. Just because you can use the lowest number of lines doesn't mean you necessarily should.

But I agree that programmers should be "lazy". I thought that the main goal of OO programming was reusable and maintainable code.
>> No. 2943
>>2938
Someone correct me if I'm wrong, but technically having fewer lines is better; when code is read by the machine, each line represents a single operation by the computer. So in more complex programs, if you can execute everything through shortcuts that keep the overall line count down, you should. At least, that's how I understood it.

The thing is in the real world you'll need to be able to interpret other peoples 50 lines of code, and learning the single-line method requires knowing the 50 already, so.

OO programming has its' place but it does little to define hierarchy or organize itself. The theory I always thought was most suitable was that of Logical application; you should always go with the most efficient (I.E. fewest number of logical operations) method that is possible for you.
>> No. 2945
>>2943
The effect that the number of lines has on the efficiency of your application is negligible, at least directly. More important is the efficiency of the operations you're doing in those lines of code.

As an example (using PHP just because that's what I've coded in most recently and am therefore in the right mind for thinking in that syntax), a five line script that goes:

----------------------------
$myString = "Hello World";

function sayHello() {
echo($myString);
}

sayHello();
----------------------------

Would be a lot more efficient than a three line script that says:

----------------------------
for($i = 1; $i > 0; $i++) {
echo("Hello");
}
----------------------------

That's a ridiculously overblown example, though, since it uses an infinite loop. But the point remains the same: how many steps you make the interpreter (or computer, in a compiled language) go through is more important than how many lines your code is.
>> No. 2947
>>2943
You'd have to unroll every loop and other such nonsense for this to be a realistic way to look at it, but actually you've hit on the key insight for program optimization: You can never make individual instructions happen faster except by changing the clock speed, so the only way to get from point A to point B more quickly is to reduce the number of steps involved.

So, speeding up a program generally involves the following:
1) Figure out which parts absolutely have to happen to get the result you need
2) Establish a set of rules for the program to follow to make sure this result will be correct (if you didn't care about correctness, you could reduce every program to a single instruction that does absolutely nothing)
3) Replace the vital parts with the shortest version you can find that still follows those rules
4) Remove everything else

Programs that do this for you are called optimizing compilers. The "optimizing" part is important, because there are some compilers that don't optimize shit. However, even with those compilers, the very first thing that happens is that your source file gets translated into a format where trivial shit like formatting (comments, indentation, extra blank lines) and variable names ("numberOfWordsInDictionaryNotContainingTheLetterE" vs. "n") no longer matter to the computer. So if you go around deleting all the comments and newlines and renaming your variables to one-letter names, your program won't get any faster, but it will get harder for humans to read.
>> No. 2948
01001000011001010110110001101100011011110010000001110111011011110111001001101100
0110010000100001
>> No. 3010
>>2943
it's generaly accepted that you need to be twice as smart for debugging a code than for writing it in the first place. so by definition, if you write the smartest code (with all the fancy shortcut you know) you'll never be able to debug it and make it run (and you ALWAYS have to debug your code).

go for readable, easy to maintain or change code. when the program is done, look if you need to make it quicker. if you don't, good, you're done. if you need to, profile it and work on the bottle neck and only the bottle neck.

that the real way to be lazy.

(one could argue that you have to make algorithm optimisation at the start. IMO it's depends. don't be dumber that you are and use the obvious effecient solution. but try to make your code in a way that is easy to change)

tl;dr: your code gonna be read, your code gonna be change, but you don't know if is gonna be fast enougth. make it readable and plastic. see speed problem at the end.
>> No. 3011
>>2948

01001101 01101111 01110010 01100101 00100000 01101100 01101001 01101011 01100101 00100000 01001100 01100001 01101101 01100101 01110100 01100001 01110010 01101001 01101110 00100001
>> No. 3013
>>3011

001010000101111100101001010111110010100100100000010110010110111101110101001000000110001101100001011011100010000001101011011010010111001101110011001000
0001101001011101000010110000100000011000100111010101100100011001000111100100101110
>> No. 3024
>>3013
00101000 01011111 00101001 01011111 00101001 01111110 01111110 00100000 00001101 00001010 01000101 01010111 01010111 01010111 01010111 00100001 00001101 00001010 01001110 01101111 00100000 01110100 01101000 01100001 01101110 01101011 01110011 00101110
>> No. 3027
ZmFnZ290cw==
>> No. 3028
>>3027
Tk8gVQ==
>> No. 3081
I can't remember if my first programming language was TI-BASIC or the Expression language for GMod's Wiremod. I suppose normal wiremod building is almost a coding language. The expressions got me into Lua coding for GMod, and after that I got a book about Python and PyGame. Learned some Assembly for GMod as well, and while Python is awesome and I love the Shell, it is horribly slow compared to Java or C.

At the same time I was forced to learn JavaScript in school (I actually had a use for it on my Minecraft server recently. Imagine my surprise.) and I've continued to learn Java with a book as well.

I feel like programming has more to do with learning to think and express actions in a way a machine can understand, and then the language is just flavoring. Talking has the same principle, you have to learn to express an idea, and then the spoken language is just a medium.
>> No. 3082
http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-00-introduction-to-computer-science-and-programming-fall-2008/

horray for learning!

also Java
>> No. 3084
oh hey
have you guys ever
guys have you ever
like seriously
guys
have you ever tried to
seriously
tried to use
java+alice
>> No. 3148
http://www.amazon.com/Head-First-2E-Real-World-Programming/dp/1449380344/ref=sr_1_1?ie=UTF8&qid=1302801138&sr=1-1-catcorr
>> No. 3215
Hmmm.....I took CompSci in highschool, learned Python as my first language. I can still remember the Tetris game I made with Pygame...
Afterwards, I learned Turing and Flash over the summer. Took CompSci again and learned Java. Then I went on to learn Scheme, C, C++, as well as PHP and HTML. Which technically isn't programming, but oh well.

I recommend learning Python first, as it is very visual, and easy to grasp on to the concepts. It is probably one of the most straightforward and basic languages, good for beginners.
>> No. 3216
Read the following statements and tick the box next to the correct answer.

int a = 10;
int b = 20;
a = b;


The new values of a and b are:
[ ] a = 20 b = 0
[ ] a = 20 b = 20
[ ] a = 0 b = 10
[ ] a = 10 b = 10
[ ] a = 30 b = 20
[ ] a = 30 b = 0
[ ] a = 10 b = 30
[ ] a = 0 b = 30
[ ] a = 10 b = 20
[ ] a = 20 b = 10

http://www.codinghorror.com/blog/2006/07/separating-programming-sheep-from-non-programming-goats.html
>> No. 3217
>>3216
That paper was interesting but also frustrating because I really would have liked to see what answers they were looking for.
>> No. 3233
>>3216
As it turned out later, the whole premise of the test was completely retarded. A lot of the people who gave the wrong answer were trying to read it as a mathematical formula, since they'd never been exposed to C/Fortran assignment conventions. Obviously, if you do that, this bit of code implies that 10 is equal to 20.

A follow-up study found that this is language-dependent. For example, you get quite different results if you use code in a language where "=" is only used for the first assignment, and you have to use some other operator for mutation (like Haskell). Alternatively you can just tell everyone to read "=" as "becomes" rather than "equals" and you see more or less the same improvement.

tl,dr: This test is useless.
>> No. 3237
>>3217

It's a trick question bro.
B wasn't assigned a new value.
>> No. 3503
File 131186698384.jpg - (172.49KB , 800x675 , my-cute-dog-derp.jpg )
3503
>make "Hello World!" work in C
>feel accomplished far out of proportion to actual accomplishment.
>> No. 3504
>mfw butthurt comp sci faggots
>peddling a worhtless skill already easily fulfilled by low-cost hindus
should have learned a real science, suckers
>> No. 3517
>>3504
This. There's no hard work involved in programming. All you do is sit in a chair and type. We already teach children to do that in kindergarten. Why are there schools that teach this to adults?
>> No. 3526
>>3517
>There's no hard work involved in programming
I don't think you realize how dumb that sounds.
>> No. 3542
>>3526
I think your trollometer has an extra GOTO 10 line somewhere.
>> No. 3579
File 131366757495.jpg - (429.01KB , 629x900 , 13598050.jpg )
3579
Why does everyone have to be able to program? I study this shit, because I want to do it for a living, why do you need to do it? Just use your computer and learn what interests you or you need to get along. If that involves using the terminal or fucking around with blog layouts or modifying games read tutorials.

We started with C. Followed by C++ and Java. The latter make things a lot easier but if you don't know the basics you'll never truly understand what the fuck your are doing.

And I hate everyone who writes one line instead of 50 in a team. Write clearly and comment if someone else has to understand it (including future self).
//When I wrote this, only God and I understood what I was doing
//Now, God only knows

HTML is for babbies. I enjoy being a babby.
>> No. 3585
Disagree with the guy in TED
Programming is not something people need to know (aside from theory), simply because not all people can grasp it.... hardware on the other hand, is something essential
Knowing how a screen or a hard drive works and how an entire computer fits together should be the kind of basics that are REQUIRED simply because people need to know how to manufacture computers

After all, not everyone knows automotive engine design but everyone knows how to fix a spark plug

>>2656
Hey, at least it's something
>> No. 3686
File 131526381113.png - (111.89KB , 1437x727 , Exercise example.png )
3686
I've been working on this beginner's Java exercise for about 3 hours now and I can't seem to crack it.

>Your program asks you to enter the size (number) of a row and get the row size from the key board. Based on the size of the row, your program asks you to enter the size of each column and get each column size from the key board. Based on the row size and the column sizes a user entered, you program constructs a two dimensional array and assigns integer numbers from 1 to the total size of the array, and displays all elements in the array.

I'm pretty sure I can assign all the numbers to the individual array cells and the like with some for-loops, but how do you set it up so that you can set the individual column sizes? Picture is an example of what my book is asking for.

Sorry in advance for what seems to be an easy problem, I'm just starting programming and all of this is a little new to me.
>> No. 3688
>>3686
The problem is, since the class wants you to demonstrate your knowledge of certain concepts, doing it the way I would do it probably wouldn't work all that well. Because personally I'd just build the array as the inputs were being given.

1. Create empty array.
2. Ask for row length.
3. Push a number of empty arrays equal to the row length into the empty array.
4. Loop through each of the empty member arrays.
5. Ask for column length.
6. Push values into active member array.
7. Repeat until done.
8. Display results.

But I suppose one way you could do it like the class is demonstrating is to just set the row length as a variable and then have the column lengths as an array with a number of integers representing the length of each column equal to the row length, then generate the two-dimensional array using that.



Also, if the value of each cell is supposed to be a raw cell count, you would also want to set up an extra iterating variable to keep track of which cell you're on, since your x iterator is going to get reset each time you finish a y loop.
>> No. 3804
>>3686
>>3688
Finally got it back, it's terribly commented, poorly thought out, most likely terribly inefficient, and all sorts of other nasty things. I'm still proud of it for being my first bit of code. And since it's graded I can finally share it with all of you!

import java.util.Scanner;

public class HomeworkOneArray {
static Scanner scanner= new Scanner(System.in);

public static void main(String args[]){
System.out.println("Please input the number of rows and columns you want.");
int NumOfRows=scanner.nextInt();
int NumOfColumns=NumOfRows;//So that the columns will equal the number of rows, making a square.
int[][] HWArray=new int[NumOfRows][];//initializing 2-D array and setting rows.
AskLoop(HWArray, NumOfColumns);//This method asks the user for the sizes of the individual columns.
FillLoop(HWArray);//This method fills the 2-D array with the necessary numbers
OutputLoop(HWArray);//Prints out the contents of the 2-D array
}//End main method

public static int[][] AskLoop(int[][] HWArray,int NumOfRows){
for(int a=0;a<NumOfRows;a++){
System.out.println("Size of this column?");
int column=scanner.nextInt();
HWArray[a]=new int[column];
}//End of column for-loop
return HWArray;
}//End AskLoop method


public static int[][] FillLoop(int[][] HWArray){
int Numbers=0;
for(int b=0;b<HWArray.length;b++){
for(int c=0;c<HWArray[b].length;c++){
Numbers++;
HWArray[b][c]=Numbers;//Without count the array will produce nothing but zeros.
}//End of inner loop
}//End of outer loop
return HWArray;
}//End FillLoop method

public static int[][] OutputLoop(int[][] HWArray){
//These two for-loops print off the array
for(int d=0;d<HWArray.length;d++){
System.out.println(" ");
for(int e=0;e<HWArray[d].length;e++){
System.out.print(HWArray[d][e] + ",");
}//End of inner loop
}//End of outer loop
return HWArray;
}//End Output method

}//End HomeworkOneArray class
>> No. 3805
>>3804
Out of curiosity how would I make this more efficient, or at least more self-explanatory? It just feels far too clunky, I'm sure I can reduce the amount of lines in my code somehow, and obvious, you can tell that I was required to make a lot of comments and went kind of wild with it all.
>> No. 3831
Impractical.


Nobody can do everything. We're already asking kids to learn a second language in school. It will only make the work load heavier and you'll end up with more dropouts and cheats getting through by the skin of their teeth.


I think it would be great if better classes were offered in public schools, but making them a requirement would be asinine.
>> No. 3834
>>3831
In my opinion, 'no child left behind' was concocted with the explicit intention of making it harder for normal kids to graduate. It did nothing about the failing school system or shitty teachers or defunct material itself and just put the thumb screws to the kids. No piece of graduation paper, you may as well be a felon as far as colleges are concerned. The idea that a second language should be required is absurd.
>> No. 3835
>>3834
>In my opinion, 'no child left behind' was concocted with the explicit intention of making it harder for normal kids to graduate.
I really doubt that. I have a hard time believing something could be so malicious when just plain stupidity and a lack of touch with the reality of teaching is already such a good explanation.
>> No. 3868
File 132008239696.png - (34.26KB , 400x251 , AmigaBASIC.png )
3868
I began with Amiga BASIC, ARexx and BlitzBasic, then learned JavaScript and PHP after long break. Now working as Java (learned, with C/C++, during studies) developer.

I think programming education should be like that:

Kids 7-12 years old: BASIC-256, LOGO or anything from this list: http://en.wikipedia.org/wiki/List_of_educational_programming_languages#Children

kids 12-16 yrs old: more sophisticated BASIC dialects (like VisualBASIC), first steps in C, Python, PHP etc. Maybe good old Pascal (like Free Pascal).

16-18 year old: C, Python, PHP moving to intermediate (like random file access, database connection etc.)

>18: Java, C++, C#, OOP in Python and PHP, just anything advanced and/or related to vocational training.

But still everything depends on the teacher.
>> No. 3873
Huh, I just failed a Java course this year and that article about the sheep and the goats pretty much describes me, particularly the bit about meaningless symbols - that really made me impatient with the whole thing.

My tutor was rather unhelpful too, I'm guessing he was aware of this statistic and just lumped me in the non starters as soon as I failed the first assignment.

>:(
>> No. 3874
File 132035062922.jpg - (16.25KB , 254x277 , Araki.jpg )
3874
>>3873
I was in your exact position once. About a year ago I started Java 101 for my Computer Science degree. I was lost in regards to every aspect of programming, and subsequently failed the midterm exam. However by the end of the semester I had an A- in the course.

Here's some advice if you decide to continue trying to code.

>Always write the code
It's nice to look at the teacher's power points, but at the end of the day you're never going to understand code just looking at it, you've got to get down and dirty with it to really understand it.

>Don't get overwhelmed by the entire program, take it method by method, piece by piece.
You have to assume a certain mindset while programming. You don't take a problem as a whole, you break it down into manageable pieces and solve it. When trying to understand a problem, don't let your eyes glaze over the method, start from the arguments and work your way bit by bit to the end. Look for patterns, when you find one you can duplicate it and have a significant part of the program or method written in no time at all.

>Learn from your fellow students as well as your teachers
I've learned just as much from my fellow students, if not more, about code than my teachers. Having to explain a program to a struggling friend or having a program explained to you in simple, easy to understand terms helps immensely. Don't be afraid to make friends with some of the CS majors in your class, they'll make life a lot easier for you.

>While coding look for shortcuts.
As previously stated in this thread, a good programmer is a lazy programmer. Don't write
>int a;
>a=3;
>return a;
write
>return int a=3;
Find ways to make your life easier, that's the secret to good efficient programming.


All that aside I'd be happy to help you out with whatever you're on! A few questions first:
>What topics are you studying in class/previously covered?
>What IDE (Netbeans, BlueJ, Eclipse, etc.) are you using to program?

Just post your code to pastebin.com and post it here and I, and maybe a few people who've previously posted ITT, will help you out. If you have any general questions (Data types, arrays, sorts, methods, syntax, etc.) then ask away. Don't give up just yet, it's hard at first but after the initial plunge it's all easy.
>> No. 3875
Thanks, it was a distance education course (Open university) so no fellow students, but I do know and share apartment with programmers so I could have asked, too proud maybe, or I just thought it was too basic to bother them (One of my flatmates is a working programmer, the other one is a E. engineer university lecturer doing a doctorate)

You're right about doing the code, I twigged onto that a little too late to save the course but it all became a lot clearer when I actually wrote everything myself, no matter how obvious and "duh" it seemed when just reading it.

It's been a frustrating and expensive waste of time, so I'm thinking I'll keep trying (That pride thing again, I don't want to be a goat) but I'll go solo. Maybe set myself some kind of project to motivate me.

I'm thinking switching to python and learning what it can do in conjunction with blender, which I'm also learning.
>> No. 3946
>>3875

no such thing as a doctorate for engineers
>> No. 3954
>>3946

maybe they are an Engineer doing a doctorate in a different field
>> No. 3960
I don't know what to tell you. His thesis is in software engineering, cloud computing applied to mobile phone platforms.
>> No. 3961
I don't know what to tell you. His thesis is in software engineering, cloud computing applied to mobile phone platforms.
>> No. 3973
Hah. I suppose technically it would be Pascal in school.

But really, first proper language learned was VB. I think it's an awful language now.

Now I know C++ (and by proxy a bit of C), C#, Java, bit of Python, bash scripting and ofc HTML (the easiest one of all and not *really* a programming language per se - it's a markup language). Oh yeah and xml.

I think once you got the basics down and can get your head around variables, value vs reference types, functions and classes, then everything else is easy.
>> No. 4036
Does a Window Manager for Linux, coded in C, seem like a project to take on in order to learn the language?
I have never learned anything more than the cursory Python tutorial, but I have also never had a reason to program.
>> No. 4053
File 132794276574.jpg - (604.48KB , 1024x600 , 129333489452.jpg )
4053
I fucked around with QBasic in high school, barely passed, tried VisualBasic and ragequit due to the sheer childish nature of the language. (Also, I was stupid.)

Like OP, I'd love to learn me some programming language, only I'm not sure where I'd even apply such a hobby. Would Javascript or Python be a more useful language to learn?

>>3585

This makes a lot of sense to me. But learning about computer hardware seems like it would be more difficult than learning a programming language. . . Which is more complex, the way it all fits together or understanding the software?
>> No. 4055
>>4053
Understanding the hardware is more difficult, and less useful day to day. A working understanding of soldering, electricity and general circuitry is more than sufficient for your average enthusiast. They have programs complicated enough to design Computer chips now, and non-civilian tech is beyond even that.

Code, however, is free with the purchase of a computer. IDE's are free. The problem is self-directed coursework. Understanding the theory of it can be different then the practical work. Since programing languages have their own libraries, it's fully possible to follow enough directions to create market ready programs without a full knowledge of how they actually work. Not a good idea, but possible.

I'm reading a how-to java book by Robert Lafore right now. It's good stuff, simple explanations. There's a logic to all this but too many people like to keep their damn jobs.
>> No. 4056
>>4053
>But learning about computer hardware seems like it would be more difficult than learning a programming language
In my experience learning a practical amount about hardware is far easier than learning enough of a language that you can do useful stuff with it.
>> No. 4063
From grade school to high school I learned:
Logo
BASIC
Turbo C++

And I think one other language, but I can't recall clearly.

I remember barely anything about how to program on those anymore. :p
>> No. 4069
I'm taking a course that goes over bioinformatics analysis tools, learning really basic stuff like baby steps in mysql and perl.

And good god. R. I cannot stand R. The documentation is no help for even basic things and the error messages are cryptic with no useful explanation available.
>> No. 4070
I should come to /tek/ more often. I had no idea this thread was here.

4th year in the computer science major, still feels like I'm making shit up as I go along while waving my hands. I'm not sure if that's how I'm supposed to feel though.
>>4053
>This makes a lot of sense to me. But learning about computer hardware seems like it would be more difficult than learning a programming language

Speaking from my limited experience, which just amounts to a couple of classes, it's not particularly too difficult. I mean, unless you're talking about the engineering perspective. But when you get into stuff like caching, pipe-lining and all that jazz it's not too bad. I mean I had a much easier time understanding that than grasping things like dynamic programming.

But really programming languages are kind of in a similar situation considering you can solve a lot of problems without actually going too in-depth of an understanding of the language. But then again there are people who could go to graduate school and spend years trying to learn the ins-and-outs of a language and still not completely understand it all.
>> No. 4078
It think it was the BASIC variant that was used in "Learn to Program Basic", though I might have tried out batch files a bit first.
Not sure I know any that well, I know some BASIC, ANSI C, the fact that I do not want to use Java ever, Flash, and now some Lua.
No I do not.
I think a QBasic variant might be good, but so far Lua is nice. Very C-like, but to me it seems a bit easier. Though now that I think of it, I might be able to go back and do better at C, I'm not sure. I ran into a brick wall trying to work with the filesystem the last time I tried C, but it went pretty smoothly in Lua despite the complete I/O model being so similarly to that of C. I think a part of it is that I'm not searching though a pile of libraries for the most simple of tasks. The Programming in Lua Guide has been very useful, at any rate.
[Return] [Entire Thread] [Last 50 posts]


Delete post []
Password  
Report post
Reason