• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 02:34
CEST 08:34
KST 15:34
  • 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
[ASL21] Ro8 Preview Pt1: Inheritors8[ASL21] Ro16 Preview Pt2: All Star10Team Liquid Map Contest #22 - The Finalists17[ASL21] Ro16 Preview Pt1: Fresh Flow9[ASL21] Ro24 Preview Pt2: News Flash10
Community News
2026 GSL Season 1 Qualifiers19Maestros of the Game 2 announced92026 GSL Tour plans announced15Weekly Cups (April 6-12): herO doubles, "Villains" prevail1MaNa leaves Team Liquid25
StarCraft 2
General
Team Liquid Map Contest #22 - The Finalists MaNa leaves Team Liquid Maestros of the Game 2 announced 2026 GSL Tour plans announced Blizzard Classic Cup @ BlizzCon 2026 - $100k prize pool
Tourneys
Sparkling Tuna Cup - Weekly Open Tournament 2026 GSL Season 1 Qualifiers INu's Battles#14 <BO.9 2Matches> GSL CK: More events planned pending crowdfunding RSL Revival: Season 5 - Qualifiers and Main Event
Strategy
Custom Maps
[D]RTS in all its shapes and glory <3 [A] Nemrods 1/4 players [M] (2) Frigid Storage
External Content
The PondCast: SC2 News & Results Mutation # 523 Firewall Mutation # 522 Flip My Base Mutation # 521 Memorable Boss
Brood War
General
[ASL21] Ro8 Preview Pt1: Inheritors FlaSh: This Will Be My Final ASL【ASL S21 Ro.16】 Leta's ASL S21 Ro.16 review BGH Auto Balance -> http://bghmmr.eu/ ASL21 General Discussion
Tourneys
[ASL21] Ro8 Day 1 [Megathread] Daily Proleagues [ASL21] Ro16 Group D Escore Tournament StarCraft Season 2
Strategy
Simple Questions, Simple Answers What's the deal with APM & what's its true value Any training maps people recommend? Fighting Spirit mining rates
Other Games
General Games
Diablo IV Nintendo Switch Thread Dawn of War IV Total Annihilation Server - TAForever Starcraft Tabletop Miniature Game
Dota 2
The Story of Wings Gaming
League of Legends
G2 just beat GenG in First stand
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
Vanilla Mini Mafia Mafia Game Mode Feedback/Ideas TL Mafia Community Thread Five o'clock TL Mafia
Community
General
3D technology/software discussion US Politics Mega-thread European Politico-economics QA Mega-thread Canadian Politics Mega-thread Things Aren’t Peaceful in Palestine
Fan Clubs
The IdrA Fan Club
Media & Entertainment
[Manga] One Piece Anime Discussion Thread [Req][Books] Good Fantasy/SciFi books Movie Discussion!
Sports
2024 - 2026 Football Thread Formula 1 Discussion McBoner: A hockey love story
World Cup 2022
Tech Support
streaming software Strange computer issues (software) [G] How to Block Livestream Ads
TL Community
The Automated Ban List
Blogs
Sexual Health Of Gamers
TrAiDoS
lurker extra damage testi…
StaticNine
Broowar part 2
qwaykee
Funny Nicknames
LUCKY_NOOB
Iranian anarchists: organize…
XenOsky
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1803 users

The Big Programming Thread - Page 407

Forum Index > General Forum
Post a Reply
Prev 1 405 406 407 408 409 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.
obesechicken13
Profile Blog Joined July 2008
United States10467 Posts
Last Edited: 2013-12-08 09:29:34
December 08 2013 09:29 GMT
#8121
On December 08 2013 18:05 ambikalx wrote:
Hey guys! It's been a while since I've hit this thread up. This is a web dev question this time! I have been learning PHP/jQuery with MySQL and I'm interested in creating an online travel agency kind of site that searched to see which tour guides were available on user selected dates. I'm looking for advice on what may be the best way to store the calendars/availability of all of the guides. My current idea is to only store reserved dates in the guide's table and reference another table which contains rules set by the guide (not available on weekends, prices are $x on these days, etc.). Can anyone see any pitfalls of doing it this way? Does anyone know of a better way I could go about doing this?

