The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
It's not about compiling, per se, but about testing.
Some people like to write an entire chunk of functionality, then do all their testing, iterating at that level when they find the problems.
Some, (myself included), like to write a small chunk of the overall functionality, test it thoroughly, then move on to the next small chunk. This approach probably means less unit-level testing, but more integration testing, I suppose.
Think everyone develops their own habits naturally for me, as a Linux C/C++ developer, if it's maintenance I am doing fairly frequently as I am making my code changes. We work with eclipse and CMake so it's easy just to hit the build button.
But when I am adding a new feature and looking at my class diagrams (Dia, visio type). It normally happens at the end after I code a nearly complete class and add it to the CMakeList.txt file.
Think if people created well fleshed out class diagram first, it would happen less often when you start coding it, but then more often afterward.
When I was young and unexperienced, it was more like a lottery whether my code would run or crash. Knowing that on a subconcious level, I didn't want to be reminded of how unexperienced I was, rarely compiled and never debugged unless there actually was a bug. But finding the bugs I produced sometimes took more than twice as much time as it took to produce them, and I believe some of them were never even found by anyone at all.
Today, with more than 20 years of experience, when writing production-level code (so this doesn't go for clickdummies etc.), I want to be aware of my code quality at any time, which means I compile and run *very* often and execute all newly written code in the debugger step by step, having a look at the state of all objects and local variables involved. So lottery no more!
This significantly decreases my development speed, by let's say factor 3, while increasing my code quality by factor 2 only. But(!!) economically, this is still sensible bc it spares the quality assurance and technical support people some effort and prevents customers from running away due to poor code quality and frequent crashes.
It depends, but in general, as soon as all the related changes needed in order to have a successful compile have been made, I try compiling it. In well designed code, that time usually comes very quick as very little code needs to be changes. In really poorly designed code, it might be a week.
Create a project, figure stuff out, finish (or don't) project.
Create a new project, copy paste everything you need from first project because you already figured this stuff out, finish (or don't) project.
Create a third project, copy paste everything you need from second project because the first one is ([sarcasm]obviously[/sarcasm]) outdated and shouldn't be used as a reference, finish (or don't) project.
Create a n-th project, copy paste everything you need from n-th - 1 project because n-th - 2 project is outdated and shouldn't be used as a reference, finish (or don't) project.
It's mostly stuf like authentication, database setup, renaming default cookies, some custom routing, setting up your DI framework, etc.
Mostly the Startup class in ASP.NET Core or the Globas.asax/App_Start classes in .NET Framework.
I usually shelve my changes or branch them then copy from shelveset/branch to trunk/main, etc. I don't create separate projects unless I have to , which is rare.
You mean like, some code that you can look up later?
I didn't mean create new projects just to test/save some code, but because the business actually requires them.
I work for multiple customers and all do microservices (because I've said so)
I created at least ten new serious projects that will be/are in production this year alone and they all need "the basics" like authentication, database, DI, etc.
I've considered writing a utility package and re-use that, but it's not really worth it as it's mostly two lines here, two lines there, with usually slightly different parameters as well.
I will however create separate console apps sometimes to test services, web apis, etc. if I don't use a unit test to do that, which can be convenient, even though it is not really a "unit test".
I do that too sometimes. It's more of an integration test I guess.
At work we've got a starter solution with all the stuff built in that's to be used as a baseline for new development so we don't have to reinvent the wheel and to keep all our solutions organized somewhat similarly to make it easier for anyone switching projects to get up to speed.
Did you ever see history portrayed as an old man with a wise brow and pulseless heart, weighing all things in the balance of reason?
Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful?
Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies.
-- Sarah Hoyt
Nah, I'm far too lazy for that. I would instead do the following:
Create a project, figure stuff out, finish (or don't) project.
Have requirement to do second project with similar stuff.
Put second project on hold.
Create "template project" that has all the figured out stuff in it (auth, setup, etc.)
Copy template project and rename it project 2.
Repeat as needed, and update template if new "common stuffs" are identified.
Wait, you mean like a regular project that you copy/paste and then rename?
Not like a Visual Studio template?
In that case it's almost what I do too, except I copy the code rather than the template because I can't be bothered with renaming templates and namespaces
Yeah, I mean a regular project... I have no desire to mess with VS templates either.
The renaming process was only a pain the first time (just because I had to work out how to even do it properly). But after that I wrote the steps down and it was pretty easy to do it in a couple of minutes. Which is fine if you only need a copy once a month for example.
I don't have a need to do this anymore due to my current job requirements, but if I did, I would no doubt have created a "VS solution renaming tool" by now
I re-use a LOT of code. New projects simply get references to older assemblies.
My most often used are:
- "Common", which contains object extensions, connection string handling, attributes, and otherwise universally usable code
- "DAL", which contains database access code (that also references "Common"
- "WpfCommon", which contains controls, converters, a base class that supports INotifyPropertyChanged and IDataError, and my WPF wizard control stuff
As I go, I add things to those three, but since they've all been in my library for at least 10 years, they're pretty stable. Today, I added some extension methods for strings that allow me to perform ToUpper() and ToLower() on the specified part of a string, as well as a method that performs a Replace for all instances of a substring (like when you have an unknown number of consecutive spaces, and you want to reduce it to just a single space).
As far as starting a project from scratch, I have a MVC template I use that includes a lot of stuff I always do.As I add stuff to that list of things always done, I update the template. It includes all of the NuGet packages I use, and adjustments to the various files.
I created a "super" template for work that supports our app development techniques, and it starts you off with a complete running app with user reg/login, layout, and database support. The generated app includes documentation regarding how to code in the eco-system and where to find stuff. To make it app-specific, you only have to change one variable in Globals.asax.cs. The template already references the "Common" and the "DAL" assemblies, as well as app-specific BLL assemblies.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
No, really not. When you have stuff that is worth keeping, then give it its own project, maintain it there and add this project to any solution where it may be needed. This way you don't have redundant code floating around and don't accidentally import outdated stuff into a new project. And yes, it's peerfectly ok to maintain several such assemblies. You are not forced to marry things that don't belong together.
I have lived with several Zen masters - all of them were cats.
His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.
Depending on what I'm doing I always have a base starting point. If I'm making a mobile app, I have my base "mobile app" setup with a bunch of functions that I use all the time.
If I'm working on a PHP web project I always include my common PHP functions that I use a lot. These bases grow over the years and I"m constantly adding to them and sometimes removing stuff when the language i'm using adds new functions that solve stuff I had solved by making my own!
Creating a NuGet repository is more trouble than it's worth though.
And if the code is customer specific you can't really have packages like "Sander.Utils" around either, they expect "Company.Utils" at the least, but so does that other customer.
So not even packages are always reusable
It's also a bit different for Azure Function projects, etc.
When I'm trying out something new sometimes I'll make a little test bench app to learn about it. That's a whole lot easier than adding it directly to one of our products and figuring things out there amidst three million lines of code.
Do you mean compile or actually test?
A function that adds a and a instead of a and b compiles fine, but it's still a bug.
I compile more often than test.
How often I compile depends on what I'm doing.
If I'm writing new functionality I usually don't compile until I think it's (partly) done.
Whenever I'm fixing bugs or typo's I sometimes compile after every few keystrokes.
And I save VERY often, like every minute or so (and sometimes more often).
Probably many of you already now it but just in case...
I was searching for an issue I am having with routed commands. I found a blog speaking about the article "Understanding Routed Events and Commands In WPF" by Brian Noyes and I just found: MSDN Magazine Issues[^] MSDN Magazine-Ausgaben[^] (Same site, German Version)
In there you might find a copy of all MSDN magazines to read online and or download for offline use. (Prior 2008 are in *.chm help files, which I actually find better as the PDF edition)
Thanks for it, Microsoft
(I only hope they don't deactivate the site after switching MSDN off)
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
modified 19-Sep-19 4:25am.
Last Visit: 22-Oct-19 4:56 Last Update: 22-Oct-19 4:56