Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

 write code from scratch or modify template, how you do programming ?

views
     
TSdobidobi23
post Apr 18 2017, 11:09 PM, updated 7y ago

Getting Started
**
Junior Member
75 posts

Joined: Jul 2009
i'm a beginner in javascript and php.

i'm curious how you guys do programming.
lets say u want to code a new function to add in your website, do you write the piece code from scratch ?
OR find an existing template code from google and modify the code ?

pls pardon me if its a stupid question.



and teach me how u guys find existing code template ?
let say i want add a 'installments calculator function' on my homepage, how and where to find this existing scripts ?

This post has been edited by dobidobi23: Apr 18 2017, 11:15 PM
badai
post Apr 19 2017, 03:49 PM

Enthusiast
*****
Senior Member
986 posts

Joined: Jan 2003
small thing: write a bit, copy paste, write, copy paste, modify, modify, copy paste, write original code, copy paste .... (in no particular order)

big thing: generate code, modify, then do as in "small thing" above

xsan
post Apr 20 2017, 11:33 AM

Ouh Emm Gee I Can Edit This Nao
******
Senior Member
1,020 posts

Joined: Jul 2006
From: Bastion Keep


it depends...

if time constraint, might be better just modify..
if not, well write from scratch would be useful for controlling the codes..

and nowadays, there are lot of things can be found and include in the apps..
e.g : laravel got a lot of repo for some apps.. you can just pull it and use it..


otakotak
post Apr 20 2017, 03:41 PM

Getting Started
**
Junior Member
278 posts

Joined: Nov 2010


careful with template keyword here. the meaning can be interpreted differently depending on context.
imho the correct term would be boilerplate.

for web dev, if you are already using somewhat established framework like laravel, express , codeigniter..and etc.
it's better to have a boilerplate ready with all features available. just remove them accordingly based on project need.
not the other way around where u add stuff based on project. there's plenty of boilerplate generator out there for all this frameworks.

meanwhile for reusable code, it's a good practise to write generic library and put in under shared component to be reuse.
avoid writing code that you need to copy and paste when needed. that is snippet not really a library smile.gif also copy&paste can lead to stupid bugs nod.gif

basically this is how i organize my work smile.gif
anti-informatic
post Apr 23 2017, 10:03 PM

Enthusiast
*****
Senior Member
902 posts

Joined: Dec 2006
If you want to do something common, looking for existing method is naturally must more time saving and good practice because you shouldn't spend time writing code for something that is already there. Don't worry about copy-paste code, it's not stealing as long as people share it. Just make sure you can understand the code and learn it well so that you can write the same piece of code in the future.

As for where to find, there are only two places: Google or from your own mind. I learn everything about programming from Google. As long as it's not too complex, Google usually got the answer.

If Google don't have it, you gotta get it from your mind. Of course, you need lots of learning and experience to create the function you want. So for starter, try to learn as much as you could.
Lord Tiki Mick
post Apr 24 2017, 01:36 AM

Regular
******
Senior Member
1,018 posts

Joined: Jul 2012
I always write from scratch.
PlayPlayHa
post Apr 26 2017, 04:24 PM

Getting Started
**
Junior Member
56 posts

Joined: Nov 2008
got tools then use tools
no tools then make tools...

i don't usually make tools....

if there is suitable template/sample.. just use..
monk8800
post May 28 2017, 01:10 PM

New Member
*
Junior Member
23 posts

Joined: Feb 2017
Truth be told a good portion of developers could not survive without google and stackoverflow. To answer your question it all depends on the use case. A great deal of libraries frameworks exist. If you pretty much think it, some one else has created it. the smartest thing and i stress this depending on the usecase is to leverage on proven tested ane validated code. They are instances were we need to write from scratch and usually with custom solutions it's a mashup of both. Having a sound understanding of what you copy is important, so that you minimize your technical debt.
manjacat
post Jun 3 2017, 08:59 AM

New Member
*
Junior Member
32 posts

Joined: Dec 2013


QUOTE(dobidobi23 @ Apr 18 2017, 11:09 PM)
i'm a beginner in javascript and php.

i'm curious how you guys do programming.
lets say u want to code a new function to add in your website, do you write the piece code from scratch ?
OR find an existing template code from google and modify the code ?

pls pardon me if its a stupid question.
and teach me how u guys find existing code template ?
let say i want add a 'installments calculator function' on my homepage, how and where to find this existing scripts ?
*
depends..

some website elements.. forexample a datepicker, or popup.. there's a lot of open source code to do it. so you don't need to do it from scratch.

for logic, sometimes you do it from scratch, sometimes you copy/modify from existing code..
depends la.. if you copy from outside but you can't integrate it with your existing system/website, no use also.

i think if you're looking for installment calculator function, it should be in the internet already.

just google calculator php and then modify that code appropriately

zarey
post Jun 3 2017, 10:35 AM

New Member
*
Junior Member
11 posts

Joined: Jun 2017
From: Miri, Sarawak.


I think that depends on the function complexity that you are gonna write, the size of program itself and the budget + time for the program to be implemented etc etc. Some people prefer to use the framework as their base / foundation for the whole program then they wrote the custom one either from scratch or copy paste from gist / github / stackoverflow etc etc. Well, if the company does not allow to use open source framework due to some constraint & they can afford to hire a team to develop the program / system itself, then they have to write it from scratch.

Since you are beginner level, you can pick any PHP framework such as Symfony, Laravel, etc etc & same goes for Javascript. My advice is just pick one first & focus learning that framework because it is gonna consume lots of your time. At the same time, you can learn to read their code in order for you to understand the PHP & Javascript much deeper.

You don't have to feel hopeless when it comes to catch up with all of those programming codes because that is part of IT & Computing world nature, always obsolete when it reaches some points. Good luck for your endeavour thumbsup.gif
dewill
post Jun 20 2017, 02:24 PM

Regular
******
Senior Member
1,716 posts

Joined: Feb 2006


for project, i start with mvc then get a template to integrate with it.

for simple demo, start by using scaffolding

 

Change to:
| Lo-Fi Version
0.0138sec    0.44    5 queries    GZIP Disabled
Time is now: 29th March 2024 - 01:23 PM