Thanks for your help!

Good database design theory is to make tables scalable and to be as specific as possible.

Databases can have constraints set on them if you want. But having an administrative table for things that can change is a good idea.

I learned a lot from here:
https://www.simple-talk.com/sql/database-administration/ten-common-database-design-mistakes/


I don't think it's a good idea to only use two tables for this.

And making calendars is difficult imo. There are many intricacies to dates that are hard to program and php isn't the best language to work with dates.
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.
bangsholt
Profile Joined June 2011
Denmark138 Posts
December 08 2013 11:46 GMT
#8122
On December 07 2013 22:58 sluggaslamoo wrote:
Show nested quote +
On December 06 2013 22:05 bangsholt wrote:
On December 06 2013 12:10 sluggaslamoo wrote:
On December 06 2013 10:27 bangsholt wrote:
On December 05 2013 07:45 sluggaslamoo wrote:
On December 05 2013 00:30 darkness wrote:
Does anyone here like Objective-C? I'm starting to hate it with a passion by now. I find Java's syntax and way much better and easier.


It has some nice features, it was great for its time but I'm sure if it wasn't for apple it would be long dead by now.


Thanks for your opinion and all the great argumentation you have present on the subject of why you are starting to hate it with a passion.

I'm currently playing around with a great mix of Jenkins, Stash and JIRA, in order to make it build automagically and run a few simple static code analysis and unit testing on my code.

People out there who have actual experience with how well this works in a work scenario - I'm thinking it will work great, because it will enable us to put out a lot of metrics, which then can be measured and possibly drawn conclusions on, if someone feels that brave, but I would like to hear from people who have a similar setup as well.

Thanks in advance for your time.


What is it you want to know? Continuous Integration and Testing is one of the reasons I actually get hired haha

I mean yeah I've used Jenkins a lot, JIRA I don't really like but then again I don't really like any kind of digital scrum/agile software and prefer to use real cards, I don't have experience with Stash specifically but Atlassian software seems to be very good in general from using Bamboo.

It will be a long time before I move away from Github though if ever


I've read the idea with CI is that you make a new build every time you commit to the Git server on the master branch.

What I don't really understand is the part where testing comes into the picture, one would assume you run all the tests prior to commit the code, and each commit should be atomic.

Or is it a case of you over time accumulate some tests that take a lot of time to run and you don't want to run each time that you compile?

It's this sort of questions I wonder a bit about - again, thanks for your time


You are pretty much on the ball there, both of those statements are true. Ideally you would want to do a "full build" before pushing to your branch, but in large projects where it takes an hour to do that it is not possible.

So on your local machine you may just be content with core scenario tests, integration tests and unit tests, and then CI handles the bigger picture. Then you have a "build light" that checks CI periodically, and will alarm everybody if someone broke the build and blame them for it

When this happens, everyone should stop committing until the bug is fixed.

Show nested quote +
I've read the idea with CI is that you make a new build every time you commit to the Git server on the master branch.


Got a bit confused by the "make a new build every time", do you mean run the build?

If so yes, normally you have nightly builds, source control event-based and on-demand builds for each type of test, and for each branch. Your event based builds would trigger when your git repository receives an update.

Normally you wouldn't want to be pushing to master, you want to be merging into it from your version branch. There should be a protocol to only merge into master after a "full build" which is basically every single test which sometimes can take hours.

It may look something like this

Master-Nightly-FullBuild
Master-Nightly-Load-Test
Version1.1-Nightly-FullBuild
Version1.1-Unit-Tests
Version1.1-Integration-Tests
Version1.1-Scenario-Tests-Minor
Version1.1-Scenario-Tests-All
Version1.1-E2E-Tests
Version1.1-Load-Test


Yes, I meant run the build

