Another nitpick of mine is this reliance on indentation. Why it's nice and convenient to have everything be conforming to some style form when some more complex part of your code gets jumbled up (IDE indentation errors are not uncommon and people screwing it up are commonplace) quite often trying to find the error and fix it can be frustrating. Imagine nested ifs getting on the same level. There won't be any compiler error/IDE warning that will catch it.
The Big Programming Thread - Page 984
| Forum Index > General Forum |
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. | ||
|
Manit0u
Poland17450 Posts
Another nitpick of mine is this reliance on indentation. Why it's nice and convenient to have everything be conforming to some style form when some more complex part of your code gets jumbled up (IDE indentation errors are not uncommon and people screwing it up are commonplace) quite often trying to find the error and fix it can be frustrating. Imagine nested ifs getting on the same level. There won't be any compiler error/IDE warning that will catch it. | ||
|
solidbebe
Netherlands4921 Posts
On December 25 2018 04:29 Manit0u wrote: Python would instantly be 1000% better if you didn't have to use this explicit self as a first argument of every class method (and then you ignore it when using it completely so you pass arguments from the second on). This is triggering me so much... Another nitpick of mine is this reliance on indentation. Why it's nice and convenient to have everything be conforming to some style form when some more complex part of your code gets jumbled up (IDE indentation errors are not uncommon and people screwing it up are commonplace) quite often trying to find the error and fix it can be frustrating. Imagine nested ifs getting on the same level. There won't be any compiler error/IDE warning that will catch it. Cant you just auto-indent, sounds like exactly something IDEs are good at catching. To the guy talking about scala: Im using scala right now in a course about dybamic and static software verification (like type systems, taint analysis, etc). Turns out it is pretty easy to implement another programming language with compilation and interpretation in scala . It does take a bit to get used to the immutable vars and all the wild stuff you can do with lambdas. | ||
|
Deleted User 3420
24492 Posts
On December 25 2018 04:29 Manit0u wrote: Python would instantly be 1000% better if you didn't have to use this explicit self as a first argument of every class method (and then you ignore it when using it completely so you pass arguments from the second on). This is triggering me so much... Another nitpick of mine is this reliance on indentation. Why it's nice and convenient to have everything be conforming to some style form when some more complex part of your code gets jumbled up (IDE indentation errors are not uncommon and people screwing it up are commonplace) quite often trying to find the error and fix it can be frustrating. Imagine nested ifs getting on the same level. There won't be any compiler error/IDE warning that will catch it. yes I don't like classes in python It's not often I do something where I need to create classes though, sinceif I wanted to do much oop I probably wouldn't be using python. your 2nd point is also a great point... one that I had to learn how to fix and can now easily do in notepad++. you kind of just have to be able to figure out what is going on. after 2 or 3 times of it happening to me and wasting a bunch of time I now recognize it pretty fast. copy pasted code in particular often gets indentation screwed up for me. | ||
|
Manit0u
Poland17450 Posts
On December 25 2018 04:40 solidbebe wrote: Cant you just auto-indent, sounds like exactly something IDEs are good at catching. IDE won't catch stuff like that:
| ||
|
LightTemplar
Ireland481 Posts
I agree perhaps the language definition isn't the best place to define code style but at least I can read python logic and not have to worry about what part of flow control I'm in. And yeh I agree with Travis, classes don't really have a place in most the Python I write. If it needs classes (and its not a lib interface) I rarely see Python as the tool for the job. That said I feel classes are overused in general, way more OOP in the world than it warrants imo. | ||
|
Silvanel
Poland4733 Posts
Also complaining about indentation in Python is exactly the same as complaining about braces in other langauges. The code might do something not intended instead of stoping with error if you are unlucky. Afterall most Python indentation mistakes ends with errors. | ||
|
LightTemplar
Ireland481 Posts
I wonder if that is the case because the majority of the code they see in that language being them learning it themselves and not having to deal with the code of others, and larger projects in general. It just seems strange to me that whenever the industry settles on a language being mainstream all of a sudden the hobbyist programming world wants the next thing. Or perhaps its because through mass adoption the cracks of the old language start to show and the next languages are progress on that. Thoughts? | ||
|
Manit0u
Poland17450 Posts
On December 25 2018 08:29 LightTemplar wrote: Actually all the talk of preferred languages brings me to another question. Are programmers preferences for more niche languages generally a result of not having to extensively work on them? I wonder if that is the case because the majority of the code they see in that language being them learning it themselves and not having to deal with the code of others, and larger projects in general. It just seems strange to me that whenever the industry settles on a language being mainstream all of a sudden the hobbyist programming world wants the next thing. Or perhaps its because through mass adoption the cracks of the old language start to show and the next languages are progress on that. Thoughts? I did big projects in several languages over the past few years. Most of the time I was working with PHP and Ruby though (they're completely different beasts). I did some stuff in Java and Python too, but I can't say I was enjoying it but I have to put my lack of enjoyment on some stylistic choices in those languages (Java having class names and method names so long that I get bored before I even get to the params and Python being kind of awkward for me in general). | ||
|
TheEmulator
28094 Posts
| ||
|
Silvanel
Poland4733 Posts
| ||
|
SC-Shield
Bulgaria832 Posts
On December 26 2018 06:08 Silvanel wrote: In my opinion it is becuase of the speed of deployment. In Python the time between start of typing and first results is very short and people do love being rewarded fast. Psychology. Also Python is very clear about its limitations and weak sides. No one will try to use Python in environment with limited resources beacuse everyone knows that language wasnt designed for that while in resource rich environment Python flaws are mitigated by abundance of resources. Its a tool perfectly suited for certain tasks, think of it as hammer. Wont help You with screws, but nothing will beat it when it comes to nails. What's wrong with Java then? I know that C++ is difficult, but Java isn't. It allows you to learn C++, Objective-C and C# later. | ||
|
solidbebe
Netherlands4921 Posts
On December 26 2018 06:36 SC-Shield wrote: What's wrong with Java then? I know that C++ is difficult, but Java isn't. It allows you to learn C++, Objective-C and C# later. Depends on if you want to teach OOP or functional programming. From experience, programming outside of computer science is mostly limited to functional i.e. python. | ||
|
Manit0u
Poland17450 Posts
On December 26 2018 07:47 solidbebe wrote: Depends on if you want to teach OOP or functional programming. From experience, programming outside of computer science is mostly limited to functional i.e. python. Wait, what? I believe that most of the stuff being done outside CS is mostly OOP. Functional is still too niche. There are some real-world applications for it but lack of tooling, increased development times and trouble finding the developers are a bit too much of a hassle for most companies at the moment. | ||
|
graNite
Germany4434 Posts
I am coding a bot for https://sc2ai.net. In a game, many distances have to be calculated every frame. Here is the part of the library that is being used and I want to improve: https://github.com/Dentosal/python-sc2/blob/develop/sc2/position.py I built a new class Points that inherits from np.ndarray. It is not yet connected to the rest of the library, but the functions are done. I removed the functions furthest_to, further_than and so on because the closer-versions are basically the same execpt a -1 or <. Are these functions implemented in most efficient way? Is there a way to improve the parts that look like this: find = np.where(np.any(M < distance, axis=1)) Any other comments or suggestions are also welcome ![]() + Show Spoiler + from typing import Any, Dict, List, Optional, Set, Tuple, Union # for mypy type checking | ||
|
solidbebe
Netherlands4921 Posts
On December 26 2018 08:13 Manit0u wrote: Wait, what? I believe that most of the stuff being done outside CS is mostly OOP. Functional is still too niche. There are some real-world applications for it but lack of tooling, increased development times and trouble finding the developers are a bit too much of a hassle for most companies at the moment. I'm not talking about industry , I was talking about the 'introduction to programming' courses I see being taught in study programmes outside CS: e.g. in the mathematics department they teach some python and how to implement algorithms and manipulate data, and read/write to files. I did check out the curriculum and it looks like they mention some OOP stuff at the end. In the geology department they get taught matlab, etc. | ||
|
Silvanel
Poland4733 Posts
On December 26 2018 06:36 SC-Shield wrote: What's wrong with Java then? I know that C++ is difficult, but Java isn't. It allows you to learn C++, Objective-C and C# later. Well, people complain that Java is overly verbose and also that knowing Java is not enough. You need to have knowledge of specific framework that will be used for a task and its inner doings. Java of course have tons of advantages but i would say its trying to be to broad for its own good. | ||
|
Manit0u
Poland17450 Posts
Just take a look at that: http://websystique.com/springmvc/spring-4-mvc-helloworld-tutorial-full-example/ You're writing more XML than Java. I fucking hate XML ![]() Also, nowadays you're doing more magic annotations than actual code writing in Java frameworks, which is a pity. | ||
|
mantequilla
Turkey779 Posts
Spring config via annotations is so clear, annotations themselves act like a documentation and I can quickly understand how a class is going to function in runtime. Its almost elegant ![]() For example, in a python project I worked on a little bit, there were bunch of json fields, there's no information on which fields are required or optional, what's their format etc. There's no other way than reading the whole code to understand that. Look at a java class with annotations and everything is clear in 10 seconds. I don't know if its personal bias because I used java much more than other languages, but I can understand how things work in minutes when looking at someone else's code in java. In python or js, its just magic, I don't understand what's going on without debugging everything line by line and reading the whole code. | ||
|
SC-Shield
Bulgaria832 Posts
| ||
|
Manit0u
Poland17450 Posts
On December 27 2018 04:40 mantequilla wrote: Those spring config xml things are completely unnecessary, only thing that's required and xml is maven pom file, which is, in my opinion has strengths over other dependency management systems, like gradle or js dependency systems (hell). Spring config via annotations is so clear, annotations themselves act like a documentation and I can quickly understand how a class is going to function in runtime. Its almost elegant ![]() For example, in a python project I worked on a little bit, there were bunch of json fields, there's no information on which fields are required or optional, what's their format etc. There's no other way than reading the whole code to understand that. Look at a java class with annotations and everything is clear in 10 seconds. I don't know if its personal bias because I used java much more than other languages, but I can understand how things work in minutes when looking at someone else's code in java. In python or js, its just magic, I don't understand what's going on without debugging everything line by line and reading the whole code. I guess I need to refresh my knowledge of Java world Got a small project for my friend which could be a good way to get back in touch with Spring. Is Hibernate still a thing? | ||
| ||
. It does take a bit to get used to the immutable vars and all the wild stuff you can do with lambdas. 
