• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 17:27
CET 23:27
KST 07:27
  • 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
RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12Intel X Team Liquid Seoul event: Showmatches and Meet the Pros10[ASL20] Finals Preview: Arrival13
Community News
[TLMC] Fall/Winter 2025 Ladder Map Rotation12Weekly Cups (Nov 3-9): Clem Conquers in Canada4SC: Evo Complete - Ranked Ladder OPEN ALPHA8StarCraft, SC2, HotS, WC3, Returning to Blizzcon!45$5,000+ WardiTV 2025 Championship7
StarCraft 2
General
Mech is the composition that needs teleportation t RotterdaM "Serral is the GOAT, and it's not close" RSL Season 3 - RO16 Groups C & D Preview [TLMC] Fall/Winter 2025 Ladder Map Rotation TL.net Map Contest #21: Winners
Tourneys
RSL Revival: Season 3 Sparkling Tuna Cup - Weekly Open Tournament Constellation Cup - Main Event - Stellar Fest Tenacious Turtle Tussle Master Swan Open (Global Bronze-Master 2)
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 499 Chilling Adaptation Mutation # 498 Wheel of Misfortune|Cradle of Death Mutation # 497 Battle Haredened Mutation # 496 Endless Infection
Brood War
General
FlaSh on: Biggest Problem With SnOw's Playstyle What happened to TvZ on Retro? SnOw's ASL S20 Finals Review BW General Discussion Brood War web app to calculate unit interactions
Tourneys
[Megathread] Daily Proleagues Small VOD Thread 2.0 [BSL21] RO32 Group D - Sunday 21:00 CET [BSL21] RO32 Group C - Saturday 21:00 CET
Strategy
PvZ map balance Current Meta Simple Questions, Simple Answers How to stay on top of macro?
Other Games
General Games
Should offensive tower rushing be viable in RTS games? Path of Exile Stormgate/Frost Giant Megathread Nintendo Switch Thread Clair Obscur - Expedition 33
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
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread SPIRED by.ASL Mafia {211640}
Community
General
Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread US Politics Mega-thread Artificial Intelligence Thread Canadian Politics Mega-thread
Fan Clubs
White-Ra Fan Club The herO Fan Club!
Media & Entertainment
Movie Discussion! [Manga] One Piece Anime Discussion Thread Korean Music Discussion Series you have seen recently...
Sports
2024 - 2026 Football Thread Formula 1 Discussion NBA General Discussion MLB/Baseball 2023 TeamLiquid Health and Fitness Initiative For 2023
World Cup 2022
Tech Support
SC2 Client Relocalization [Change SC2 Language] Linksys AE2500 USB WIFI keeps disconnecting Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List
Blogs
Dyadica Gospel – a Pulp No…
Hildegard
Coffee x Performance in Espo…
TrAiDoS
Saturation point
Uldridge
DnB/metal remix FFO Mick Go…
ImbaTosS
Reality "theory" prov…
perfectspheres
Customize Sidebar...

Website Feedback

Closed Threads



Active: 2102 users

The Big Programming Thread - Page 566

Forum Index > General Forum
Post a Reply
Prev 1 564 565 566 567 568 1032 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.
fdsdfg
Profile Blog Joined February 2010
United States1251 Posts
January 14 2015 18:55 GMT
#11301
Before the difficulty of transferring the classes between JS and PHP, is there a way to build something similar to Classes in JS?

In your example, you have a JSON object


var someData = {
foo: "bar",
baz: 123,
x: {
a: 1,
b: 2
}
};


But, if I'm using this object and I say:


someData.a = 4


I'd expect the IDE to tell me there's no 'a' attribute in someData. I would say 'oh, right' and correct the reference to someData.x.a. I can then click on 'someData.x.a' and say 'find all references to this object' and it will show me every time that 'a' is written or read. It makes troubleshooting very pleasant.

In JS, though, it just creates a new attribute 'a' in someData and sets that data to 4. I meant to access .x.a, and I can easily lose a lot of time trying to troubleshoot an issue.