I got a better idea of the whys now, thanks for that to you, phar and Morfildur
ambikalx
Profile Joined September 2011
United States30 Posts
December 08 2013 23:14 GMT
#8123
On December 08 2013 18:29 obesechicken13 wrote:
Good database design theory is to make tables scalable and to be as specific as possible.

Databases can have constraints set on them if you want. But having an administrative table for things that can change is a good idea.

I learned a lot from here:
https://www.simple-talk.com/sql/database-administration/ten-common-database-design-mistakes/


I don't think it's a good idea to only use two tables for this.

And making calendars is difficult imo. There are many intricacies to dates that are hard to program and php isn't the best language to work with dates.


Thanks for the response! That link was just what I needed. I had been absolutely in the dark as far as how to structure my databases/tables. I read up on the entity-relationship model and have a much better idea of what I'm doing now.

Also, I totally forgot that I am actually going to be taking Database Design & Development next semester in my CS major *slaps forehead*. We will be learning about ERM, so I guess I'm going to have a bit of a head start on the class
phar
Profile Joined August 2011
United States1080 Posts
December 09 2013 00:17 GMT
#8124
On December 08 2013 20:46 bangsholt wrote:
Show nested quote +
On December 07 2013 22:58 sluggaslamoo wrote:
On December 06 2013 22:05 bangsholt wrote:
On December 06 2013 12:10 sluggaslamoo wrote:
On December 06 2013 10:27 bangsholt wrote:
On December 05 2013 07:45 sluggaslamoo wrote:
On December 05 2013 00:30 darkness wrote:
Does anyone here like Objective-C? I'm starting to hate it with a passion by now. I find Java's syntax and way much better and easier.


It has some nice features, it was great for its time but I'm sure if it wasn't for apple it would be long dead by now.


Thanks for your opinion and all the great argumentation you have present on the subject of why you are starting to hate it with a passion.

I'm currently playing around with a great mix of Jenkins, Stash and JIRA, in order to make it build automagically and run a few simple static code analysis and unit testing on my code.

People out there who have actual experience with how well this works in a work scenario - I'm thinking it will work great, because it will enable us to put out a lot of metrics, which then can be measured and possibly drawn conclusions on, if someone feels that brave, but I would like to hear from people who have a similar setup as well.

Thanks in advance for your time.


What is it you want to know? Continuous Integration and Testing is one of the reasons I actually get hired haha

I mean yeah I've used Jenkins a lot, JIRA I don't really like but then again I don't really like any kind of digital scrum/agile software and prefer to use real cards, I don't have experience with Stash specifically but Atlassian software seems to be very good in general from using Bamboo.

It will be a long time before I move away from Github though if ever


I've read the idea with CI is that you make a new build every time you commit to the Git server on the master branch.

What I don't really understand is the part where testing comes into the picture, one would assume you run all the tests prior to commit the code, and each commit should be atomic.

Or is it a case of you over time accumulate some tests that take a lot of time to run and you don't want to run each time that you compile?

It's this sort of questions I wonder a bit about - again, thanks for your time


You are pretty much on the ball there, both of those statements are true. Ideally you would want to do a "full build" before pushing to your branch, but in large projects where it takes an hour to do that it is not possible.

So on your local machine you may just be content with core scenario tests, integration tests and unit tests, and then CI handles the bigger picture. Then you have a "build light" that checks CI periodically, and will alarm everybody if someone broke the build and blame them for it

When this happens, everyone should stop committing until the bug is fixed.

I've read the idea with CI is that you make a new build every time you commit to the Git server on the master branch.


Got a bit confused by the "make a new build every time", do you mean run the build?

If so yes, normally you have nightly builds, source control event-based and on-demand builds for each type of test, and for each branch. Your event based builds would trigger when your git repository receives an update.

Normally you wouldn't want to be pushing to master, you want to be merging into it from your version branch. There should be a protocol to only merge into master after a "full build" which is basically every single test which sometimes can take hours.

It may look something like this

