• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 05:41
CEST 11:41
KST 18:41
  • 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
Team TLMC #5 - Finalists & Open Tournaments0[ASL20] Ro16 Preview Pt2: Turbulence10Classic Games #3: Rogue vs Serral at BlizzCon9[ASL20] Ro16 Preview Pt1: Ascent10Maestros of the Game: Week 1/Play-in Preview12
Community News
BSL 2025 Warsaw LAN + Legends Showmatch0Weekly Cups (Sept 8-14): herO & MaxPax split cups4WardiTV TL Team Map Contest #5 Tournaments1SC4ALL $6,000 Open LAN in Philadelphia8Weekly Cups (Sept 1-7): MaxPax rebounds & Clem saga continues29
StarCraft 2
General
#1: Maru - Greatest Players of All Time Weekly Cups (Sept 8-14): herO & MaxPax split cups Team Liquid Map Contest #21 - Presented by Monster Energy SpeCial on The Tasteless Podcast Team TLMC #5 - Finalists & Open Tournaments
Tourneys
Maestros of The Game—$20k event w/ live finals in Paris Sparkling Tuna Cup - Weekly Open Tournament SC4ALL $6,000 Open LAN in Philadelphia WardiTV TL Team Map Contest #5 Tournaments RSL: Revival, a new crowdfunded tournament series
Strategy
Custom Maps
External Content
Mutation # 491 Night Drive Mutation # 490 Masters of Midnight Mutation # 489 Bannable Offense Mutation # 488 What Goes Around
Brood War
General
Soulkey on ASL S20 ASL TICKET LIVE help! :D BW General Discussion NaDa's Body A cwal.gg Extension - Easily keep track of anyone
Tourneys
[ASL20] Ro16 Group D [ASL20] Ro16 Group C [Megathread] Daily Proleagues BSL 2025 Warsaw LAN + Legends Showmatch
Strategy
Simple Questions, Simple Answers Muta micro map competition Fighting Spirit mining rates [G] Mineral Boosting
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread Path of Exile Borderlands 3 General RTS Discussion Thread
Dota 2
Official 'what is Dota anymore' discussion LiquidDota to reintegrate into TL.net
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
Community
General
US Politics Mega-thread Canadian Politics Mega-thread Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread UK Politics Mega-thread
Fan Clubs
The Happy Fan Club!
Media & Entertainment
Movie Discussion! [Manga] One Piece Anime Discussion Thread
Sports
2024 - 2026 Football Thread Formula 1 Discussion MLB/Baseball 2023
World Cup 2022
Tech Support
Linksys AE2500 USB WIFI keeps disconnecting Computer Build, Upgrade & Buying Resource Thread High temperatures on bridge(s)
TL Community
BarCraft in Tokyo Japan for ASL Season5 Final The Automated Ban List
Blogs
I <=> 9
KrillinFromwales
The Personality of a Spender…
TrAiDoS
A very expensive lesson on ma…
Garnet
hello world
radishsoup
Lemme tell you a thing o…
JoinTheRain
RTS Design in Hypercoven
a11
Evil Gacha Games and the…
ffswowsucks
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1587 users

The Big Programming Thread - Page 579

Forum Index > General Forum
Post a Reply
Prev 1 577 578 579 580 581 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.
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
February 05 2015 22:23 GMT
#11561
On February 06 2015 07:02 obesechicken13 wrote:
Setting:
I had an interview question yesterday in C#, for .net

The guy asked me to fill in pseudocode for a login.

My Answer:
I just verified the password, then you had to make an update and an insert. At first I didn't get what was so special about the question, but he hinted that maybe one of the queries would fail. So like with a banking transfer, you'd want to make sure either both queries (withdrawl from your account, deposit to another account) worked or that neither did.
How would I handle that?

I eventually answered rollbacks, but I had never used transactions with sql querieis so I didn't mention anything about transactions but he still seemed to be like "alright, at least he knows to use rollbacks".

Is there a better way?
Do you need try catch exception handling or is there a better way to check if queries don't work properly?

