• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 00:53
CEST 06:53
KST 13:53
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
[ASL19] Finals Recap: Standing Tall9HomeStory Cup 27 - Info & Preview18Classic wins Code S Season 2 (2025)16Code S RO4 & Finals Preview: herO, Rogue, Classic, GuMiho0TL Team Map Contest #5: Presented by Monster Energy6
Community News
Flash Announces Hiatus From ASL54Weekly Cups (June 23-29): Reynor in world title form?12FEL Cracov 2025 (July 27) - $8000 live event16Esports World Cup 2025 - Final Player Roster16Weekly Cups (June 16-22): Clem strikes back1
StarCraft 2
General
The SCII GOAT: A statistical Evaluation The GOAT ranking of GOAT rankings Statistics for vetoed/disliked maps How does the number of casters affect your enjoyment of esports? Esports World Cup 2025 - Final Player Roster
Tourneys
Korean Starcraft League Week 77 Master Swan Open (Global Bronze-Master 2) RSL: Revival, a new crowdfunded tournament series [GSL 2025] Code S: Season 2 - Semi Finals & Finals $5,100+ SEL Season 2 Championship (SC: Evo)
Strategy
How did i lose this ZvP, whats the proper response Simple Questions Simple Answers
Custom Maps
[UMS] Zillion Zerglings
External Content
Mutation # 480 Moths to the Flame Mutation # 479 Worn Out Welcome Mutation # 478 Instant Karma Mutation # 477 Slow and Steady
Brood War
General
Player “Jedi” cheat on CSL Flash Announces Hiatus From ASL BGH Auto Balance -> http://bghmmr.eu/ Unit and Spell Similarities Help: rep cant save
Tourneys
[Megathread] Daily Proleagues [BSL20] Grand Finals - Sunday 20:00 CET Small VOD Thread 2.0 [BSL20] GosuLeague RO16 - Tue & Wed 20:00+CET
Strategy
Simple Questions, Simple Answers I am doing this better than progamers do.
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread Path of Exile What do you want from future RTS games? Beyond All Reason
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread Vanilla Mini Mafia
Community
General
US Politics Mega-thread Trading/Investing Thread Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread The Games Industry And ATVI
Fan Clubs
SKT1 Classic Fan Club! Maru Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece [\m/] Heavy Metal Thread
Sports
Formula 1 Discussion 2024 - 2025 Football Thread NBA General Discussion TeamLiquid Health and Fitness Initiative For 2023 NHL Playoffs 2024
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
Blogs
Culture Clash in Video Games…
TrAiDoS
from making sc maps to makin…
Husyelt
Blog #2
tankgirl
StarCraft improvement
iopq
Trip to the Zoo
micronesia
Customize Sidebar...

Website Feedback

Closed Threads



Active: 661 users

The Big Programming Thread - Page 928

Forum Index > General Forum
Post a Reply
Prev 1 926 927 928 929 930 1031 Next
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
Profile Blog Joined August 2004
Poland17243 Posts
Last Edited: 2017-12-08 22:04:33
December 08 2017 22:03 GMT
#18541
On December 09 2017 06:32 sc-darkness wrote:
Show nested quote +
On December 09 2017 05:36 Manit0u wrote:
On December 08 2017 07:54 TMG26 wrote:
Everything. Trying to hide both hardware and math under the desguise of 'domain'. Hiding file globals under the desguise of instace variables. Promises of reusabile that were never kept. Idiot ways of handling state.
It's pros are 'easyness to understand' and 'mapping to domain' which are both full of crap. Easyness to understand is a falacy, peopele start to apply real world logic to computers which never cared about it, and don't get the realiabilty of good old math. This meme of easyness makes sure that OOP code is full of bad practices from programmers that didn't understood neither CS math concepts or the underlying hardware. And abstracting to domain is crap, you should abstract math concepts, xenturies old categories used by everyone which makes the code actually reusable, rather than looking reusable.
Old full OOP languages are full of bad legacy stuff given by the necessary OOP things of the time and ignorance of math concepts. Then there is the whole 'adding OOP stuff' to languages that never needed it.
I'm a bit drunk so I not gonna expand more. I dobhave more complains about it, and OOP is what I do for a living! I mainly devolep in Java and ruby, with some bash scripting for the whole CI/CD thing to work. All my hobby work is eiher in Haskell, C, Erlang and shell scripting though...

Here's a nice list of quotes from relevant people:
http://harmful.cat-v.org/software/OO_programming/

A warning the site is full of very extremist opinions in more than just software, something that is interesting because!it makes you think.