Master-Nightly-FullBuild
Master-Nightly-Load-Test
Version1.1-Nightly-FullBuild
Version1.1-Unit-Tests
Version1.1-Integration-Tests
Version1.1-Scenario-Tests-Minor
Version1.1-Scenario-Tests-All
Version1.1-E2E-Tests
Version1.1-Load-Test


Yes, I meant run the build

I got a better idea of the whys now, thanks for that to you, phar and Morfildur

NP. And if you do get pushback from people at your work who are dragging their feet about setting up proper building and testing, you should be able to explain how much time you'll save in the long run if you invest up front.
Who after all is today speaking about the destruction of the Armenians?
misirlou
Profile Joined June 2010
Portugal3300 Posts
December 09 2013 00:37 GMT
#8125
Anyone have experience developing/contributing for Open Stack? My master's is to make a scheduler for it, so any info I could get on working for it and getting started with some community interaction would be appreciated
obesechicken13
Profile Blog Joined July 2008
United States10467 Posts
December 09 2013 02:28 GMT
#8126
On December 09 2013 08:14 ambikalx wrote:
Show nested quote +
On December 08 2013 18:29 obesechicken13 wrote:
Good database design theory is to make tables scalable and to be as specific as possible.

Databases can have constraints set on them if you want. But having an administrative table for things that can change is a good idea.

I learned a lot from here:
https://www.simple-talk.com/sql/database-administration/ten-common-database-design-mistakes/


I don't think it's a good idea to only use two tables for this.

And making calendars is difficult imo. There are many intricacies to dates that are hard to program and php isn't the best language to work with dates.


Thanks for the response! That link was just what I needed. I had been absolutely in the dark as far as how to structure my databases/tables. I read up on the entity-relationship model and have a much better idea of what I'm doing now.

Also, I totally forgot that I am actually going to be taking Database Design & Development next semester in my CS major *slaps forehead*. We will be learning about ERM, so I guess I'm going to have a bit of a head start on the class

No problem. I took an intro to databases course this semester and I thought that link helped me a lot to understand entity relationship design.
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.
jWavA
Profile Joined January 2011
United States73 Posts
December 09 2013 04:38 GMT
#8127
I've got my first ever technical interview tomorrow, with Google for their Eng. Practicum Internship. Any advice?
Kambing
Profile Joined May 2010
United States1176 Posts
December 09 2013 07:47 GMT
#8128
On December 09 2013 13:38 jWavA wrote:
I've got my first ever technical interview tomorrow, with Google for their Eng. Practicum Internship. Any advice?


Talk. Specifically, when you work through problems, vocalize your thought process to the best of your ability. Interview questions are meant to expose how you think, and you won't be able to show that off without saying something.
epok
Profile Joined September 2013
United States117 Posts
December 09 2013 17:34 GMT
#8129
Don't lie to your interviewer!
phar
Profile Joined August 2011
United States1080 Posts
Last Edited: 2013-12-10 02:31:44
December 10 2013 02:30 GMT
#8130
^ These are very good tips. Always think out loud, that way the interviewer can write effective feedback on what you're thinking. Never lie, because interviewers can tell

If you take only one thing from TL on interview tips, let it be what Kambing said above. THINK OUTLOUD. Even if you're stuck, keep describing why you're stuck, where you're drawing blanks, what you know and what you think you don't know. It's really weird to get used to at first, but it is a necessary thing for technical interviews.

On December 09 2013 13:38 jWavA wrote:
I've got my first ever technical interview tomorrow, with Google for their Eng. Practicum Internship. Any advice?


Specifically on the EP part, realize that the interviewers should know that you have less experience than a normal interview candidate. If you don't know something, that's fine, just be up front about it so you don't work yourself into a hole. I hosted a couple of EP interns this summer, and they were definitely very green about software development coming in. That's ok, and your interview should be calibrated to take that into account.

It may be a bit rough if this is really your first technical interview, it can take awhile to get used to.