The database type would be MSSQL but I doubt it'd matter.


This property is called "atomicity" and is part of ACID: http://en.wikipedia.org/wiki/ACID#Atomicity

Here is a good example: https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqltransaction.commit(v=vs.110).aspx

You commit a transaction when no error occurs.
obesechicken13
Profile Blog Joined July 2008
United States10467 Posts
Last Edited: 2015-02-05 22:27:52
February 05 2015 22:25 GMT
#11562
On February 06 2015 07:15 bangsholt wrote:
First query... Well, that's binary, in the sense that you're comparing a username and a hash to a username and a hash. If that fails, you don't log the user in.

Second and third query you wrap in a transaction, which you would do with the SqlTransaction class in C# + MSSQL - then when you commit - i.e. you've reached the point where you want to know if everything is consistent or not, then you do a try catch on that - and if the commits fails, you rollback and tell the user it didn't go as expected.

Thanks.

Followup question:
A transaction cannot be rolled back after a COMMIT TRANSACTION statement is executed, except when the COMMIT TRANSACTION is associated with a nested transaction that is contained within the transaction being rolled back. In this instance, the nested transaction will also be rolled back, even if you have issued a COMMIT TRANSACTION for it.

https://msdn.microsoft.com/en-us/library/ms181299.aspx

I understand there's all this theory as to what changes can be rolled back based on atomicity.
But why does microsoft say that the rollback can't be done if the commit is executed? Does a failed commit not execute?
edit: nvm

On February 06 2015 07:23 darkness wrote:
Show nested quote +
On February 06 2015 07:02 obesechicken13 wrote:
Setting:
I had an interview question yesterday in C#, for .net

The guy asked me to fill in pseudocode for a login.

My Answer:
I just verified the password, then you had to make an update and an insert. At first I didn't get what was so special about the question, but he hinted that maybe one of the queries would fail. So like with a banking transfer, you'd want to make sure either both queries (withdrawl from your account, deposit to another account) worked or that neither did.
How would I handle that?

I eventually answered rollbacks, but I had never used transactions with sql querieis so I didn't mention anything about transactions but he still seemed to be like "alright, at least he knows to use rollbacks".

Is there a better way?
Do you need try catch exception handling or is there a better way to check if queries don't work properly?

The database type would be MSSQL but I doubt it'd matter.


This property is called "atomicity" and is part of ACID: http://en.wikipedia.org/wiki/ACID#Atomicity

Here is a good example: https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqltransaction.commit(v=vs.110).aspx

You commit a transaction when no error occurs

Thanks
I think in our modern age technology has evolved to become more addictive. The things that don't give us pleasure aren't used as much. Work was never meant to be fun, but doing it makes us happier in the long run.
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
February 05 2015 22:28 GMT
#11563
On February 06 2015 07:25 obesechicken13 wrote:
Show nested quote +
On February 06 2015 07:15 bangsholt wrote:
First query... Well, that's binary, in the sense that you're comparing a username and a hash to a username and a hash. If that fails, you don't log the user in.

Second and third query you wrap in a transaction, which you would do with the SqlTransaction class in C# + MSSQL - then when you commit - i.e. you've reached the point where you want to know if everything is consistent or not, then you do a try catch on that - and if the commits fails, you rollback and tell the user it didn't go as expected.

Thanks.

Followup question:
Show nested quote +
A transaction cannot be rolled back after a COMMIT TRANSACTION statement is executed, except when the COMMIT TRANSACTION is associated with a nested transaction that is contained within the transaction being rolled back. In this instance, the nested transaction will also be rolled back, even if you have issued a COMMIT TRANSACTION for it.

https://msdn.microsoft.com/en-us/library/ms181299.aspx

I understand there's all this theory as to what changes can be rolled back based on atomicity.
But why does microsoft say that the rollback can't be done if the commit is executed? Does a failed commit not execute?


And that's the D from ACID I guess:


Durability
Main article: Durability (database systems)

