[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
I'm a newtard on programming at all I simply don't
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /wsr/ - Worksafe Requests

Thread replies: 35
Thread images: 2
File: what the chucha.png (53 KB, 1360x723) Image search: [Google]
what the chucha.png
53 KB, 1360x723
I'm a newtard on programming at all

I simply don't get what am I doing wrong with the "{"

Anyone knows where on the pic am I being a retard?
>>
>>93203
>semicolon in the middle of a declaration
retard
>>
>>93205
Oh my fucking god I'm so stupid
>>
>>93205
It's called being flaite, OP is chilean
>>
>>93209
Yes, you are.

But the worst part is not your semicolon in the middle of a declaration. It's the fact that you're starting programming with C#.

Get used to thinking first. Start with a language that is much closer to pseudocode, like Python. Once you understand the basics there, then you move to the C-likes.

Go pirate Python Programming for the Absolute Beginner, and start from there.
>>
>>93211
You got me
Now pasa toas las moneas ctmre
>>
>>93212
This is the worst advice I've ever seen.

One should always start with a lower-level language like C or even Assembler, so you know what the fuck you're even doing and what the computer does with your commands, then move on to a higher level language like C++, C#, Java, and only then should you consider moving on to a script language like Python. If you go the other way round, you'll have a much harder time.
>>
>>93397
This. Learning about pointers as soon as possible was the best choice I ever made.
>>
>>93418
Every OO language has pointers; you are an idiot.

>>93397
That's great advice if you want to learn how to write '80s procedural code in every language you touch.
>>
>>93432
First of all, Python, for example, is an OO language that doesn't have pointers.

Secondly, no one said you should stick to procedural code. You start with a procedural lower-level language like C, then learn an OO language like C++ etc.

If you skip directly to higher-level languages, however, you'll become one of these programmers who're spoiled by convenient predefined functions and and don't know shit about performance issues.
>>
>>93432
C# is OO and doesn't support pointers per default.
>>
>>93448
Now that's just crap right there.

The only way, in either of those languages, that you can even reach an object is through a pointer to it.

Just do a Computer Architecture 101 course. Or write Procedural/Functional, and let the compiler sort it out.
>>
>>93448
>spoiled
Oh, so it's the Protestant work ethic, is it?

Your code is worth more because it took you more effort?

You don't get marks for effort outside of primary school.
>>
>>93486
I'm not talking about whether Python uses pointers underneath the surface or not. Python doesn't offer you any pointers. Period. If you learn programming with Python, you won't even learn what a pointer is and how memory allocation works.

>>93488
No, you dumb fuck. Languages like Python have so many convenient functions that you're fucked when you try to use a more widely used language like C++ because it doesn't have any of those because you'd either have to use a fucking huge library like Boost or implement the functions yourself.
>>
>>93516
The only way to access an object in Python is through a pointer. There are no object primitives, there are no object literals. When one object has a field that's another object, that object is not embedded in the first object; it is pointed to.
>>
>>93519
Do you have any reading comprehension? Python hides its pointers, references and memory allocation from the user. That's why it's a high-level programming language. It's not good for someone who's new to programming though because he won't even learn what pointers are with Python.
>>
>>93516
>C++ doesn't have any of those and you either have to use a fucking huge library like Boost or implement the functions yourself.
Clearly, if you need to implement it, then there's a need for it in your codebase.

Are you saying there's something wrong with using a widely-tested library instead of reinventing the wheel yourself?

If so, what?

Bear in mind we've already established that microoptimisations don't matter, because:

- computers are fast now
- compilers are smart now
- in the (very few) niche applications where microoptimisation matters, you just write correct code, write unit tests, and pass it to the microoptimisation guy.

The industry has no need for hundreds of microoptimisation guys, and it won't pay you to be one for no reason.
>>
>>93526
All you're saying is

Computers are faster now, so let's write shitty bloated code!

Obviously, it depends on what you're working on. If it's just some GUI application where performance isn't an issue, go for whatever is easiest for you, I guess. But if you're going to work in the computer graphics/games/mathematics/algorithms field, fuck you and your lazy bullshit excuses.
>>
>>93529
Not him but optimisation is a thing of the past. Especially for the gaming field. No memory optimisation or core optimisation is implemented.

Whats the "graphics field" lmao.

And gui application has to be the stupidest term ive heard today, and i browse /g/!
>>
>>93534
Computer graphics? Ever heard of that?

I work in high performance computing, so maybe I'm a bit anal about optimization, but imagine working in a project and you suggest including Boost just because you can't write a few convenience functions yourself. I'm sure your co-workers will love you.

And with GUI application, I mean simple applications consisting of a few buttons and forms you put together in Qt or WPF.
>>
>>93541
Computer graphics is such a vague term, do you mean developing auto cad? Using photoshop? Etc

Right i hear you and agree its the right way to go about things, but the cost is usually too high and project managers dont leave enough time to write code well. Hence why most code is just imported really.

Like with my current job during my third year, all i really do is copy paste most of the code, which is the same for most clients but doesnt optimise for either device or remove any un needed code.
>>
>93212
>like pseudocode
>Python
One word: the forced indentation of the code.
>>
>>93556
Oh, fuck off. Any competent programmer indents his code anyway.
>>
>>93529
>if you're going to work in the computer graphics/games/mathematics/algorithms field, fuck you and your lazy
See, that's where you're absolutely wrong.

When you're getting to the kind of examples you're citing, what matters most is that you use the correct algorithm, not the precise way you implement it.

For example, on almost-sorted data, quicksort is On^2. If you wrote your own quicksort in assembler, and you set it loose on a 1TB nearly-sorted dataset, you just fucked up big-time. Astronomically. Your implementation may be 50% faster on a typical dataset, but it'll be a few *hundred thousand times* slower on the dataset that actually matters.

As long as you're writing the correct algorithm in a non-retarded way, little optimisations don't matter anymore, and they preclude later mechanical optimisation by putting unnecessary constraints on the compiler.

And the best way to get the correct algorithm, written in a non-retarded way, is to use the libraries that already exist.
>>
>>93681
I've made two points and you mixed them both up.

1. For a newcomer to programming, it's better not to start with a script language like Python that has all kinds of convenient functions. A beginner should start with a lower language so he can learn more by implementing all that himself. He'd have to learn to deal with pointers, data types, memory allocation, destructors etc. Python hides most of this from the user.

2. If all you want is a few convenience functions, you're better of just implementing them yourself, or copying them from a library, than using a huge library that adds more dependencies and bloats your code and project. I did not say that you should implement everything yourself, especially not stuff that is critical for performance. Obviously, if you're going to sort a huge dataset, you're better off using an established library, no doubt about that.

Fuck you for making me type all this out.
>>
>>93397
Not at all.

If you learn a lower lever language first, you'll have a harder time understanding the basic concepts of programming - the ones you use in any language - because you'll be fighting with the syntax. OP being as clear of an example as it gets.

Yes, learning assembly and C is important to understand how the program you're making directly interacts with the hardware. If you don't know that, your shit won't be efficient (and by the way, you mentioning Java when making a point of understanding how shit works and being efficient, you clearly don't know what the fuck you're talking about. Go watch Joshua Bloch's How To Design A Good API and Why it Matters talk).