Sure, it's my fault for not knowing my objects that well, but I really like the model of being able to rely on the structure of my classes.
aka Siyko
Manit0u
Profile Blog Joined August 2004
Poland17433 Posts
Last Edited: 2015-01-14 19:12:57
January 14 2015 19:04 GMT
#11302
What are you guys talking about? You can have all the advantages of classes in JS. Just use prototypes and collection objects.

Some links:
General JS object info

Prototypes ("classes")

Collections
Time is precious. Waste it wisely.
fdsdfg
Profile Blog Joined February 2010
United States1251 Posts
January 14 2015 21:05 GMT
#11303
On January 15 2015 04:04 Manit0u wrote:
What are you guys talking about? You can have all the advantages of classes in JS. Just use prototypes and collection objects.

Some links:
General JS object info

Prototypes ("classes")

Collections


Thanks, this looks like about what I'm looking for.

There was an example in the comments of the Prototypes link:
http://phrogz.net/js/classes/OOPinJS.html

It's pretty goofy, but also a good example of creating private/public variables and methods in a class, then creating instances of those class.

I don't see how useful it would be to rewrite the private functions on instances of that class, but this does seem like a really good answer.

I guess part of my responsibility is to create the classes in PHP and JS while keeping them consistent, then write the AJAX pieces that will translate between the two. Then I never need to worry about them again, I get to work with my comfortable classes in whatever language I'm in.

aka Siyko
Deleted User 101379
Profile Blog Joined August 2010
4849 Posts
Last Edited: 2015-01-14 21:12:30
January 14 2015 21:11 GMT
#11304
On January 15 2015 06:05 fdsdfg wrote:
Show nested quote +
On January 15 2015 04:04 Manit0u wrote:
What are you guys talking about? You can have all the advantages of classes in JS. Just use prototypes and collection objects.

Some links:
General JS object info

Prototypes ("classes")

Collections


Thanks, this looks like about what I'm looking for.

There was an example in the comments of the Prototypes link:
http://phrogz.net/js/classes/OOPinJS.html

It's pretty goofy, but also a good example of creating private/public variables and methods in a class, then creating instances of those class.

I don't see how useful it would be to rewrite the private functions on instances of that class, but this does seem like a really good answer.

I guess part of my responsibility is to create the classes in PHP and JS while keeping them consistent, then write the AJAX pieces that will translate between the two. Then I never need to worry about them again, I get to work with my comfortable classes in whatever language I'm in.



Don't think of JavaScript as an object-oriented language with private methods/variables and such. JavaScript is inherently closer to functional languages than to object-oriented languages, so you need a different mindset to work with it. You can do OOP in javascript, but it's not always the best way to go.
amazingxkcd
Profile Blog Joined September 2010
GRAND OLD AMERICA16375 Posts
January 15 2015 02:55 GMT
#11305
Heads up C++ developers in here, c++14 became new ISO standard

http://www.iso.org/iso/home/store/catalogue_tc/catalogue_detail.htm?csnumber=64029

The world is burning and you rather be on this terrible website discussing video games and your shallow feelings
nunez
Profile Blog Joined February 2011
Norway4003 Posts
January 15 2015 04:39 GMT
#11306
guuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu!
conspired against by a confederacy of dunces.
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
January 15 2015 07:44 GMT
#11307
On January 15 2015 11:55 amazingxkcd wrote:
Heads up C++ developers in here, c++14 became new ISO standard

http://www.iso.org/iso/home/store/catalogue_tc/catalogue_detail.htm?csnumber=64029



what does that mean?
There is no one like you in the universe.
Manit0u
Profile Blog Joined August 2004
Poland17433 Posts
January 15 2015 11:53 GMT
#11308
On January 15 2015 16:44 Blisse wrote:
Show nested quote +
On January 15 2015 11:55 amazingxkcd wrote:
Heads up C++ developers in here, c++14 became new ISO standard

http://www.iso.org/iso/home/store/catalogue_tc/catalogue_detail.htm?csnumber=64029



what does that mean?


It means that C++14 has replaces the C++11 as an ISO standard.

http://stackoverflow.com/questions/3635971/what-are-iso-languages