Durability means that once a transaction has been committed, it will remain so, even in the event of power loss, crashes, or errors. In a relational database, for instance, once a group of SQL statements execute, the results need to be stored permanently (even if the database crashes immediately thereafter). To defend against power loss, transactions (or their effects) must be recorded in a non-volatile memory.
Manit0u
Profile Blog Joined August 2004
Poland17341 Posts
Last Edited: 2015-02-06 07:39:47
February 05 2015 22:49 GMT
#11564
And to answer your other question about using try-catch for that: It's pretty widely used. You try-catch the query and use finally for rollbacks and other cleanup, just to make sure you didn't leave any mess in the DB.

Edit: Just make sure you don't call the same methods in the catch and finally blocks. Not sure about C# but in Java you really need to be careful.

Guess what will be returned here?


public class ExceptionTest {
public int returnValue(int x) {
System.out.println("Returning value: " + x);

return x;
}

public int testException() {
try {
throw new Exception();
}
catch (Exception e) {
return returnValue(1);
}
finally {
return returnValue(2);
}
}

public static void main(String args[]) {
System.out.println("Returned value: " + new ExceptionTest().testException());
}
}


+ Show Spoiler [return] +


Returning value: 1
Returning value: 2
Returned value: 2


Note to self: Do not modify anything as a in catch if you have finally in there too because they'll both go off.
Time is precious. Waste it wisely.
nunez
Profile Blog Joined February 2011
Norway4003 Posts
Last Edited: 2015-02-06 00:30:50
February 06 2015 00:30 GMT
#11565
On February 06 2015 05:59 spinesheath wrote:
Show nested quote +
On February 06 2015 05:14 Cynry wrote:
That namespace discussion and the recent one about i++ or ++i makes me wonder if noobs should really bother learning this kind of optimisation, considering we probably still write suboptimal programs anyway. Like today at school, some guy was telling how setting a variable to 0 is slower than using a xor or something. Does any of this really matter, be it right or not, when we still go through any set of variable 3 times more than is needed ? I don't think so, but maybe I'm wrong..

Performance optimizations like that not only don't matter, they are outright bad unless you profiled your application's performance and determined that doing these things actually improves your performance significantly. Hint: typically you'll find some awful algorithm that hogs all the processing power and can't be improved by more than .00001% by using an xor instead of an assignment.

In the case of ++i over i++ it's just a straight up potential improvement with no downsides unless you specifically need the semantics of i++. Both are equally readable.
Whether you should use either of them is another question, but if you use one of them, use ++i.

Performance optimizations at instuction level will usually be done by a moderately intelligent comiler anyways, no need to bother with them.


Let me be clear: Do not attempt to optimize your code for performance unless you actually have a performance problem AND profiled it.


yes, ++i and i++ is a question of semantics. ++i is a reasonable default if that is not a factor.
and for namespaces, they have little to do with performance, you use it for code structure and symbol visibility.
conspired against by a confederacy of dunces.
Ropid
Profile Joined March 2009
Germany3557 Posts
February 06 2015 09:43 GMT
#11566
On February 06 2015 05:09 RoyGBiv_13 wrote:
[...]

Many people use f.lux to dim the screen after sundown, which is an option for helping to avoid high energy light. It takes about an hour after seeing a moderately bright blue or purple light to fully adjust back to clear night vision, so avoid doing anything that requires eyesight immediately after computer usage, such as driving.


Note that f.lux isn't really supposed to dim the screen. Its idea is to shift the color temperature. This technically still dims the screen somewhat, but only because there's no way to do the color change other than cutting something off from the range of the color channels. For example when white (255,255,255) turns into (255,237,217), that change obviously loses some brightness.

The difference in the brightness in a room in the middle of the day compared to the lighting at home at night can be a lot bigger than the brightness that's lost through f.lux. It's currently 10 in the morning where I am. I have a colorimeter here and it can measure ambient light. It measures around 600 lux on the table in front of me. When I close the blinds, it's measuring 80 lux in the same spot, but you can still do everything normally in the room, can still read fine etc.