But you do that only after you understand the basics of programming.If you don't already fully grasp I/O, variables, cycles, functions, gotos and the like, there's not point on learning, well, pointers. And to learn the highest level languages is the best way to grasp these concepts easily, with python being clearly the best option due to its popularity and thus amount of libraries and usefulness.
>>
>>93699
>a huge library that adds more dependencies and bloats your code and project.
So copy the headers you want, bung the library in its own directory, and tell the toolchain it's free to inline and link it static.
>>
>>93740
What the fuck? I only mentioned Java as a higher level language and said a beginner should only learn it later AFTER C. Go back and reread my posts if you don't believe me.

OP's mistake was negligence and it could have happened in Python too. Python can be fussy too. In Python, you even have to check the indents of your code or your code will do something completely different. Every language has a syntax you have to adhere to. If you don't want, just stick to pseudo code and study theoretical computer science.

As for learning the basics of programming, I agree with you, but it's nothing you can't learn just as well with a lower-level language. Since you have to learn both sides sooner or later, you might as well learn them both with your first programming language.
>>
>>93785
When you properly study programming - that is, in college, in engineering - the first thing you learn is how to make algorithms. Then, pseudocode. Then, high-level, near-pseudocode languages (the standard in MIT was LISP with SICP, but that changed to python a number of years ago - they're both extremely high-level, in any case). Then, low-level languages, and electronics at the same time (making simple robotic arms and making them move with C and shit). Then assembly, and then you go back to higher-level languages.

That's the proper way for the reasons I stated. Taking the pointer example, you don't learn how to interact with the RAM if you haven't learned why you're interacting with the RAM.

Also, you SHOULD be penalized for shoddy indenting. Readability is key, and the most essential part of on-the-go documentation. And proper indentation is one of the most essential parts of readability. And anyway, most text editors, or certainly all the text editors made specifically for programming, take care of maintaining a proper indentation for you. Even when it comes to mixing spaces and tabs, if you can't set your editor to insert spaces instead of tabs, you need a new one. Even fucking geany and notepad++ do that.
>>
>>93812
Of course, I know how they teach it in college. My computer science semester was full of people who could already write code and a few poor guys who thought they'd learn programming at university. They didn't learn shit. The problem with that proper approach is that you're taught all these abstract ideas, algorithms, patterns, pseudo code etc., and maybe one course about one higher-level programming language, but you don't learn how to actually write working code. It's okay if you're going to work at a university or in research, but once you graduate from university and start working at an actual firm and get your first project, you'll realize that 90% of the time you're busy with language-specific issues, dependencies, debugging and stuff you don't really learn with that approach because they're seen as trivial or not high-level enough. I guess they expect you to teach yourself all that by yourself at home. I lucked out because I worked as a student assistant at a firm while I was studying computer science, and I learned more about programming there than in all the programming courses I took at university together.

I agree about proper intending, but it was just an example to show you that even Python has its pitfalls you have to watch out for as a beginner.
>>
>>93839
I don't know at what college you went, but I had several low-level courses in the second and third years of college. And I couldn't have dealt with, say, the assembly semester, if it hadn't been for my previously acquired data structure (which is inherently high-level) courses.

Again, the whole point is that if you learn low-level languages first, you'll have to worry about understanding the more complex syntax, which will detract from your actually learning how to think in code.
>>
>>93839
>I guess they expect you to teach yourself all that by yourself at home.
Yeah they do.

It's not rocket surgery, and if you can program in one procedural language you can easily learn all procedural languages; if you can program in one functional language, you can easily learn all functional languages; one declarative, all declaratives.
>>
>>94377
>rocket surgery

wat
>>
>>93212
This post shows us how uncommon idiocy can derail a thread even in fucking /wsr/.
Shoot yourself.
>>
File: image.jpg (162 KB, 750x935) Image search: [Google]
image.jpg
162 KB, 750x935
>>94378
Indeed.
Thread replies: 35
Thread images: 2

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.