And then one of the local Googlers up here has a... rant, we'll say, on google interview process. It's mostly geared towards fulltime SWE, not EP, but a lot of it will apply. The middle sections on algorithms, data structures, practice, Big-O, it's all pretty good. I can't remember if EP are explicitly supposed to know about complexity theory, so if there's some stuff on there that you don't recognize, it may not apply for you. Also your recruiter may have given you more detail about what you're expected to know.

http://steve-yegge.blogspot.com/2008/03/get-that-job-at-google.html

Even if you don't get in, don't be discouraged, apply again next year, and apply to many places. You'd be a freshman or sophomore right now if you're applying for EP, so you have time still


good luck~
Who after all is today speaking about the destruction of the Armenians?
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
Last Edited: 2013-12-11 04:26:15
December 11 2013 04:22 GMT
#8131
Say a user cannot cause a crash, but a programmer may pass some parameter that is out of boundaries. Is it good in this case to have all methods contain some boundary check (even if the programmer is the only person able to cause it) or is such check unnecessary?

Sub-question to the above one. What is preferred assuming both are available: if statement or try/catch blocks? When to go one over another?

I'm curious what to do for my individual university project. I'd like to do my best with the knowledge I have at the moment.

I use Java if it matters.
Kambing
Profile Joined May 2010
United States1176 Posts
December 11 2013 04:35 GMT
#8132
On December 11 2013 13:22 darkness wrote:
Say a user cannot cause a crash, but a programmer may pass some parameter that is out of boundaries. Is it good in this case to have all methods contain some boundary check (even if the programmer is the only person able to cause it) or is such check unnecessary?

Sub-question to the above one. What is preferred assuming both are available: if statement or try/catch blocks? When to go one over another?

I'm curious what to do for my individual university project. I'd like to do my best with the knowledge I have at the moment.

I use Java if it matters.


You allude to it in your problem description, but the way to think about error-handling is asking yourself the question "is this a user-facing or internal API"? Users are considered untrustworthy and if there is a way to break or otherwise exploit your system, they will do it. In contrast, you trust yourself to do the "right thing" because you have control over how you use the system.

Regardless of the answer to this question, these sorts of pre-conditions you impose on your functions (resp. programs) should be documented in some form, e.g., in a comment. They are part of the interface to those functions and must be respected for your functions to perform as expected.

Whether you introduce more safe guards other than documentation depends on your answer to the question above. In the case of internal APIs, it is fine to not include any explicit checks. Some languages such as Java allow for assertions to be expressed that fit this mold. The statement assert e; evaluates the boolean expression e and raises an error if e is false. These asserts can be toggled on (for debugging) and off (for deployment) via flags to the compiler.

For user-facing APIs, it is a matter of good style to either "engineer" out these corner cases or otherwise provide internal checking to ensure that the inputs to the functions meet the functions' pre-conditions. If-statements are appropriate for this purpose. Try-catch blocks are typically reserved for exceptional cases that might occur during the execution of a function, e.g., a network socket getting yanked while you are reading in packets. They are not appropriate for merely checking these sorts of pre-conditions.

Nesserev
Profile Blog Joined January 2011
Belgium2760 Posts
Last Edited: 2013-12-11 07:20:08
December 11 2013 07:17 GMT
#8133
--- Nuked ---
windzor
Profile Joined October 2010
Denmark1013 Posts
Last Edited: 2013-12-11 09:15:05
December 11 2013 09:13 GMT
#8134
On December 11 2013 13:22 darkness wrote:
Say a user cannot cause a crash, but a programmer may pass some parameter that is out of boundaries. Is it good in this case to have all methods contain some boundary check (even if the programmer is the only person able to cause it) or is such check unnecessary?

Sub-question to the above one. What is preferred assuming both are available: if statement or try/catch blocks? When to go one over another?

I'm curious what to do for my individual university project. I'd like to do my best with the knowledge I have at the moment.

I use Java if it matters.


If you need to check parameter values for which you have set up preconditions but dont check for them in the code you should use asserts. It will be easy to read from your code what boundaries you expect the function to work in without the user having the hassle with errors which might not be errors.