I have no good idea where I'm going with this train of thought here. Perhaps, when you have a monitor that's set up in a certain way to be good to work at in the middle of the day, and you notice you don't have any problems with your eyes when using it in daytime, the big change you could do to try to fix issues in the evening and night is reducing the monitor's brightness by a serious amount, something that feels ridiculous at first look? The room should probably also never be completely dark so that there's no big difference between the monitor's picture and your surroundings, just like it is in daytime?
"My goal is to replace my soul with coffee and become immortal."
supereddie
Profile Joined March 2011
Netherlands151 Posts
February 06 2015 10:42 GMT
#11567
On February 06 2015 07:23 darkness wrote:
Show nested quote +
On February 06 2015 07:02 obesechicken13 wrote:
Setting:
I had an interview question yesterday in C#, for .net

The guy asked me to fill in pseudocode for a login.

My Answer:
I just verified the password, then you had to make an update and an insert. At first I didn't get what was so special about the question, but he hinted that maybe one of the queries would fail. So like with a banking transfer, you'd want to make sure either both queries (withdrawl from your account, deposit to another account) worked or that neither did.
How would I handle that?

I eventually answered rollbacks, but I had never used transactions with sql querieis so I didn't mention anything about transactions but he still seemed to be like "alright, at least he knows to use rollbacks".

Is there a better way?
Do you need try catch exception handling or is there a better way to check if queries don't work properly?

The database type would be MSSQL but I doubt it'd matter.


This property is called "atomicity" and is part of ACID: http://en.wikipedia.org/wiki/ACID#Atomicity

Here is a good example: https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqltransaction.commit(v=vs.110).aspx

You commit a transaction when no error occurs.

It's better if you wrap stuff in a TransactionScope instead of manually handling it via SqlTransaction. TransactionScope has a lot of improvements and is the recommended way for using transactions in .NET.

Unless you call the .Complete() method, the transaction will be rolled back automatically when the TransactionScope instance is disposed (otherwise it will be completed when disposing) - no need for complex try/catch blocks.

Unfortunately, the default settings for TransactionScope are not the best for SQL Server, and it is recommended to create a small utils to properly create the TransactionScope for use with SQL Server (though this was written in 2010; the default behaviour may have changed by now).

+ Show Spoiler +


private void BlahSomething()
{
using(TransactionScope scope = TransactionUtils.CreateTransactionScope())
{
// do database work, maybe use entity framework
scope.Complete();
}
}

"Do not try to make difficult things possible, but make simple things simple." - David Platt on Software Design
Artesimo
Profile Joined February 2015
Germany546 Posts
February 06 2015 13:45 GMT
#11568
Wooow nailed my programming exam, most likely a 1.0 incoming. Thanks to all you kind people that helped me with my newbie-questions.

On the other hand: may our prof have a edgy stone in his shoe for the rest of his life. He deliberately tried to set us up with the exercise required to get an 4.0. He wanted us to make some sort of ticker that displays a sentence. We did that in one of his lectures, but as always when he shows something/explain something, it got terrible confusing since he always makes lots of errors, typos and so on. Lucky me remembered the system("cls")-command, but a lot got burned by it, especially those who wherent in that exact lecture. "Ticker" might be kind of familiar, but he used the german word "Laufschrift" and I can tell you, most of us will look at you in confusion if you ask them what a "laufschrift" is. You could also tell by the format of the exampaper that it got smushed in there and what usually would be the part for a 4.0 got merged with the 3.0 part. We are now coordinating a complaint. I bet he is "verbeamtet"(which means its effectively impossible to fire him), but at least he shouldnt teach in first semester. Another professor is giving programming lectures for our semester and does a way better job (unfortunately I was unable to attend his lectures because they colided with other lectures of mine), next semester we will have a lot less students and guess who is losing and whos keeping his draft? Yep, shitty old prof that doesnt really care get to keep his and good prof that really teaches stuff loses his draft and they get merged with us.
obesechicken13
Profile Blog Joined July 2008
United States10467 Posts
Last Edited: 2015-02-06 16:08:05
February 06 2015 16:07 GMT
#11569
Happy Korean birthday darkness
I think in our modern age technology has evolved to become more addictive. The things that don't give us pleasure aren't used as much. Work was never meant to be fun, but doing it makes us happier in the long run.
Zocat
Profile Joined April 2010
Germany2229 Posts
February 06 2015 17:42 GMT
#11570
On February 06 2015 22:45 Artesimo wrote:
Wooow nailed my programming exam, most likely a 1.0 incoming. Thanks to all you kind people that helped me with my newbie-questions.