What you forgot to mention is that most software is created to be used by people and that's where OOP really shines. Procedural programming is mostly used for system level programming (people hardly interact with kernel drivers directly) and functional programming is used for highly theoretical academic stuff (math proofs) and multi-threaded/asynchronous systems (telecoms come to mind).

The vast majority of software that is being built though are applications that require user interaction (games, websites, ERP systems etc.) and those benefit greatly from this "dreadful domain approach". Sure, you probably could do it "the proper way" (like people who are trying to build website frameworks in Haskell, LOL), but you must realize that the demand for such software is so high that there's constantly a shortage of developers. If you were to raise the barrier of entry to people who have at least PhD in maths and are fluent in functional programming then nothing would get done.

It's a compromise, you get less reliable systems but can build them much easier and faster (and worry about making them reliable later down the line) because what's the most important in programming is actually getting shit done, not making sure that it's "pure" or "proper".


Weren't you against OOP in the past? Have you changed your mind?


I was not against OOP I started programming with LPC then moved on to PHP and now Ruby. How could I be against OOP?

I'm just against C++ in general and Java pre 8 (and even after that I'm not super fond of it). That's just a personal preference based on how ugly code in those languages looks most of the time.
Time is precious. Waste it wisely.
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
December 08 2017 22:17 GMT
#18542
I don't enjoy OOP, but I have to imagine that when a project becomes sufficiently large, OOP has some big advantages. It would seem to me that well written OO code is largely self-documenting, which is probably incredibly advantageous for big teams or situations where you don't know who is going to have to mess with the code in the future.

But what do I know, I have never actually worked on projects of that scale. So feel free to shit on me if I am way off base.
Excludos
Profile Blog Joined April 2010
Norway8046 Posts
Last Edited: 2017-12-08 22:40:51
December 08 2017 22:21 GMT
#18543
On December 09 2017 07:17 travis wrote:
I don't enjoy OOP, but I have to imagine that when a project becomes sufficiently large, OOP has some big advantages. It would seem to me that well written OO code is largely self-documenting, which is probably incredibly advantageous for big teams or situations where you don't know who is going to have to mess with the code in the future.

But what do I know, I have never actually worked on projects of that scale. So feel free to shit on me if I am way off base.


You're pretty much on point. When a project becomes sufficiently large, it's impossible not to use OOP. Imagine trying to mix git pushes when everyone is working on the same bits of code.

edit: and, of course, since you can't always know how large your project is going to end up, or who's going to work on it afterwards, OOP should always be a consideration from the very beginning.
sc-darkness
Profile Joined August 2017
856 Posts
Last Edited: 2017-12-08 22:53:31
December 08 2017 22:42 GMT
#18544
On December 09 2017 07:17 travis wrote:
I don't enjoy OOP, but I have to imagine that when a project becomes sufficiently large, OOP has some big advantages. It would seem to me that well written OO code is largely self-documenting, which is probably incredibly advantageous for big teams or situations where you don't know who is going to have to mess with the code in the future.

But what do I know, I have never actually worked on projects of that scale. So feel free to shit on me if I am way off base.


OOP has a structure or patterns if you want. People can learn them, so it's a bit easier when you come across new code. When you have procedural code, I'm not sure you can tell that easily - you have functions all over the place in lots of files... Then again, I don't do procedural programming a lot - it's only one-off for me in most cases.

As I said previously, I don't know how you're even supposed to implement data structures without using classes (structures). It's in the name. So, if you're from academic background, you should be fine with OOP.

Also, BIG advantage of OOP is it can hide all the unnecessary details from you. Do you really want to mess with balanced tree's pointers to keep your tree balanced? Even if you balance it with helper functions in procedural code, the fact that pointers are still exposed lets other people break your data structure's internal data. Do you really want to get involved with that? It's very easy with OOP, you make such data private. You hide unnecessary complexity.
Hanh
Profile Joined June 2016
146 Posts
December 09 2017 02:08 GMT
#18545
OOP means a lot of different things to people and the dislikes directed towards it, is not about encapsulation. Encapsulation is generally considered good. Though to be honest, encapsulation predates OOP and is present in the C system API for example.
The problem with OOP (in most of the languages) is that it only allows one form of polymorphism: sub-typing. Combine it with mutable methods and you get class hierarchies that are deep and illogical.