How much you want to do it is a cost/benefit of how many errors you will catch from yourself vs how long you use on writing them.
Yeah
billy5000
Profile Blog Joined December 2010
United States865 Posts
December 11 2013 18:57 GMT
#8135
I have a question about databases. I took a dbms course last semester, and we specifically used psql. At the same time I was taking a mongodb course online as well. One thing that caught my attention was how easy it is to scale mongodb due to its flexibility, but this brings up a question: How do relational databases scale? It seems like you have to know all the details, such as the relationships between tables, before the application is built. And adding any extra features may denormalize the relationships you had before and just complicate things further (sorry, I haven't built anything big yet, so I don't have any concrete examples).
Tiger got to hunt, bird got to fly; Man got to sit and wonder, 'Why, why, why?' Tiger got to sleep, bird got to land; Man got to tell himself he understand. Vonnegut
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
December 11 2013 20:35 GMT
#8136
On December 11 2013 18:13 windzor wrote:
Show nested quote +
On December 11 2013 13:22 darkness wrote:
Say a user cannot cause a crash, but a programmer may pass some parameter that is out of boundaries. Is it good in this case to have all methods contain some boundary check (even if the programmer is the only person able to cause it) or is such check unnecessary?

Sub-question to the above one. What is preferred assuming both are available: if statement or try/catch blocks? When to go one over another?

I'm curious what to do for my individual university project. I'd like to do my best with the knowledge I have at the moment.

I use Java if it matters.


If you need to check parameter values for which you have set up preconditions but dont check for them in the code you should use asserts. It will be easy to read from your code what boundaries you expect the function to work in without the user having the hassle with errors which might not be errors.

How much you want to do it is a cost/benefit of how many errors you will catch from yourself vs how long you use on writing them.


Aren't asserts only for testing/debugging? I've searched for that on google, and I didn't find very positive suggestions to keep asserts in code for long.
tofucake
Profile Blog Joined October 2009
Hyrule19208 Posts
December 11 2013 21:08 GMT
#8137
Asserts in deployment are a pain in the ass.
Liquipediaasante sana squash banana
Deleted User 101379
Profile Blog Joined August 2010
4849 Posts
December 11 2013 21:24 GMT
#8138
On December 11 2013 13:22 darkness wrote:
Say a user cannot cause a crash, but a programmer may pass some parameter that is out of boundaries. Is it good in this case to have all methods contain some boundary check (even if the programmer is the only person able to cause it) or is such check unnecessary?

Sub-question to the above one. What is preferred assuming both are available: if statement or try/catch blocks? When to go one over another?

I'm curious what to do for my individual university project. I'd like to do my best with the knowledge I have at the moment.

I use Java if it matters.


For me there is one golden rule for error checking in programming:
In every userbase, no matter how big or small, there is at least one user that will manage to get the system into an invalid state. If you are the only user of the system (or method), it will eventually be you.