What this does however is that vendors will write their code to be ISO-compliant if required. If you're working on a project written in c++11 and are relying heavily on code supplied by vendors who make it their point to have their code ISO-compliant you might end up either having to update your project to c++14 or not have the most up-to-date code from other vendors.

That's my take on it.
Time is precious. Waste it wisely.
nunez
Profile Blog Joined February 2011
Norway4003 Posts
January 15 2015 12:25 GMT
#11309
it means that microsofts compiler now is 2 standards behind!
baka!
conspired against by a confederacy of dunces.
Manit0u
Profile Blog Joined August 2004
Poland17433 Posts
Last Edited: 2015-01-15 16:25:03
January 15 2015 16:03 GMT
#11310
They're still on '99?

Guess they're only interested in C# and know all too well that probably 90% if not more C++ developers do it under Linux. Currently I'm forced to use Windows at work (not for C or C++ thankfully) and I must say that it is a dreadful experience.
Time is precious. Waste it wisely.
Manit0u
Profile Blog Joined August 2004
Poland17433 Posts
January 15 2015 22:29 GMT
#11311
Today I've learned how much of a blessing a modern PHP framework can be. I had to work in Kohana and boy was it hell. There's nothing particularly wrong with this framework, it works, it's lightweight and all. The problem is that it's been abandoned some time ago (the community is keeping it afloat to an extent) and it's missing some of the more modern things (dependency injection among others).

What bothered me the most was having to go primeval and doing everything by hand. I really can't remember the last time I had to enter the PhpMyAdmin and create tables from scratch, create all of the controller and model files and populate them with data, all that to get a very simple CRUD module. With something like Symfony or Laravel you can do all that by executing maybe 3 or 4 commands in the CLI, then just tinkering with auto-generated files a bit to tailor them to suit your specific needs (and you don't have to visit the database, like ever). In Kohana? A whole day of work to do something that shouldn't take more than an hour...