Manit0u
Profile Blog Joined August 2004
Poland17243 Posts
Last Edited: 2017-12-09 02:21:23
December 09 2017 02:21 GMT
#18546
On December 09 2017 11:08 Hanh wrote:
OOP means a lot of different things to people and the dislikes directed towards it, is not about encapsulation. Encapsulation is generally considered good. Though to be honest, encapsulation predates OOP and is present in the C system API for example.
The problem with OOP (in most of the languages) is that it only allows one form of polymorphism: sub-typing. Combine it with mutable methods and you get class hierarchies that are deep and illogical.



That's why with most of the modern languages you should favor composition over inheritance. This allows you to keep things nicely modular and simple enough without the need to resort to deep class hierarchies.

Nowadays, you don't even really need abstract classes that much since most languages have adopted ways to go around that (Ruby modules or PHP traits for example). Anyway, some inheritance isn't always bad if it's going to make your code more understandable.

For me, the biggest advantages of OOP are:
1. structuring your code in a manner that's easily approachable
2. all of the reusable patterns that make both onboarding and jumping into other projects much easier
Time is precious. Waste it wisely.
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
December 09 2017 08:46 GMT
#18547
What others said. Where I work, at least half of my team would struggle way more with functional languages than the kinda-OOP C# we use (our OOP could be so much better too). We wouldn't get shit done. It certainly makes sense to incorporate functional approaches in some places, and keeping mutability in check is also a concern, especially with the rising need for multithreading. But at the end of the day, things need to get done.
If you have a good reason to disagree with the above, please tell me. Thank you.
Manit0u
Profile Blog Joined August 2004
Poland17243 Posts
December 09 2017 13:02 GMT
#18548
The bottom line is: You shouldn't restrict yourself to a single paradigm. Use the best tool for the job. Some things require procedural approach, some functional and some object orientation. In my opinion, any language that doesn't support all of them is too narrow and will only find niche usage.
Time is precious. Waste it wisely.
sc-darkness
Profile Joined August 2017
856 Posts
Last Edited: 2017-12-09 14:45:12
December 09 2017 13:46 GMT
#18549
On December 09 2017 17:46 spinesheath wrote:
What others said. Where I work, at least half of my team would struggle way more with functional languages than the kinda-OOP C# we use (our OOP could be so much better too). We wouldn't get shit done. It certainly makes sense to incorporate functional approaches in some places, and keeping mutability in check is also a concern, especially with the rising need for multithreading. But at the end of the day, things need to get done.


Mutability isn't difficult in C++. You just pass objects by const reference. I don't know how C# would do it though.


On December 09 2017 11:08 Hanh wrote:
OOP means a lot of different things to people and the dislikes directed towards it, is not about encapsulation. Encapsulation is generally considered good. Though to be honest, encapsulation predates OOP and is present in the C system API for example.
The problem with OOP (in most of the languages) is that it only allows one form of polymorphism: sub-typing. Combine it with mutable methods and you get class hierarchies that are deep and illogical.



Encapsulation in C? How? Hiding functions in .c files instead of .h? Forward declarations? I can't think of anything else.
Manit0u
Profile Blog Joined August 2004
Poland17243 Posts
December 09 2017 17:09 GMT
#18550
On December 09 2017 22:46 sc-darkness wrote:
Encapsulation in C? How? Hiding functions in .c files instead of .h? Forward declarations? I can't think of anything else.


https://alastairs-place.net/blog/2013/06/03/encapsulation-in-c/
Time is precious. Waste it wisely.
sc-darkness
Profile Joined August 2017
856 Posts
December 09 2017 17:34 GMT
#18551
On December 10 2017 02:09 Manit0u wrote:
Show nested quote +
On December 09 2017 22:46 sc-darkness wrote:
Encapsulation in C? How? Hiding functions in .c files instead of .h? Forward declarations? I can't think of anything else.


https://alastairs-place.net/blog/2013/06/03/encapsulation-in-c/


Forward declaration. You could have just confirmed.
Manit0u
Profile Blog Joined August 2004
Poland17243 Posts
December 09 2017 20:54 GMT
#18552
On December 10 2017 02:34 sc-darkness wrote:
Show nested quote +
On December 10 2017 02:09 Manit0u wrote:
On December 09 2017 22:46 sc-darkness wrote:
Encapsulation in C? How? Hiding functions in .c files instead of .h? Forward declarations? I can't think of anything else.


https://alastairs-place.net/blog/2013/06/03/encapsulation-in-c/


Forward declaration. You could have just confirmed.


Thought I'd leave some more elaboration on that for anyone interested in the topic