Congrats to that.

Lauftext/Laufschrift is a word you should know as a German. A ticker is something different. A ticker can be implemented as a Lauftext, but it can also just update as a whole. Think Bundesliga-Ticker, where you can always read the whole match and nothing is scrolling.
Overall you should be able to clarify such definitions during an exam.

And if he discussed it in one of his lectures, yes he did try to set you up. For passing.
If it's on a slide it can be part of the exam, if a whole lecture is spent on it, it _will_ be in the exam.
"a lot got burned by it, especially those who wherent in that exact lecture." If people are not in the lecture / don't bother to learn the missed stuff, then it's their fault, not the professor's one.

You have the freedom to miss lectures, you have the responsibility to still know the material.
Cyx.
Profile Joined November 2010
Canada806 Posts
February 06 2015 18:17 GMT
#11571
On February 06 2015 22:45 Artesimo wrote:I bet he is "verbeamtet"(which means its effectively impossible to fire him)


I'm guessing this is the same as English 'tenure'?
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
February 06 2015 18:23 GMT
#11572
On February 07 2015 01:07 obesechicken13 wrote:
Happy Korean birthday darkness


Haha, thank you. I didn't expect that!
Artesimo
Profile Joined February 2015
Germany546 Posts
Last Edited: 2015-02-06 19:18:15
February 06 2015 19:11 GMT
#11573
On February 07 2015 02:42 Zocat wrote:
Show nested quote +
On February 06 2015 22:45 Artesimo wrote:
Wooow nailed my programming exam, most likely a 1.0 incoming. Thanks to all you kind people that helped me with my newbie-questions.


Congrats to that.

Lauftext/Laufschrift is a word you should know as a German. A ticker is something different. A ticker can be implemented as a Lauftext, but it can also just update as a whole. Think Bundesliga-Ticker, where you can always read the whole match and nothing is scrolling.
Overall you should be able to clarify such definitions during an exam.

And if he discussed it in one of his lectures, yes he did try to set you up. For passing.
If it's on a slide it can be part of the exam, if a whole lecture is spent on it, it _will_ be in the exam.
"a lot got burned by it, especially those who wherent in that exact lecture." If people are not in the lecture / don't bother to learn the missed stuff, then it's their fault, not the professor's one.

You have the freedom to miss lectures, you have the responsibility to still know the material.


Maybe, ticker is the direct translation, BUT he did not set us up for passing. This laufschrift-thing we did in one of the very early lectures and if you seen him presenting something one time, you realize how small effort he puts into his lectures. Whiel every other part of the test checked some sort of principle/general knowledge like classes, call by value/call by refference etc. this one was just something you can play around with, nothing more and it was totally out of context since the rest of the test belonged together. Also, it didnt really fit into his usal examstyle. I know that I am not a skilled programmer, but a newb and still, that seems pretty clear to me. 2 guys who easilie made the exam are coordinating this complaint about the prof and they showed us the video from a few lectures of the other prof. He writes stuff on the board/explains, his presentation isnt just a straight copy of "c++ primer". Amongst the students our prof is a known problem and we will try to take care that he has to change something.

To be precise, his exams are usually:
4.0 implement a class, its attributes and methods.
3.0 read in a file/implement some inheritage
2.0 let the different values of the classes interact/use static
1.0 overload an operator