That means, even if you think you know that you always pass the right parameters into a function, eventually you will mix something up or forget the boundary conditions. That is why i check every parameter to every function (It's really not that much in a strongly typed language like java) because i know that eventually i will screw up. Noone remembers how the code he wrote 6 month ago really works in detail. There are some minor exceptions, for example in private methods i'm less strict about checking, though i still do check most of the input.

Then again, i'm really, really paranoid.
Kambing
Profile Joined May 2010
United States1176 Posts
December 11 2013 22:49 GMT
#8139
On December 12 2013 05:35 darkness wrote:
Show nested quote +
On December 11 2013 18:13 windzor wrote:
On December 11 2013 13:22 darkness wrote:
Say a user cannot cause a crash, but a programmer may pass some parameter that is out of boundaries. Is it good in this case to have all methods contain some boundary check (even if the programmer is the only person able to cause it) or is such check unnecessary?

Sub-question to the above one. What is preferred assuming both are available: if statement or try/catch blocks? When to go one over another?

I'm curious what to do for my individual university project. I'd like to do my best with the knowledge I have at the moment.

I use Java if it matters.


If you need to check parameter values for which you have set up preconditions but dont check for them in the code you should use asserts. It will be easy to read from your code what boundaries you expect the function to work in without the user having the hassle with errors which might not be errors.

How much you want to do it is a cost/benefit of how many errors you will catch from yourself vs how long you use on writing them.


Aren't asserts only for testing/debugging? I've searched for that on google, and I didn't find very positive suggestions to keep asserts in code for long.


Asserts are meant to capture pre-conditions/invariants in your code that are not explicitly checked. They are precisely the set of properties about your code that are "assumptions" that you assume will hold but trust the user of that code to get right. For example:

"The argument to factorial should be non-negative."
"Your helper function expects a non-null object."
"Your file processing function expects a file handled that has been opened but not yet closed."

In particular, the Java assert statement lets you express these in code versus in comments and gives you mechanism to have them checked (morally, when debugging) or not checked (morally, when deploying) as needed.
Kambing
Profile Joined May 2010
United States1176 Posts
December 12 2013 01:29 GMT
#8140
FYI, this week is Computer Science Education week!

http://csedweek.org/

This year, the code.org are pushing a nationwide movement for everyone to spend an hour of their time this week to learn how to code or teach a friend or family member how to code. Check out:

http://csedweek.org/learn

For tutorials for virtually all ages for a variety of technologies, with and without computers!
Prev 1 405 406 407 408 409 1032 Next
Please log in or register to reply.
Live Events Refresh
Next event in 2h 26m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
NeuroSwarm 523
ProTech123
Nina 97
StarCraft: Brood War
GuemChi 4139
Horang2 872
soO 48
yabsab 33
Shine 21
Nal_rA 21
Bale 10
Icarus 10
Dota 2
monkeys_forever724
League of Legends
JimRising 751
Counter-Strike
Stewie2K1299
Heroes of the Storm
Khaldor102
Other Games
summit1g10357
WinterStarcraft519
C9.Mang0203
-ZergGirl181
Mew2King63
Organizations
Other Games
gamesdonequick602
StarCraft: Brood War
Kim Chul Min (afreeca) 14
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 16 non-featured ]
StarCraft 2
• Berry_CruncH190
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Rush1314
• Lourlo1140
• Stunt833
• TFBlade672
Other Games
• Scarra1329
Upcoming Events
Replay Cast
2h 26m
Afreeca Starleague
3h 26m
Soma vs hero
Wardi Open
4h 26m
Monday Night Weeklies
9h 26m
Replay Cast
17h 26m
Replay Cast
1d 2h
Afreeca Starleague
1d 3h
Leta vs YSC
GSL
2 days
Replay Cast
2 days
GSL
3 days
[ Show More ]
The PondCast
3 days
KCM Race Survival
3 days
Replay Cast
3 days
Replay Cast
4 days
Escore
4 days
Replay Cast
4 days
Replay Cast
5 days
IPSL
5 days
Ret vs Art_Of_Turtle
Radley vs TBD
BSL
5 days
Replay Cast
5 days
uThermal 2v2 Circuit
6 days
BSL
6 days
IPSL
6 days
eOnzErG vs TBD
G5 vs Nesh
Liquipedia Results

Completed

Escore Tournament S2: W4
WardiTV TLMC #16
Nations Cup 2026

Ongoing

BSL Season 22
ASL Season 21
CSL 2026 SPRING (S20)
IPSL Spring 2026
KCM Race Survival 2026 Season 2
StarCraft2 Community Team League 2026 Spring
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League S23 Finals
ESL Pro League S23 Stage 1&2
PGL Cluj-Napoca 2026

Upcoming

Escore Tournament S2: W5
KK 2v2 League Season 1
Acropolis #4
BSL 22 Non-Korean Championship
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
Maestros of the Game 2
2026 GSL S2
RSL Revival: Season 5
2026 GSL S1
XSE Pro League 2026
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
IEM Atlanta 2026
Asian Champions League 2026
PGL Astana 2026
BLAST Rivals Spring 2026
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 © 2026 TLnet. All Rights Reserved.