Anyway, it seems really artificial and forced. I'd really like for C to include maybe not classes but something similar to Ruby modules. Those could act as a form of namespaces. What I'd add is also the ability to declare function visibility, that would help immensely (private, public and final would suffice).
Time is precious. Waste it wisely.
WarSame
Profile Blog Joined February 2010
Canada1950 Posts
December 09 2017 21:43 GMT
#18553
I'm following this guide to do a little bit of C# experimentation and they have a member in their ValuesController that has... functions? Could someone explain to me what it actually is? I don't know what keywords to use to search it.


namespace WebDemo.Controllers
{
public class ValuesController : ApiController
{
private string[] lista
{
get
{
if (System.Web.HttpContext.Current.Application["<em>\"lista\"</em>"] == null)
{
System.Web.HttpContext.Current.Application["<em>\"lista\"</em>"] =
new string[] {"<em>\"value1\"</em>, <em>\"value2\"</em>"};
}
return
(string[])System.Web.HttpContext.Current.Application["<em>\"lista\"</em>"];
}
}
}
}
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
sc-darkness
Profile Joined August 2017
856 Posts
Last Edited: 2017-12-09 22:32:55
December 09 2017 22:17 GMT
#18554
On December 10 2017 06:43 WarSame wrote:
I'm following this guide to do a little bit of C# experimentation and they have a member in their ValuesController that has... functions? Could someone explain to me what it actually is? I don't know what keywords to use to search it.


namespace WebDemo.Controllers
{
public class ValuesController : ApiController
{
private string[] lista
{
get
{
if (System.Web.HttpContext.Current.Application["<em>\"lista\"</em>"] == null)
{
System.Web.HttpContext.Current.Application["<em>\"lista\"</em>"] =
new string[] {"<em>\"value1\"</em>, <em>\"value2\"</em>"};
}
return
(string[])System.Web.HttpContext.Current.Application["<em>\"lista\"</em>"];
}
}
}
}


Personally, I call it C# property because that's how it's called in Objective-C. It's syntactic sugar for getters and setters.
However, the aim is to reduce boilerplate code. Are you familiar with getter and setter methods? This is all it is.

Edit: There you go: https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/properties

Of course, you're also free to do the following.


private String[] lista;

public String[] getLista()
{
if (System.Web.HttpContext.Current.Application["<em>\"lista\"</em>"] == null)
{
System.Web.HttpContext.Current.Application["<em>\"lista\"</em>"] =
new string[] {"<em>\"value1\"</em>, <em>\"value2\"</em>"};
}

return (string[])System.Web.HttpContext.Current.Application["<em>\"lista\"</em>"];
}


It's definitely weird they declare a variable when they don't seem to use it in the usual way. I don't know about this HttpContext stuff though.

Also, you can use access modifiers for get/set. You can say "private set { something }".

Here is an example: https://stackoverflow.com/a/3847982/1091781
WarSame
Profile Blog Joined February 2010
Canada1950 Posts
December 09 2017 22:30 GMT
#18555
Thank you! I had heard of that idea earlier but forgotten how C# implemented it.
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
sc-darkness
Profile Joined August 2017
856 Posts
Last Edited: 2017-12-09 23:44:03
December 09 2017 22:33 GMT
#18556
You're welcome! Ignore my previous manually defined getter. I forgot to remove get {} syntax, haha. It should be fine now.

Edit: I've just done a bit of "object-oriented" C with struct. While it's fun as an exercise, people are right when they say you end up rewriting what C++ does. Conclusion: use C++. :D
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
December 10 2017 07:24 GMT
#18557
On December 09 2017 22:46 sc-darkness wrote:
Show nested quote +
On December 09 2017 17:46 spinesheath wrote:
What others said. Where I work, at least half of my team would struggle way more with functional languages than the kinda-OOP C# we use (our OOP could be so much better too). We wouldn't get shit done. It certainly makes sense to incorporate functional approaches in some places, and keeping mutability in check is also a concern, especially with the rising need for multithreading. But at the end of the day, things need to get done.


Mutability isn't difficult in C++. You just pass objects by const reference. I don't know how C# would do it though.

Sadly C# lacks proper const semantics like C++ has them. The best you can have is make your fields readonly. Which is just the references, not the actual instances. So you have no reliable way of knowing if an object is immutable. Obviously if people don't changes state in getters and name methods properly, things get better. But there's a lot more convention involved than necessary in C++.
If you have a good reason to disagree with the above, please tell me. Thank you.
Hanh
Profile Joined June 2016
146 Posts
December 10 2017 10:53 GMT
#18558
On December 09 2017 22:46 sc-darkness wrote:
Mutability isn't difficult in C++. You just pass objects by const reference. I don't know how C# would do it though.