And the worst thing about this all? Having to remember a gazillion things in as many steps it takes to create your module. Everything is fine, but then you discover one small part not working. The debugging begins... Result? Of course, I forgot to add this string, which is the exact name of the table in the database somewhere in the admin controller (because there's a user controller too, have to keep that in mind) in a protected variable that is an array called $data_to_save, residing among 15 other fields like that...

Freaking ridiculous. I really feel for people who have to work with something as ancient as CodeIgniter or bare-bones PHP.
*shiver*
Time is precious. Waste it wisely.
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
January 15 2015 22:47 GMT
#11312
On January 16 2015 01:03 Manit0u wrote:
They're still on '99?

Guess they're only interested in C# and know all too well that probably 90% if not more C++ developers do it under Linux. Currently I'm forced to use Windows at work (not for C or C++ thankfully) and I must say that it is a dreadful experience.


That sounds weird. Have you got any data to back it up?
Manit0u
Profile Blog Joined August 2004
Poland17433 Posts
Last Edited: 2015-01-16 00:45:29
January 16 2015 00:44 GMT
#11313
On January 16 2015 07:47 darkness wrote:
Show nested quote +
On January 16 2015 01:03 Manit0u wrote:
They're still on '99?

Guess they're only interested in C# and know all too well that probably 90% if not more C++ developers do it under Linux. Currently I'm forced to use Windows at work (not for C or C++ thankfully) and I must say that it is a dreadful experience.


That sounds weird. Have you got any data to back it up?


Nope Obviously it was a huge exaggeration, seeing how so many apps are being written in C++ that target the Windows platform it wouldn't make a whole lot of sense developing them in Linux.

The one thing I've learned over the years though, is that Windows makes developer's life harder most of the time. There aren't as many tools available and using stuff isn't as simple.

I mean, just look at that: http://cs.calvin.edu/curriculum/cs/112/resources/installingEclipse/cygwin/

Anyway, even on Windows you're ending up using cygwin, gitbash and all that jazz that does nothing but emulate Linux and tools that come out-of-the-box for it.

That's my own experience though.
Time is precious. Waste it wisely.
Morga
Profile Joined August 2010
Belgium35 Posts
Last Edited: 2015-01-16 01:03:25
January 16 2015 01:03 GMT
#11314
On January 15 2015 03:55 fdsdfg wrote:
Before the difficulty of transferring the classes between JS and PHP, is there a way to build something similar to Classes in JS?

In your example, you have a JSON object


var someData = {
foo: "bar",
baz: 123,
x: {
a: 1,
b: 2
}
};


But, if I'm using this object and I say:


someData.a = 4


I'd expect the IDE to tell me there's no 'a' attribute in someData. I would say 'oh, right' and correct the reference to someData.x.a. I can then click on 'someData.x.a' and say 'find all references to this object' and it will show me every time that 'a' is written or read. It makes troubleshooting very pleasant.

In JS, though, it just creates a new attribute 'a' in someData and sets that data to 4. I meant to access .x.a, and I can easily lose a lot of time trying to troubleshoot an issue.

Sure, it's my fault for not knowing my objects that well, but I really like the model of being able to rely on the structure of my classes.

Check out typescript, compiles to javascript & is somewhat neater when handling objects.
Manit0u
Profile Blog Joined August 2004
Poland17433 Posts
Last Edited: 2015-01-16 11:37:55
January 16 2015 11:37 GMT
#11315
I don't think it's such a good idea. You'll learn to do it this way, then you go to work at a place where you're forced to write in pure JS and you're screwed. Better to go with prototypes and collections which are native to JS.
Time is precious. Waste it wisely.
Morga
Profile Joined August 2010
Belgium35 Posts
January 16 2015 17:40 GMT
#11316
If you're not planning to work professionally in a JS development enviroment & want to make sense of your own code in a couple years, typescript is more legible. So it's obvious TypeScript is the better language, the only reason to pick pure JS is because you might one day work in a company where pure JS is required.
these pieces of code are equivalent typescript - pure JS,
class Horse extends Animal {
constructor(name: string) { super(name); }
move() {
alert("Galloping...");
super.move(45);
}
}


var Horse = (function (_super) {
__extends(Horse, _super);
function Horse(name) {
_super.call(this, name);
}
Horse.prototype.move = function () {
alert("Galloping...");
_super.prototype.move.call(this, 45);
};
return Horse;
})(Animal);
Rotodyne
Profile Blog Joined July 2005
United States2263 Posts
Last Edited: 2015-01-16 18:29:24
January 16 2015 18:28 GMT
#11317
I really enjoy working with Laravel, and Jeffrey Way's Laracast have made me better at writing code in general (not just within the Laravel framework or PHP).

As for all this Javascript talk, I'm not sure if this is related but I've been using this design to format my code http://toddmotto.com/mastering-the-module-pattern/
I can only play starcraft when I am shit canned. IPXZERG is a god.
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
Last Edited: 2015-01-20 23:24:46
January 20 2015 23:18 GMT
#11318
I am trying to teach myself Java. At the moment I have 3 class files.

How do I call a specific method from one of the class files in a different class file? I don't want to call the whole thing.. I just want to call a specific method!

Is that not possible? Do I have to make yet another class?

I am sorry I know I am very noob. But this is not very intuitive.


This is like what I want to do

class1 {

main{
new class2();
}}


class2{

new method2()
}



class3{

method1(){
}

method2(){
}
}



I want to call method 2 from class 2. But it doesn't let me do that, it "cannot find symbol".

I don't want to do it by calling method1(which is named after class3), because then it runs everything in the class and I don't want to do everything.

I mean geeze do I need to make a separate class file any time I want to have a method I can call from another class?



I am sorry I know my terminology for all of this is horrible but it's confusing stuff to learn on your own.
zzdd
Profile Joined December 2010
United States484 Posts
Last Edited: 2015-01-20 23:29:50
January 20 2015 23:29 GMT
#11319
On January 21 2015 08:18 travis wrote:
+ Show Spoiler +
I am trying to teach myself Java. At the moment I have 3 class files.

How do I call a specific method from one of the class files in a different class file? I don't want to call the whole thing.. I just want to call a specific method!

Is that not possible? Do I have to make yet another class?

I am sorry I know I am very noob. But this is not very intuitive.


This is like what I want to do

class1 {

main{
new class2();
}}


class2{

new method2()
}



class3{

method1(){
}

method2(){
}
}



I want to call method 2 from class 2. But it doesn't let me do that, it "cannot find symbol".

I don't want to do it by calling method1(which is named after class3), because then it runs everything in the class and I don't want to do everything.

I mean geeze do I need to make a separate class file any time I want to have a method I can call from another class?



I am sorry I know my terminology for all of this is horrible but it's confusing stuff to learn on your own.

Did you import class2 to class1?
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
January 20 2015 23:30 GMT
#11320
I am using netbeans so they are in the same package, I am guessing that would mean I do not have to import them?

I don't actually know what importing class2 to class1 means though.
Prev 1 564 565 566 567 568 1032 Next
Please log in or register to reply.
Live Events Refresh
The PiG Daily
20:30
Best Games of SC
Serral vs Clem
Solar vs Cure
Serral vs Clem
Reynor vs GuMiho
herO vs Cure
PiGStarcraft322
LiquipediaDiscussion
BSL 21
20:00
ProLeague - RO32 Group C
Tarson vs Julia
Doodle vs OldBoy
eOnzErG vs WolFix
StRyKeR vs Aeternum
ZZZero.O323
LiquipediaDiscussion
OSC
19:00
Masters Cup #150: Group B
davetesta56
Liquipedia
PSISTORM Gaming Misc
15:55
FSL teamleague CNvsASH, ASHvRR
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
PiGStarcraft322
Nathanias 119
ProTech70
StarCraft: Brood War
Shuttle 935
ZZZero.O 323
NaDa 58
Dota 2
LuMiX1
Counter-Strike
fl0m1107
Super Smash Bros
AZ_Axe111
Other Games
tarik_tv6434
Grubby5300
summit1g4453
gofns4093
DeMusliM420
Pyrionflax195
Fuzer 191
Dewaltoss14
ViBE11
Organizations
Other Games
EGCTV935
gamesdonequick798
StarCraft 2
angryscii 33
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 19 non-featured ]
StarCraft 2
• StrangeGG 58
• musti20045 19
• Dystopia_ 3
• IndyKCrew
• Migwel
• AfreecaTV YouTube
• sooper7s
• intothetv
• Kozan
• LaughNgamezSOOP
StarCraft: Brood War
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• masondota2715
• Ler80
Other Games
• imaqtpie1667
• WagamamaTV495
• Shiphtur261
• tFFMrPink 13
Upcoming Events
Sparkling Tuna Cup
11h 33m
RSL Revival
11h 33m
Reynor vs sOs
Maru vs Ryung
Kung Fu Cup
13h 33m
Cure vs herO
Reynor vs TBD
WardiTV Korean Royale
13h 33m
BSL 21
21h 33m
JDConan vs Semih
Dragon vs Dienmax
Tech vs NewOcean
TerrOr vs Artosis
IPSL
21h 33m
Dewalt vs WolFix
eOnzErG vs Bonyth
Replay Cast
1d
Wardi Open
1d 13h
Monday Night Weeklies
1d 18h
WardiTV Korean Royale
2 days
[ Show More ]
BSL: GosuLeague
2 days
The PondCast
3 days
Replay Cast
4 days
RSL Revival
4 days
BSL: GosuLeague
4 days
RSL Revival
5 days
WardiTV Korean Royale
5 days
RSL Revival
6 days
WardiTV Korean Royale
6 days
IPSL
6 days
Julia vs Artosis
JDConan vs DragOn
Liquipedia Results

Completed

Proleague 2025-11-14
Stellar Fest: Constellation Cup
Eternal Conflict S1

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
SOOP Univ League 2025
YSL S2
BSL Season 21
CSCL: Masked Kings S3
SLON Tour Season 2
RSL Revival: Season 3
META Madness #9
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025

Upcoming

BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
HSC XXVIII
RSL Offline Finals
WardiTV 2025
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter 2026: Closed Qualifier
eXTREMESLAND 2025
ESL Impact League Season 8
SL Budapest Major 2025
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.