This exam:
4.0 the ticker thing
3.0 implement classes (a club with leader and member), read in file with memberlist
2.0 interaction of values/changing values
1.0 overload operator

even if he didnt set us up, he does a pretty poor job in his lectures and its not frustration that is speaking out of me it is the sad truth, especially now that I have seen the lectures of the other prof.
BlueRoyaL
Profile Blog Joined February 2006
United States2493 Posts
February 06 2015 20:36 GMT
#11574
Hey guys, I have a general question about classes.

I've been working on an ASP.NET MVC project and a thought came up while designing my controller. For those of you that don't know, a controller is simply an object that handles incoming HTTP requests via URLs and returns a response.

One of my particular controller actions takes several query parameters, and returns a collection of items that are sorted based off of these parameters. As you could expect, the logic to check all of these and order the collection was pretty lengthy at around 25-30 lines.

I didn't want to bloat my controller class with a bunch of business logic, so I created a separate class called ControllerUtilities that would execute the logic, and return the ordered collection. End result was I was able to get my controller to be much slimmer, replacing the 25-30 lines with 2.

Is this an acceptable use for classes? Is it okay to create a separate "helper/utility" class if the only reason for its existence is to take some chunk of code out of another class to make it slimmer?

Just wanted to get input from you guys as still relatively new to oop best practices. This is something I've done a lot on clientside javascript using modules, but just wasn't sure how it should be handled here.

And also related, do I get any non-trivial performance hits from doing the above? I would assume it would take more memory, and possibly more processing time, to create a new object to perform some logic, as opposed to piling on all the logic into one huge monolithic class.

Thanks!
WHAT'S HAPPENIN
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
Last Edited: 2015-02-06 21:28:59
February 06 2015 20:51 GMT
#11575
Just make the helper class a private method inside the original class unless you expect that business logic to be used repeatedly by other classes. It's not monolithic if that's all that is required. I would even be hesitant to move it to another function unless it made sense to move it to another function, unlike a "if (x) { doWork; doMoreWork(); }" kinda deal where the benefit is essentially just fewer lines to read and not necessarily much more clarity of intent.
There is no one like you in the universe.
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
Last Edited: 2015-02-06 21:16:02
February 06 2015 21:14 GMT
#11576
I'm not a fan of "helper" or "utility" classes, especially if they contain business logic. I consider them ok for things like validation (throw if null or not in range and so on) or other pieces of 2-4 line of code that would otherwise be repeated all over the place.

In your case there probably is a better approach that uses generic sorting functionality, but you'd probably need to transform your current algorithm in a not-trivial way. For example you could try to create a custom comparer (initialized with the query parameters) for your items and sort the collection using that comparer. Ideally that comparer would be completely independent from the original problem. Maybe there are completely different, better approaches.

In general, I only like classes that have a name that describes the class well. "Helper" or "utility" really doesn't say much. Neither does "data" or "information".

In any case, if all you achieved by creating that new class is that you moved the code from one place to another without making the code itself any better, you might as well keep it in its original location. You don't improve anything by clumsily hiding code like that.
If you have a good reason to disagree with the above, please tell me. Thank you.
enigmaticcam
Profile Blog Joined October 2010
United States280 Posts
Last Edited: 2015-02-07 00:10:17
February 07 2015 00:10 GMT
#11577
Your controller methods should be very slim. Their only purpose is to connect your view action to your model, and nothing more. While I would agree with spinesheath that simply moving the code from one place to another doesn't really add any value, in this case that's exactly what you want to do since you're using an MVC architecture.