In C++, "const" controls access to the resource but the resource remains mutable. In other words, the data could be mutated through another reference. Practically, const is more trouble than what it is worth especially when working with 3rd party libraries that do not use constness.
sc-darkness
Profile Joined August 2017
856 Posts
December 10 2017 11:40 GMT
#18559
On December 10 2017 19:53 Hanh wrote:
Show nested quote +
On December 09 2017 22:46 sc-darkness wrote:
Mutability isn't difficult in C++. You just pass objects by const reference. I don't know how C# would do it though.


Practically, const is more trouble than what it is worth especially when working with 3rd party libraries that do not use constness.


I think you're a minority here. Most C++ developers appreciate const correctness. Yes, sometimes you can't pass a const reference but there will always be such cases even with your own C++ classes.
Excludos
Profile Blog Joined April 2010
Norway8046 Posts
Last Edited: 2017-12-10 12:43:49
December 10 2017 12:39 GMT
#18560
On December 10 2017 20:40 sc-darkness wrote:
Show nested quote +
On December 10 2017 19:53 Hanh wrote:
On December 09 2017 22:46 sc-darkness wrote:
Mutability isn't difficult in C++. You just pass objects by const reference. I don't know how C# would do it though.


Practically, const is more trouble than what it is worth especially when working with 3rd party libraries that do not use constness.


I think you're a minority here. Most C++ developers appreciate const correctness. Yes, sometimes you can't pass a const reference but there will always be such cases even with your own C++ classes.


I mean it's not that difficult to just clone a const variable before passing it if that's needed. That said I rarely use it myself. It's not that difficult to keep track of a variable and just not set it again if you need to. And if it can be defined before compile I just use #define instead (That said I don't really have an opinion on the subject. It's more preference than anything else).
Prev 1 926 927 928 929 930 1031 Next
Please log in or register to reply.
Live Events Refresh
Korean StarCraft League
03:00
Week 77
EnkiAlexander 94
HKG_Chickenman84
davetesta70
IntoTheiNu 52
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Nina 232
PiLiPiLi 14
Dota 2
monkeys_forever751
NeuroSwarm125
febbydoto20
League of Legends
JimRising 840
Heroes of the Storm
Khaldor72
Other Games
summit1g9661
WinterStarcraft615
Livibee114
Organizations
Other Games
BasetradeTV56
StarCraft: Brood War
UltimateBattle 28
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 16 non-featured ]
StarCraft 2
• Berry_CruncH304
• Hupsaiya 76
• LaughNgamezSOOP
• AfreecaTV YouTube
• sooper7s
• intothetv
• Migwel
• Kozan
• IndyKCrew
StarCraft: Brood War
• Diggity5
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
League of Legends
• Lourlo1247
• masondota2466
• Stunt389
Upcoming Events
CranKy Ducklings
5h 7m
RSL Revival
5h 7m
ByuN vs Cham
herO vs Reynor
FEL
11h 7m
RSL Revival
1d 5h
Clem vs Classic
SHIN vs Cure
FEL
1d 7h
BSL: ProLeague
1d 13h
Dewalt vs Bonyth
Replay Cast
2 days
Sparkling Tuna Cup
3 days
The PondCast
4 days
Replay Cast
4 days
[ Show More ]
RSL Revival
5 days
Replay Cast
5 days
RSL Revival
6 days
Liquipedia Results

Completed

BSL 2v2 Season 3
HSC XXVII
Heroes 10 EU

Ongoing

JPL Season 2
BSL Season 20
Acropolis #3
KCM Race Survival 2025 Season 2
CSL 17: 2025 SUMMER
Copa Latinoamericana 4
Championship of Russia 2025
RSL Revival: Season 1
Murky Cup #2
BLAST.tv Austin Major 2025
ESL Impact League Season 7
IEM Dallas 2025
PGL Astana 2025
Asian Champions League '25
BLAST Rivals Spring 2025
MESA Nomadic Masters
CCT Season 2 Global Finals
IEM Melbourne 2025

Upcoming

2025 ACS Season 2: Qualifier
CSLPRO Last Chance 2025
2025 ACS Season 2
CSLPRO Chat StarLAN 3
K-Championship
uThermal 2v2 Main Event
SEL Season 2 Championship
FEL Cracov 2025
Esports World Cup 2025
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025
FISSURE Playground #1
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2025 TLnet. All Rights Reserved.