Where then should it go? That depends on how much of it is business logic. Your every day list sort is certainly not business logic, but if you're sorting based on specific constraints it might be. I would try to separate what is pertinent to business logic from what isn't, and put both pieces in places they can be reused.
Manit0u
Profile Blog Joined August 2004
Poland17341 Posts
February 07 2015 02:04 GMT
#11578
There are some basic guidelines when it comes to this stuff (assuming you're using some form of ORM).

If you need a method (no matter how complex) that only needs to do stuff with a single entity (table), you can put this method in the entity class. In case of methods that need to do stuff on multiple tables/rows you can create repositories in your model (you would have say 'User' entity and you could create 'UserRepository') and put your code in there as public methods. If you need more than 5 methods per repository you should think about creating a service though.

Here's a nice article on repositories: http://www.whitewashing.de/2013/03/04/doctrine_repositories.html
Time is precious. Waste it wisely.
sabas123
Profile Blog Joined December 2010
Netherlands3122 Posts
February 07 2015 15:35 GMT
#11579
For next semester I like a 90% chance I pick my own project.

So far I only decided that I want to do something in C. any suggestions?
The harder it becomes, the more you should focus on the basics.
Incognoto
Profile Blog Joined May 2010
France10239 Posts
February 07 2015 16:05 GMT
#11580
so i'm kind of bored and decided to dick around with some c++. careful, i'm like the noobiest person to ever enter the url to this thread

i downloaded visual c++ 2010 express and started dicking around in that program. just adding integers and showing the result in a window

we did a little programming in VBA at university (that's what we'll mostly due) and i decided to mess around with c++ since i have very, very basic understanding of how to write very, very basic programs

my question is, what good is c++ for? could i write a program, which i would execute, and have it ask me for 3 numbers, which would then be assigned to a ax² + bx + c = 0 style equation, which the program would then solve? i'm guessing that yes, i would. i would call it "polynomialesforidiots.exe" for example

what else could i do?



tl;dr, what real world applications does c++ have?
maru lover forever
Prev 1 577 578 579 580 581 1031 Next
Please log in or register to reply.
Live Events Refresh
Next event in 19m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Rex 1
StarCraft: Brood War
Calm 5699
Bisu 731
Hyuk 162
HiyA 96
Hyun 96
sorry 86
ToSsGirL 84
Dewaltoss 82
Pusan 77
Light 74
[ Show more ]
Soma 60
actioN 56
Mini 49
ZerO 32
BeSt 30
Liquid`Ret 29
Nal_rA 28
soO 27
Sharp 24
Rush 19
Free 16
SilentControl 10
Dota 2
singsing1260
XcaliburYe206
boxi98170
League of Legends
JimRising 381
Counter-Strike
olofmeister1583
shoxiejesuss598
allub166
Other Games
XaKoH 143
NeuroSwarm80
Trikslyr15
Organizations
StarCraft: Brood War
lovetv 593
Other Games
gamesdonequick587
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 14 non-featured ]
StarCraft 2
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• iopq 1
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Jankos1421
• Stunt679
Other Games
• WagamamaTV81
Upcoming Events
RSL Revival
19m
Maru vs Reynor
Cure vs TriGGeR
Rex1
Map Test Tournament
1h 19m
The PondCast
3h 19m
RSL Revival
1d
Zoun vs Classic
Korean StarCraft League
1d 17h
BSL Open LAN 2025 - War…
1d 22h
RSL Revival
2 days
BSL Open LAN 2025 - War…
2 days
RSL Revival
3 days
Online Event
3 days
[ Show More ]
Wardi Open
4 days
Monday Night Weeklies
4 days
Sparkling Tuna Cup
5 days
LiuLi Cup
6 days
Liquipedia Results

Completed

Proleague 2025-09-10
Chzzk MurlocKing SC1 vs SC2 Cup #2
HCC Europe

Ongoing

BSL 20 Team Wars
KCM Race Survival 2025 Season 3
BSL 21 Points
ASL Season 20
CSL 2025 AUTUMN (S18)
LASL Season 20
RSL Revival: Season 2
Maestros of the Game
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

Upcoming

2025 Chongqing Offline CUP
BSL World Championship of Poland 2025
IPSL Winter 2025-26
BSL Season 21
SC4ALL: Brood War
BSL 21 Team A
Stellar Fest
SC4ALL: StarCraft II
EC S1
ESL Impact League Season 8
SL Budapest Major 2025
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
MESA Nomadic Masters Fall
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
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.